From jackjansen@users.sourceforge.net Tue Apr 1 13:32:20 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 05:32:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv6654 Modified Files: gensuitemodule.py Log Message: - All messages are now dependent on the --verbose option. - Added a --dump option that doesn't generate the module but dumps the pretty-printed aete resource(s) on stdout. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gensuitemodule.py 30 Mar 2003 22:39:39 -0000 1.2 --- gensuitemodule.py 1 Apr 2003 13:32:17 -0000 1.3 *************** *** 37,40 **** --- 37,42 ---- --edit old=new Edit suite names, use empty new to skip a suite (-e) --creator code Set creator code for package (-c) + --dump Dump aete resource to stdout in stead of creating module (-d) + --verbose Tell us what happens (-v) """) sys.exit(1) *************** *** 42,47 **** def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:c:" ! LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=") try: opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) --- 44,49 ---- def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:c:dv" ! LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=", "dump", "verbose") try: opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) *************** *** 54,57 **** --- 56,61 ---- edit_modnames = [] creatorsignature = None + dump = None + verbose = None for o, a in opts: *************** *** 72,75 **** --- 76,83 ---- sys.exit(1) creatorsignature = a + if o in ('-d', '--dump'): + dump = sys.stdout + if o in ('-v', '--verbose'): + verbose = sys.stderr *************** *** 80,84 **** for filename in args: process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames, creatorsignature=creatorsignature) else: main_interactive() --- 88,93 ---- for filename in args: process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames, creatorsignature=creatorsignature, ! dump=dump, verbose=verbose) else: main_interactive() *************** *** 104,113 **** return try: ! processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname) except MacOS.Error, arg: print "Error getting terminology:", arg print "Retry, manually parsing resources" processfile_fromresource(filename, edit_modnames=edit_modnames, ! basepkgname=basepkgname) def is_scriptable(application): --- 113,123 ---- return try: ! processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname, ! verbose=sys.stderr) except MacOS.Error, arg: print "Error getting terminology:", arg print "Retry, manually parsing resources" processfile_fromresource(filename, edit_modnames=edit_modnames, ! basepkgname=basepkgname, verbose=sys.stderr) def is_scriptable(application): *************** *** 133,142 **** def processfile_fromresource(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Process all resources in a single file""" ! if not is_scriptable(fullname): ! print "Warning: app does not seem scriptable: %s" % fullname cur = CurResFile() ! print "Processing", fullname rf = macresource.open_pathname(fullname) try: --- 143,153 ---- def processfile_fromresource(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, dump=None, verbose=None): """Process all resources in a single file""" ! if not is_scriptable(fullname) and verbose: ! print >>verbose, "Warning: app does not seem scriptable: %s" % fullname cur = CurResFile() ! if verbose: ! print >>verbose, "Processing", fullname rf = macresource.open_pathname(fullname) try: *************** *** 149,158 **** res = Get1IndResource('aeut', 1+i) resources.append(res) ! print "\nLISTING aete+aeut RESOURCES IN", `fullname` aetelist = [] for res in resources: ! print "decoding", res.GetResInfo(), "..." data = res.data ! aete = decode(data) aetelist.append((aete, res.GetResInfo())) finally: --- 160,171 ---- res = Get1IndResource('aeut', 1+i) resources.append(res) ! if verbose: ! print >>verbose, "\nLISTING aete+aeut RESOURCES IN", `fullname` aetelist = [] for res in resources: ! if verbose: ! print >>verbose, "decoding", res.GetResInfo(), "..." data = res.data ! aete = decode(data, verbose) aetelist.append((aete, res.GetResInfo())) finally: *************** *** 162,181 **** # switch back (needed for dialogs in Python) UseResFile(cur) compileaetelist(aetelist, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature) def processfile(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" ! if not is_scriptable(fullname): ! print "Warning: app does not seem scriptable: %s" % fullname ! print "\nASKING FOR aete DICTIONARY IN", `fullname` try: aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound ! print "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually" ! aedata, sig = getappterminology(fullname) if not creatorsignature: creatorsignature = sig --- 175,199 ---- # switch back (needed for dialogs in Python) UseResFile(cur) + if dump: + dumpaetelist(aetelist, dump) compileaetelist(aetelist, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature, verbose=verbose) def processfile(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, dump=None, ! verbose=None): """Ask an application for its terminology and process that""" ! if not is_scriptable(fullname) and verbose: ! print >>verbose, "Warning: app does not seem scriptable: %s" % fullname ! if verbose: ! print >>verbose, "\nASKING FOR aete DICTIONARY IN", `fullname` try: aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound ! if verbose: ! print >>verbose, "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually" ! aedata, sig = getappterminology(fullname, verbose=verbose) if not creatorsignature: creatorsignature = sig *************** *** 184,201 **** else: if launched: ! print "Launched", fullname raw = aetools.unpack(aedescobj) if not raw: ! print 'Unpack returned empty value:', raw return ! if not raw[0].data: ! print 'Unpack returned value without data:', raw return aedata = raw[0] ! aete = decode(aedata.data) compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature, edit_modnames=edit_modnames) ! def getappterminology(fullname): """Get application terminology by sending an AppleEvent""" # First check that we actually can send AppleEvents --- 202,226 ---- else: if launched: ! if verbose: ! print >>verbose, "Launched", fullname raw = aetools.unpack(aedescobj) if not raw: ! if verbose: ! print >>verbose, 'Unpack returned empty value:', raw return ! if not raw[0].data: ! if verbose: ! print >>verbose, 'Unpack returned value without data:', raw return aedata = raw[0] ! aete = decode(aedata.data, verbose) ! if dump: ! dumpaetelist([aete], dump) ! return compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature, edit_modnames=edit_modnames, ! verbose=verbose) ! def getappterminology(fullname, verbose=None): """Get application terminology by sending an AppleEvent""" # First check that we actually can send AppleEvents *************** *** 221,225 **** talker._start() except (MacOS.Error, aetools.Error), arg: ! print 'Warning: start() failed, continuing anyway:', arg reply = talker.send("ascr", "gdte") #reply2 = talker.send("ascr", "gdut") --- 246,251 ---- talker._start() except (MacOS.Error, aetools.Error), arg: ! if verbose: ! print >>verbose, 'Warning: start() failed, continuing anyway:', arg reply = talker.send("ascr", "gdte") #reply2 = talker.send("ascr", "gdut") *************** *** 229,239 **** def compileaetelist(aetelist, fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): for aete, resinfo in aetelist: compileaete(aete, resinfo, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature) ! ! def decode(data): """Decode a resource into a python data structure""" f = StringIO.StringIO(data) --- 255,269 ---- def compileaetelist(aetelist, fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, verbose=None): for aete, resinfo in aetelist: compileaete(aete, resinfo, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature, verbose=verbose) ! ! def dumpaetelist(aetelist, output): ! import pprint ! pprint.pprint(aetelist, output) ! ! def decode(data, verbose=None): """Decode a resource into a python data structure""" f = StringIO.StringIO(data) *************** *** 243,248 **** unprocessed = len(f.read()) total = f.tell() ! if unprocessed: ! sys.stderr.write("%d processed + %d unprocessed = %d total\n" % (processed, unprocessed, total)) return aete --- 273,278 ---- unprocessed = len(f.read()) total = f.tell() ! if unprocessed and verbose: ! verbose.write("%d processed + %d unprocessed = %d total\n" % (processed, unprocessed, total)) return aete *************** *** 399,403 **** def compileaete(aete, resinfo, fname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete --- 429,433 ---- def compileaete(aete, resinfo, fname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, verbose=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete *************** *** 439,443 **** for suite in suites: code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames) if not code: continue --- 469,473 ---- for suite in suites: code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames, verbose=verbose) if not code: continue *************** *** 448,452 **** for suiteinfo in allsuites: compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None)) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') --- 478,482 ---- for suiteinfo in allsuites: compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None), verbose=verbose) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') *************** *** 512,516 **** fp.close() ! def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared --- 542,547 ---- fp.close() ! def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None, ! verbose=None): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared *************** *** 549,553 **** findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None)) for cls in classes: objc.compileclass(cls) --- 580,585 ---- findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None), ! verbose=verbose) for cls in classes: objc.compileclass(cls) *************** *** 569,573 **** def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite --- 601,605 ---- def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1, verbose=None): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite *************** *** 625,629 **** fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact) for cls in classes: objc.compileclass(cls) --- 657,662 ---- fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact, ! verbose=verbose) for cls in classes: objc.compileclass(cls) *************** *** 779,783 **** class CodeNameMapper: ! def __init__(self, interact=1): self.code2name = { "property" : {}, --- 812,816 ---- class CodeNameMapper: ! def __init__(self, interact=1, verbose=None): self.code2name = { "property" : {}, *************** *** 795,798 **** --- 828,832 ---- self.star_imported = 0 self.can_interact = interact + self.verbose = verbose def addnamecode(self, type, name, code): *************** *** 838,846 **** class ObjectCompiler: ! def __init__(self, fp, basesuite=None, othernamemappers=None, interact=1): self.fp = fp self.basesuite = basesuite self.can_interact = interact ! self.namemappers = [CodeNameMapper(self.can_interact)] if othernamemappers: self.othernamemappers = othernamemappers[:] --- 872,882 ---- class ObjectCompiler: ! def __init__(self, fp, basesuite=None, othernamemappers=None, interact=1, ! verbose=None): self.fp = fp + self.verbose = verbose self.basesuite = basesuite self.can_interact = interact ! self.namemappers = [CodeNameMapper(self.can_interact, self.verbose)] if othernamemappers: self.othernamemappers = othernamemappers[:] *************** *** 848,852 **** self.othernamemappers = [] if basesuite: ! basemapper = CodeNameMapper(self.can_interact) basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) --- 884,888 ---- self.othernamemappers = [] if basesuite: ! basemapper = CodeNameMapper(self.can_interact, self.verbose) basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) *************** *** 882,886 **** m = None if not m: return None, None, None ! mapper = CodeNameMapper(self.can_interact) mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) --- 918,922 ---- m = None if not m: return None, None, None ! mapper = CodeNameMapper(self.can_interact, self.verbose) mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) *************** *** 888,892 **** def askdefinitionmodule(self, type, code): if not self.can_interact: ! print "** No definition for %s '%s' found" % (type, code) return None path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) --- 924,929 ---- def askdefinitionmodule(self, type, code): if not self.can_interact: ! if self.verbose: ! print >>self.verbose, "** No definition for %s '%s' found" % (type, code) return None path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) *************** *** 955,959 **** if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and properties[0][1] != 'c@#!')): ! print '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`) raise RuntimeError, "About to skip non-empty class" return --- 992,997 ---- if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and properties[0][1] != 'c@#!')): ! if self.verbose: ! print >>self.verbose, '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`) raise RuntimeError, "About to skip non-empty class" return From jackjansen@users.sourceforge.net Tue Apr 1 14:25:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 06:25:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv2273 Modified Files: gensuitemodule.py Log Message: Turned the suite compiler into an object. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gensuitemodule.py 1 Apr 2003 13:32:17 -0000 1.3 --- gensuitemodule.py 1 Apr 2003 14:25:49 -0000 1.4 *************** *** 468,473 **** allsuites = [] for suite in suites: ! code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames, verbose=verbose) if not code: continue --- 468,473 ---- allsuites = [] for suite in suites: ! compiler = SuiteCompiler(suite, basepackage, output, edit_modnames, verbose) ! code, modname, precompinfo = compiler.precompilesuite() if not code: continue *************** *** 475,482 **** suiteinfo = suite, pathname, modname suitelist.append((code, modname)) ! allsuites.append(suiteinfo) ! for suiteinfo in allsuites: ! compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None), verbose=verbose) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') --- 475,481 ---- suiteinfo = suite, pathname, modname suitelist.append((code, modname)) ! allsuites.append(compiler) ! for compiler in allsuites: ! compiler.compilesuite(major, minor, language, script, fname, allprecompinfo) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') *************** *** 541,806 **** fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() - - def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None, - verbose=None): - """Parse a single suite without generating the output. This step is needed - so we can resolve recursive references by suites to enums/comps/etc declared - in other suites""" - [name, desc, code, level, version, events, classes, comps, enums] = suite - - modname = identify(name) - if len(modname) > 28: - modname = modname[:27] - if edit_modnames is None: - pathname = EasyDialogs.AskFileForSave(message='Python output file', - savedFileName=modname+'.py') - else: - for old, new in edit_modnames: - if old == modname: - modname = new - if modname: - pathname = os.path.join(output, modname + '.py') - else: - pathname = None - if not pathname: - return None, None, None, None, None - - modname = os.path.splitext(os.path.split(pathname)[1])[0] - - if basepackage and basepackage._code_to_module.has_key(code): - # We are an extension of a baseclass (usually an application extending - # Standard_Suite or so). Import everything from our base module - basemodule = basepackage._code_to_module[code] - else: - # We are not an extension. - basemodule = None - - enumsneeded = {} - for event in events: - findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None), ! verbose=verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! ! for enum in enumsneeded.keys(): ! objc.checkforenum(enum) ! objc.dumpindex() ! ! precompinfo = objc.getprecompinfo(modname) ! ! return code, suite, pathname, modname, precompinfo ! ! def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1, verbose=None): ! """Generate code for a single suite""" ! [name, desc, code, level, version, events, classes, comps, enums] = suite ! # Sort various lists, so re-generated source is easier compared ! def class_sorter(k1, k2): ! """Sort classes by code, and make sure main class sorts before synonyms""" ! # [name, code, desc, properties, elements] = cls ! if k1[1] < k2[1]: return -1 ! if k1[1] > k2[1]: return 1 ! if not k2[3] or k2[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return -1 ! if not k1[3] or k1[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return 1 ! return 0 ! events.sort() ! classes.sort(class_sorter) ! comps.sort() ! enums.sort() ! ! fp = open(pathname, 'w') ! MacOS.SetCreatorAndType(pathname, 'Pyth', 'TEXT') ! fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) ! fp.write("Level %d, version %d\n\n" % (level, version)) ! fp.write("Generated from %s\n"%ascii(fname)) ! fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ ! (major, minor, language, script)) ! fp.write('"""\n\n') ! fp.write('import aetools\n') ! fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `code`) ! if basepackage and basepackage._code_to_module.has_key(code): ! # We are an extension of a baseclass (usually an application extending ! # Standard_Suite or so). Import everything from our base module ! fp.write('from %s import *\n'%basepackage._code_to_fullname[code][0]) ! basemodule = basepackage._code_to_module[code] ! elif basepackage and basepackage._code_to_module.has_key(code.lower()): ! # This is needed by CodeWarrior and some others. ! fp.write('from %s import *\n'%basepackage._code_to_fullname[code.lower()][0]) ! basemodule = basepackage._code_to_module[code.lower()] ! else: ! # We are not an extension. ! basemodule = None ! compileclassheader(fp, modname, basemodule) ! ! enumsneeded = {} ! if events: for event in events: ! compileevent(fp, event, enumsneeded) ! else: ! fp.write("\tpass\n\n") ! ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact, ! verbose=verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! for enum in enumsneeded.keys(): ! objc.checkforenum(enum) ! objc.dumpindex() ! return code, modname ! def compileclassheader(fp, name, module=None): ! """Generate class boilerplate""" ! classname = '%s_Events'%name ! if module: ! modshortname = string.split(module.__name__, '.')[-1] ! baseclassname = '%s_Events'%modshortname ! fp.write("class %s(%s):\n\n"%(classname, baseclassname)) ! else: ! fp.write("class %s:\n\n"%classname) ! def compileevent(fp, event, enumsneeded): ! """Generate code for a single event""" ! [name, desc, code, subcode, returns, accepts, arguments] = event ! funcname = identify(name) ! # ! # generate name->keyword map ! # ! if arguments: ! fp.write("\t_argmap_%s = {\n"%funcname) ! for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `a[1]`)) ! fp.write("\t}\n\n") ! # ! # Generate function header ! # ! has_arg = (not is_null(accepts)) ! opt_arg = (has_arg and is_optional(accepts)) ! ! fp.write("\tdef %s(self, "%funcname) ! if has_arg: ! if not opt_arg: ! fp.write("_object, ") # Include direct object, if it has one else: ! fp.write("_object=None, ") # Also include if it is optional ! else: ! fp.write("_no_object=None, ") # For argument checking ! fp.write("_attributes={}, **_arguments):\n") # include attribute dict and args ! # ! # Generate doc string (important, since it may be the only ! # available documentation, due to our name-remaping) ! # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) ! if has_arg: ! fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) ! elif opt_arg: ! fp.write("\t\tOptional argument: %s\n"%getdatadoc(accepts)) ! for arg in arguments: ! fp.write("\t\tKeyword argument %s: %s\n"%(identify(arg[0]), ! getdatadoc(arg[2]))) ! fp.write("\t\tKeyword argument _attributes: AppleEvent attribute dictionary\n") ! if not is_null(returns): ! fp.write("\t\tReturns: %s\n"%getdatadoc(returns)) ! fp.write('\t\t"""\n') ! # ! # Fiddle the args so everything ends up in 'arguments' dictionary ! # ! fp.write("\t\t_code = %s\n"% `code`) ! fp.write("\t\t_subcode = %s\n\n"% `subcode`) ! # ! # Do keyword name substitution ! # ! if arguments: ! fp.write("\t\taetools.keysubst(_arguments, self._argmap_%s)\n"%funcname) ! else: ! fp.write("\t\tif _arguments: raise TypeError, 'No optional args expected'\n") ! # ! # Stuff required arg (if there is one) into arguments ! # ! if has_arg: ! fp.write("\t\t_arguments['----'] = _object\n") ! elif opt_arg: ! fp.write("\t\tif _object:\n") ! fp.write("\t\t\t_arguments['----'] = _object\n") ! else: ! fp.write("\t\tif _no_object != None: raise TypeError, 'No direct arg expected'\n") ! fp.write("\n") ! # ! # Do enum-name substitution ! # ! for a in arguments: ! if is_enum(a[2]): ! kname = a[1] ! ename = a[2][0] ! if ename <> '****': ! fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`kname`, identify(ename))) ! enumsneeded[ename] = 1 ! fp.write("\n") ! # ! # Do the transaction ! # ! fp.write("\t\t_reply, _arguments, _attributes = self.send(_code, _subcode,\n") ! fp.write("\t\t\t\t_arguments, _attributes)\n") ! # ! # Error handling ! # ! fp.write("\t\tif _arguments.get('errn', 0):\n") ! fp.write("\t\t\traise aetools.Error, aetools.decodeerror(_arguments)\n") ! fp.write("\t\t# XXXX Optionally decode result\n") ! # ! # Decode result ! # ! fp.write("\t\tif _arguments.has_key('----'):\n") ! if is_enum(returns): ! fp.write("\t\t\t# XXXX Should do enum remapping here...\n") ! fp.write("\t\t\treturn _arguments['----']\n") ! fp.write("\n") - # print "\n# Command %s -- %s (%s, %s)" % (`name`, `desc`, `code`, `subcode`) - # print "# returns", compiledata(returns) - # print "# accepts", compiledata(accepts) - # for arg in arguments: - # compileargument(arg) - - def compileargument(arg): - [name, keyword, what] = arg - print "# %s (%s)" % (name, `keyword`), compiledata(what) - - def findenumsinevent(event, enumsneeded): - """Find all enums for a single event""" - [name, desc, code, subcode, returns, accepts, arguments] = event - for a in arguments: - if is_enum(a[2]): - ename = a[2][0] - if ename <> '****': - enumsneeded[ename] = 1 - # # This class stores the code<->name translations for a single module. It is used --- 540,810 ---- fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() ! class SuiteCompiler: ! def __init__(self, suite, basepackage, output, edit_modnames, verbose): ! self.suite = suite ! self.basepackage = basepackage ! self.edit_modnames = edit_modnames ! self.output = output ! self.verbose = verbose ! # Set by precompilesuite ! self.pathname = None ! self.modname = None ! # Set by compilesuite ! self.fp = None ! self.basemodule = None ! self.enumsneeded = {} ! ! def precompilesuite(self): ! """Parse a single suite without generating the output. This step is needed ! so we can resolve recursive references by suites to enums/comps/etc declared ! in other suites""" ! [name, desc, code, level, version, events, classes, comps, enums] = self.suite ! ! modname = identify(name) ! if len(modname) > 28: ! modname = modname[:27] ! if self.edit_modnames is None: ! self.pathname = EasyDialogs.AskFileForSave(message='Python output file', ! savedFileName=modname+'.py') ! else: ! for old, new in self.edit_modnames: ! if old == modname: ! modname = new ! if modname: ! self.pathname = os.path.join(self.output, modname + '.py') ! else: ! self.pathname = None ! if not self.pathname: ! return None, None, None ! self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0] ! ! if self.basepackage and self.basepackage._code_to_module.has_key(code): ! # We are an extension of a baseclass (usually an application extending ! # Standard_Suite or so). Import everything from our base module ! basemodule = self.basepackage._code_to_module[code] ! else: ! # We are not an extension. ! basemodule = None ! self.enumsneeded = {} for event in events: ! self.findenumsinevent(event) ! objc = ObjectCompiler(None, basemodule, interact=(self.edit_modnames is None), ! verbose=self.verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! for enum in self.enumsneeded.keys(): ! objc.checkforenum(enum) ! ! objc.dumpindex() ! ! precompinfo = objc.getprecompinfo(self.modname) ! ! return code, self.modname, precompinfo ! def compilesuite(self, major, minor, language, script, fname, precompinfo): ! """Generate code for a single suite""" ! [name, desc, code, level, version, events, classes, comps, enums] = self.suite ! # Sort various lists, so re-generated source is easier compared ! def class_sorter(k1, k2): ! """Sort classes by code, and make sure main class sorts before synonyms""" ! # [name, code, desc, properties, elements] = cls ! if k1[1] < k2[1]: return -1 ! if k1[1] > k2[1]: return 1 ! if not k2[3] or k2[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return -1 ! if not k1[3] or k1[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return 1 ! return 0 ! ! events.sort() ! classes.sort(class_sorter) ! comps.sort() ! enums.sort() ! ! self.fp = fp = open(self.pathname, 'w') ! MacOS.SetCreatorAndType(self.pathname, 'Pyth', 'TEXT') ! ! fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) ! fp.write("Level %d, version %d\n\n" % (level, version)) ! fp.write("Generated from %s\n"%ascii(fname)) ! fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ ! (major, minor, language, script)) ! fp.write('"""\n\n') ! ! fp.write('import aetools\n') ! fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `code`) ! if self.basepackage and self.basepackage._code_to_module.has_key(code): ! # We are an extension of a baseclass (usually an application extending ! # Standard_Suite or so). Import everything from our base module ! fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0]) ! basemodule = self.basepackage._code_to_module[code] ! elif self.basepackage and self.basepackage._code_to_module.has_key(code.lower()): ! # This is needed by CodeWarrior and some others. ! fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0]) ! basemodule = self.basepackage._code_to_module[code.lower()] ! else: ! # We are not an extension. ! basemodule = None ! self.basemodule = basemodule ! self.compileclassheader() ! self.enumsneeded = {} ! if events: ! for event in events: ! self.compileevent(event) ! else: ! fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=(self.edit_modnames is None), ! verbose=self.verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! for enum in self.enumsneeded.keys(): ! objc.checkforenum(enum) ! ! objc.dumpindex() ! ! def compileclassheader(self): ! """Generate class boilerplate""" ! classname = '%s_Events'%self.modname ! if self.basemodule: ! modshortname = string.split(self.basemodule.__name__, '.')[-1] ! baseclassname = '%s_Events'%modshortname ! self.fp.write("class %s(%s):\n\n"%(classname, baseclassname)) else: ! self.fp.write("class %s:\n\n"%classname) ! ! def compileevent(self, event): ! """Generate code for a single event""" ! [name, desc, code, subcode, returns, accepts, arguments] = event ! fp = self.fp ! funcname = identify(name) ! # ! # generate name->keyword map ! # ! if arguments: ! fp.write("\t_argmap_%s = {\n"%funcname) ! for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `a[1]`)) ! fp.write("\t}\n\n") ! ! # ! # Generate function header ! # ! has_arg = (not is_null(accepts)) ! opt_arg = (has_arg and is_optional(accepts)) ! ! fp.write("\tdef %s(self, "%funcname) ! if has_arg: ! if not opt_arg: ! fp.write("_object, ") # Include direct object, if it has one ! else: ! fp.write("_object=None, ") # Also include if it is optional ! else: ! fp.write("_no_object=None, ") # For argument checking ! fp.write("_attributes={}, **_arguments):\n") # include attribute dict and args ! # ! # Generate doc string (important, since it may be the only ! # available documentation, due to our name-remaping) ! # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) ! if has_arg: ! fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) ! elif opt_arg: ! fp.write("\t\tOptional argument: %s\n"%getdatadoc(accepts)) ! for arg in arguments: ! fp.write("\t\tKeyword argument %s: %s\n"%(identify(arg[0]), ! getdatadoc(arg[2]))) ! fp.write("\t\tKeyword argument _attributes: AppleEvent attribute dictionary\n") ! if not is_null(returns): ! fp.write("\t\tReturns: %s\n"%getdatadoc(returns)) ! fp.write('\t\t"""\n') ! # ! # Fiddle the args so everything ends up in 'arguments' dictionary ! # ! fp.write("\t\t_code = %s\n"% `code`) ! fp.write("\t\t_subcode = %s\n\n"% `subcode`) ! # ! # Do keyword name substitution ! # ! if arguments: ! fp.write("\t\taetools.keysubst(_arguments, self._argmap_%s)\n"%funcname) ! else: ! fp.write("\t\tif _arguments: raise TypeError, 'No optional args expected'\n") ! # ! # Stuff required arg (if there is one) into arguments ! # ! if has_arg: ! fp.write("\t\t_arguments['----'] = _object\n") ! elif opt_arg: ! fp.write("\t\tif _object:\n") ! fp.write("\t\t\t_arguments['----'] = _object\n") ! else: ! fp.write("\t\tif _no_object != None: raise TypeError, 'No direct arg expected'\n") ! fp.write("\n") ! # ! # Do enum-name substitution ! # ! for a in arguments: ! if is_enum(a[2]): ! kname = a[1] ! ename = a[2][0] ! if ename <> '****': ! fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`kname`, identify(ename))) ! self.enumsneeded[ename] = 1 ! fp.write("\n") ! # ! # Do the transaction ! # ! fp.write("\t\t_reply, _arguments, _attributes = self.send(_code, _subcode,\n") ! fp.write("\t\t\t\t_arguments, _attributes)\n") ! # ! # Error handling ! # ! fp.write("\t\tif _arguments.get('errn', 0):\n") ! fp.write("\t\t\traise aetools.Error, aetools.decodeerror(_arguments)\n") ! fp.write("\t\t# XXXX Optionally decode result\n") ! # ! # Decode result ! # ! fp.write("\t\tif _arguments.has_key('----'):\n") ! if is_enum(returns): ! fp.write("\t\t\t# XXXX Should do enum remapping here...\n") ! fp.write("\t\t\treturn _arguments['----']\n") ! fp.write("\n") ! ! def findenumsinevent(self, event): ! """Find all enums for a single event""" ! [name, desc, code, subcode, returns, accepts, arguments] = event ! for a in arguments: ! if is_enum(a[2]): ! ename = a[2][0] ! if ename <> '****': ! self.enumsneeded[ename] = 1 # # This class stores the code<->name translations for a single module. It is used From fdrake@users.sourceforge.net Tue Apr 1 15:40:14 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 01 Apr 2003 07:40:14 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.93.6.9,2.93.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11239 Modified Files: Tag: release22-maint abstract.c Log Message: Remove trailing newline. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.93.6.9 retrieving revision 2.93.6.10 diff -C2 -d -r2.93.6.9 -r2.93.6.10 *** abstract.c 7 Dec 2002 10:15:38 -0000 2.93.6.9 --- abstract.c 1 Apr 2003 15:40:07 -0000 2.93.6.10 *************** *** 2097,2099 **** return result; } - --- 2097,2098 ---- From goodger@users.sourceforge.net Tue Apr 1 17:38:07 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 01 Apr 2003 09:38:07 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,NONE,1.1 pep-0000.txt,1.234,1.235 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv1712 Modified Files: pep-0000.txt Added Files: pep-0313.txt Log Message: added PEP 313, Adding Roman Numeral Literals to Python, by Mike Meyer --- NEW FILE: pep-0313.txt --- PEP: 313 Title: Adding Roman Numeral Literals to Python Version: $Revision $ Last-Modified: $Date $ Author: Mike Meyer Status: Draft Type: Standards Track Content-Type: text/plain Created: 01-Apr-2003 Python-Version: 2.4 Post-History: Abstract This PEP proposes adding Roman numerals as a literal type. It also proposes the new built-in function "roman", which converts an object to an integer, then converts the integer to a string that is the Roman numeral literal equivalent to the integer. Rationale Roman numerals are used in a number of areas, and adding them to Python as literals would make computations in those areas easier. For instance, Superbowls are counted with Roman numerals, and many older movies have copyright dates in Roman numerals. Further, LISP provides a Roman numerals literal package, so adding Roman numerals to Python will help ease the LISP-envy sometimes seen in comp.lang.python. Besides, the author thinks this is the easiest way to get his name on a PEP. Syntax for Roman literals Roman numeral literals will consist of the characters M, D, C, L, X, V and I, and only those characters. They must be in upper case, and represent an integer with the following rules: 1. Except as noted below, they must appear in the order M, D, C, L, X, V then I. Each occurence of each character adds 1000, 500, 100, 50, 10, 5 and 1 to the value of the literal, respectively. 2. Only one D, V or L may appear in any given literal. 3. At most three Is, Xs and Cs may appear in any given literal. 4. A single I may appear immediately to the left of the single V, followed by no Is, and adds 4 to the value of the literal. 5. A single I may likewise appear before the last X, followed by no Is or Vs, and adds 9 to the value. 6. X is to L and C as I is to V and X, except the values are 40 and 90, respectively. 7. C is to D and M as I is to V and X, except the values are 400 and 900, respectively. Any literal composed entirely of M, D, C, L, X, V and I characters that does not follow this format will raise a syntax error, because explicit is better than implicit. Builtin "roman" Function The new builtin function "roman" will aide the translation from integers to Roman numeral literals. It will accept a single object as an argument, and return a string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239 [1]) it will passed through the existing builtin "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal (see PEP 240 [2]) with the integers in the string being Roman numeral literals. Compatability Issues No new keywords are introduced by this proposal. Programs that use variable names that are all upper case and contain only the characters M, D, C, L, X, V and I will be affected by the new literals. These programs will now have syntax errors when those variables are assigned, and either syntax errors or subtle bugs when those variables are referenced in expressions. Since such variable names violate PEP 8 [3], the code is already broken, it just wasn't generating exceptions. This proposal corrects that oversight in the language. References [1] PEP 239, Adding a Rational Type to Python http://www.python.org/peps/pep-0239.html [2] PEP 240, Adding a Rational Literal to Python http://www.python.org/peps/pep-0240.html [3] PEP 8, Style Guide for Python Code http://www.python.org/peps/pep-0008.html Copyright This document has been placed in the public domain. ^L Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** pep-0000.txt 30 Mar 2003 14:46:54 -0000 1.234 --- pep-0000.txt 1 Apr 2003 17:37:46 -0000 1.235 *************** *** 115,118 **** --- 115,119 ---- S 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli + S 313 Adding Roman Numeral Literals to Python Meyer Finished PEPs (done, implemented in CVS) *************** *** 317,320 **** --- 318,322 ---- S 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli + S 313 Adding Roman Numeral Literals to Python Meyer SR 666 Reject Foolish Indentation Creighton *************** *** 376,379 **** --- 378,382 ---- McNamara, Andrew andrewm@object-craft.com.au Mick, Trent trentm@activestate.com + Meyer, Mike mwm@mired.org Montanaro, Skip skip@pobox.com Moore, Paul gustav@morpheus.demon.co.uk From goodger@users.sourceforge.net Tue Apr 1 17:41:36 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 01 Apr 2003 09:41:36 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv3500 Modified Files: pep-0313.txt Log Message: keyword fix Index: pep-0313.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0313.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0313.txt 1 Apr 2003 17:38:03 -0000 1.1 --- pep-0313.txt 1 Apr 2003 17:41:34 -0000 1.2 *************** *** 1,6 **** PEP: 313 Title: Adding Roman Numeral Literals to Python ! Version: $Revision $ ! Last-Modified: $Date $ Author: Mike Meyer Status: Draft --- 1,6 ---- PEP: 313 Title: Adding Roman Numeral Literals to Python ! Version: $Revision$ ! Last-Modified: $Date$ Author: Mike Meyer Status: Draft From jackjansen@users.sourceforge.net Tue Apr 1 22:02:05 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:02:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv19534 Modified Files: gensuitemodule.py Log Message: Properties (like enums) are not in the global namespace but only valid within a certain context. Give them an _Prop_ prefix, so they don't accidentally obscure an element from another suite (as happened with the Finder). Comparisons I'm not sure about, so I left them as global names. Also got rid of the lists if declarations, they serve no useful purpose. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gensuitemodule.py 1 Apr 2003 14:25:49 -0000 1.4 --- gensuitemodule.py 1 Apr 2003 22:01:58 -0000 1.5 *************** *** 974,981 **** return if self.fp: ! self.fp.write("\n%s = %s\n"%(pname, othername)) else: if self.fp: ! self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) self.fp.write("\twhich = %s\n" % `code`) --- 974,981 ---- return if self.fp: ! self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername)) else: if self.fp: ! self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) self.fp.write("\twhich = %s\n" % `code`) *************** *** 1042,1046 **** self.fp.write("%s._privpropdict = {\n"%cname) for n in plist: ! self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._privelemdict = {\n"%cname) --- 1042,1046 ---- self.fp.write("%s._privpropdict = {\n"%cname) for n in plist: ! self.fp.write("\t'%s' : _Prop_%s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._privelemdict = {\n"%cname) *************** *** 1095,1118 **** self.fp.write("}\n") ! self.fp.write("\n_propdeclarations = {\n") ! proplist = self.namemappers[0].getall('property') ! proplist.sort() ! for k, v in proplist: ! self.fp.write("\t%s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") ! ! self.fp.write("\n_compdeclarations = {\n") ! complist = self.namemappers[0].getall('comparison') ! complist.sort() ! for k, v in complist: ! self.fp.write("\t%s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") ! ! self.fp.write("\n_enumdeclarations = {\n") ! enumlist = self.namemappers[0].getall('enum') ! enumlist.sort() ! for k, v in enumlist: ! self.fp.write("\t%s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") def compiledata(data): --- 1095,1118 ---- self.fp.write("}\n") ! ## self.fp.write("\n_propdeclarations = {\n") ! ## proplist = self.namemappers[0].getall('property') ! ## proplist.sort() ! ## for k, v in proplist: ! ## self.fp.write("\t%s : _Prop_%s,\n" % (`k`, v)) ! ## self.fp.write("}\n") ! ## ! ## self.fp.write("\n_compdeclarations = {\n") ! ## complist = self.namemappers[0].getall('comparison') ! ## complist.sort() ! ## for k, v in complist: ! ## self.fp.write("\t%s : %s,\n" % (`k`, v)) ! ## self.fp.write("}\n") ! ## ! ## self.fp.write("\n_enumdeclarations = {\n") ! ## enumlist = self.namemappers[0].getall('enum') ! ## enumlist.sort() ! ## for k, v in enumlist: ! ## self.fp.write("\t%s : %s,\n" % (`k`, v)) ! ## self.fp.write("}\n") def compiledata(data): From jackjansen@users.sourceforge.net Tue Apr 1 22:05:28 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.4,1.5 PowerPlant.py,1.3,1.4 Required_suite.py,1.2,1.3 Standard_Suite.py,1.3,1.4 Standard_URL_suite.py,1.2,1.3 Text.py,1.5,1.6 WorldWideWeb_suite.py,1.3,1.4 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Mozilla_suite.py 28 Mar 2003 23:37:57 -0000 1.4 --- Mozilla_suite.py 1 Apr 2003 22:04:44 -0000 1.5 *************** *** 256,269 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'comp' : _Enum_comp, - 'dire' : _Enum_dire, - 'ncmd' : _Enum_ncmd, - } --- 256,257 ---- Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PowerPlant.py 28 Mar 2003 22:07:18 -0000 1.3 --- PowerPlant.py 1 Apr 2003 22:04:45 -0000 1.4 *************** *** 75,86 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'dbac' : _Enum_dbac, - } --- 75,76 ---- Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Required_suite.py 1 Apr 2003 22:04:45 -0000 1.3 *************** *** 98,108 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 98,99 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 28 Mar 2003 23:37:57 -0000 1.3 --- Standard_Suite.py 1 Apr 2003 22:04:45 -0000 1.4 *************** *** 105,113 **** """application - An application program """ want = 'capp' ! class alert_application(aetools.NProperty): """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ which = 'ALAP' want = 'type' ! class kiosk_mode(aetools.NProperty): """kiosk mode - Kiosk mode leaves very few menus enabled """ which = 'KOSK' --- 105,113 ---- """application - An application program """ want = 'capp' ! class _Prop_alert_application(aetools.NProperty): """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ which = 'ALAP' want = 'type' ! class _Prop_kiosk_mode(aetools.NProperty): """kiosk mode - Kiosk mode leaves very few menus enabled """ which = 'KOSK' *************** *** 118,178 **** """window - A Window """ want = 'cwin' ! class URL(aetools.NProperty): """URL - Current URL """ which = 'curl' want = 'TEXT' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class busy(aetools.NProperty): """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ which = 'busy' want = 'long' ! class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class unique_ID(aetools.NProperty): """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' ! class visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' --- 118,178 ---- """window - A Window """ want = 'cwin' ! class _Prop_URL(aetools.NProperty): """URL - Current URL """ which = 'curl' want = 'TEXT' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_busy(aetools.NProperty): """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ which = 'busy' want = 'long' ! class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class _Prop_floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class _Prop_index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class _Prop_position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class _Prop_unique_ID(aetools.NProperty): """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' ! class _Prop_visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' *************** *** 180,185 **** application._superclassnames = [] application._privpropdict = { ! 'alert_application' : alert_application, ! 'kiosk_mode' : kiosk_mode, } application._privelemdict = { --- 180,185 ---- application._superclassnames = [] application._privpropdict = { ! 'alert_application' : _Prop_alert_application, ! 'kiosk_mode' : _Prop_kiosk_mode, } application._privelemdict = { *************** *** 188,206 **** window._superclassnames = [] window._privpropdict = { ! 'URL' : URL, ! 'bounds' : bounds, ! 'busy' : busy, ! 'closeable' : closeable, ! 'floating' : floating, ! 'index' : index, ! 'modal' : modal, ! 'name' : name, ! 'position' : position, ! 'resizable' : resizable, ! 'titled' : titled, ! 'unique_ID' : unique_ID, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 188,206 ---- window._superclassnames = [] window._privpropdict = { ! 'URL' : _Prop_URL, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'closeable' : _Prop_closeable, ! 'floating' : _Prop_floating, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'unique_ID' : _Prop_unique_ID, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 213,241 **** 'capp' : application, 'cwin' : window, - } - - _propdeclarations = { - 'ALAP' : alert_application, - 'KOSK' : kiosk_mode, - 'busy' : busy, - 'curl' : URL, - 'hclb' : closeable, - 'isfl' : floating, - 'iszm' : zoomable, - 'pbnd' : bounds, - 'pidx' : index, - 'pmod' : modal, - 'pnam' : name, - 'ppos' : position, - 'prsz' : resizable, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'wiid' : unique_ID, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 213,215 ---- Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_URL_suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Standard_URL_suite.py 1 Apr 2003 22:04:45 -0000 1.3 *************** *** 48,58 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 48,49 ---- Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Text.py 30 Mar 2003 22:41:48 -0000 1.5 --- Text.py 1 Apr 2003 22:04:46 -0000 1.6 *************** *** 20,40 **** """text - independent text view objects """ want = 'ctxt' ! class beginning(aetools.NProperty): """beginning - Beginning of element """ which = 'bgng' want = 'obj ' ! class end(aetools.NProperty): """end - Ending of element """ which = 'end ' want = 'obj ' ! class infront(aetools.NProperty): """infront - Immediately before element """ which = 'pBef' want = 'obj ' ! class justbehind(aetools.NProperty): """justbehind - Immediately after element """ which = 'pAft' want = 'obj ' ! class updateLevel(aetools.NProperty): """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ which = 'pUpL' --- 20,40 ---- """text - independent text view objects """ want = 'ctxt' ! class _Prop_beginning(aetools.NProperty): """beginning - Beginning of element """ which = 'bgng' want = 'obj ' ! class _Prop_end(aetools.NProperty): """end - Ending of element """ which = 'end ' want = 'obj ' ! class _Prop_infront(aetools.NProperty): """infront - Immediately before element """ which = 'pBef' want = 'obj ' ! class _Prop_justbehind(aetools.NProperty): """justbehind - Immediately after element """ which = 'pAft' want = 'obj ' ! class _Prop_updateLevel(aetools.NProperty): """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ which = 'pUpL' *************** *** 45,69 **** """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ want = 'stys' ! class color(aetools.NProperty): """color - the color """ which = 'colr' want = 'RGB ' ! class font(aetools.NProperty): """font - font name """ which = 'font' want = 'TEXT' ! class name(aetools.NProperty): """name - style name """ which = 'pnam' want = 'TEXT' ! class size(aetools.NProperty): """size - the size in points """ which = 'ptsz' want = 'long' ! class style(aetools.NProperty): """style - the text styles or face attributes """ which = 'txst' want = 'tsty' ! class writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' --- 45,69 ---- """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ want = 'stys' ! class _Prop_color(aetools.NProperty): """color - the color """ which = 'colr' want = 'RGB ' ! class _Prop_font(aetools.NProperty): """font - font name """ which = 'font' want = 'TEXT' ! class _Prop_name(aetools.NProperty): """name - style name """ which = 'pnam' want = 'TEXT' ! class _Prop_size(aetools.NProperty): """size - the size in points """ which = 'ptsz' want = 'long' ! class _Prop_style(aetools.NProperty): """style - the text styles or face attributes """ which = 'txst' want = 'tsty' ! class _Prop_writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' *************** *** 73,81 **** text._superclassnames = [] text._privpropdict = { ! 'beginning' : beginning, ! 'end' : end, ! 'infront' : infront, ! 'justbehind' : justbehind, ! 'updateLevel' : updateLevel, } text._privelemdict = { --- 73,81 ---- text._superclassnames = [] text._privpropdict = { ! 'beginning' : _Prop_beginning, ! 'end' : _Prop_end, ! 'infront' : _Prop_infront, ! 'justbehind' : _Prop_justbehind, ! 'updateLevel' : _Prop_updateLevel, } text._privelemdict = { *************** *** 84,93 **** styleset._superclassnames = [] styleset._privpropdict = { ! 'color' : color, ! 'font' : font, ! 'name' : name, ! 'size' : size, ! 'style' : style, ! 'writing_code' : writing_code, } styleset._privelemdict = { --- 84,93 ---- styleset._superclassnames = [] styleset._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'name' : _Prop_name, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'writing_code' : _Prop_writing_code, } styleset._privelemdict = { *************** *** 100,122 **** 'ctxt' : text, 'stys' : styleset, - } - - _propdeclarations = { - 'bgng' : beginning, - 'colr' : color, - 'end ' : end, - 'font' : font, - 'pAft' : justbehind, - 'pBef' : infront, - 'pUpL' : updateLevel, - 'pnam' : name, - 'psct' : writing_code, - 'ptsz' : size, - 'txst' : style, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 100,102 ---- Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WorldWideWeb_suite.py 28 Mar 2003 22:07:20 -0000 1.3 --- WorldWideWeb_suite.py 1 Apr 2003 22:04:47 -0000 1.4 *************** *** 416,426 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 416,417 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 30 Mar 2003 22:41:49 -0000 1.5 --- __init__.py 1 Apr 2003 22:04:48 -0000 1.6 *************** *** 62,67 **** getbaseclasses(window) getbaseclasses(application) - getbaseclasses(text) - getbaseclasses(styleset) getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.character) --- 62,65 ---- *************** *** 71,74 **** --- 69,74 ---- getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.text) + getbaseclasses(text) + getbaseclasses(styleset) # *************** *** 78,83 **** 'cwin' : window, 'capp' : application, - 'ctxt' : text, - 'stys' : styleset, 'cflo' : StdSuites.Text_Suite.text_flow, 'cha ' : StdSuites.Text_Suite.character, --- 78,81 ---- *************** *** 87,90 **** --- 85,90 ---- 'cpar' : StdSuites.Text_Suite.paragraph, 'ctxt' : StdSuites.Text_Suite.text, + 'ctxt' : text, + 'stys' : styleset, } From jackjansen@users.sourceforge.net Tue Apr 1 22:05:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:24 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Containers_and_folders.py,1.6,1.7 Enumerations.py,1.5,1.6 Files.py,1.1,1.2 Finder_Basics.py,1.4,1.5 Finder_items.py,1.4,1.5 Legacy_suite.py,1.1,1.2 Standard_Suite.py,1.4,1.5 Type_Definitions.py,1.6,1.7 Window_classes.py,1.6,1.7 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Finder Modified Files: Containers_and_folders.py Enumerations.py Files.py Finder_Basics.py Finder_items.py Legacy_suite.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Containers_and_folders.py 30 Mar 2003 22:41:48 -0000 1.6 --- Containers_and_folders.py 1 Apr 2003 22:04:35 -0000 1.7 *************** *** 19,51 **** """disk - A disk """ want = 'cdis' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the container class """ which = 'c@#^' want = 'ctnr' ! class capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'comp' ! class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class format(aetools.NProperty): """format - the filesystem format of this disk """ which = 'dfmt' want = 'edfm' ! class free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'comp' ! class ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' --- 19,51 ---- """disk - A disk """ want = 'cdis' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the container class """ which = 'c@#^' want = 'ctnr' ! class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'comp' ! class _Prop_ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class _Prop_format(aetools.NProperty): """format - the filesystem format of this disk """ which = 'dfmt' want = 'edfm' ! class _Prop_free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'comp' ! class _Prop_ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class _Prop_local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' *************** *** 98,118 **** """container - An item that contains other items """ want = 'ctnr' ! class completely_expanded(aetools.NProperty): """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ which = 'pexc' want = 'bool' ! class container_window(aetools.NProperty): """container window - the container window for this folder """ which = 'cwnd' want = 'obj ' ! class entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ which = 'ects' want = 'obj ' ! class expandable(aetools.NProperty): """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ which = 'pexa' want = 'bool' ! class expanded(aetools.NProperty): """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ which = 'pexp' --- 98,118 ---- """container - An item that contains other items """ want = 'ctnr' ! class _Prop_completely_expanded(aetools.NProperty): """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ which = 'pexc' want = 'bool' ! class _Prop_container_window(aetools.NProperty): """container window - the container window for this folder """ which = 'cwnd' want = 'obj ' ! class _Prop_entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ which = 'ects' want = 'obj ' ! class _Prop_expandable(aetools.NProperty): """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ which = 'pexa' want = 'bool' ! class _Prop_expanded(aetools.NProperty): """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ which = 'pexp' *************** *** 134,138 **** """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ want = 'ctrs' ! class warns_before_emptying(aetools.NProperty): """warns before emptying - Display a dialog when emptying the trash? """ which = 'warn' --- 134,138 ---- """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ want = 'ctrs' ! class _Prop_warns_before_emptying(aetools.NProperty): """warns before emptying - Display a dialog when emptying the trash? """ which = 'warn' *************** *** 152,163 **** import Finder_items disk._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'capacity' : capacity, ! 'ejectable' : ejectable, ! 'format' : format, ! 'free_space' : free_space, ! 'ignore_privileges' : ignore_privileges, ! 'local_volume' : local_volume, ! 'startup' : startup, } disk._privelemdict = { --- 152,163 ---- import Finder_items disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'startup' : _Prop_startup, } disk._privelemdict = { *************** *** 175,179 **** desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { --- 175,179 ---- desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { *************** *** 192,196 **** folder._superclassnames = ['container'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } folder._privelemdict = { --- 192,196 ---- folder._superclassnames = ['container'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } folder._privelemdict = { *************** *** 208,217 **** container._superclassnames = ['item'] container._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'completely_expanded' : completely_expanded, ! 'container_window' : container_window, ! 'entire_contents' : entire_contents, ! 'expandable' : expandable, ! 'expanded' : expanded, } container._privelemdict = { --- 208,217 ---- container._superclassnames = ['item'] container._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'completely_expanded' : _Prop_completely_expanded, ! 'container_window' : _Prop_container_window, ! 'entire_contents' : _Prop_entire_contents, ! 'expandable' : _Prop_expandable, ! 'expanded' : _Prop_expanded, } container._privelemdict = { *************** *** 229,234 **** trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'warns_before_emptying' : warns_before_emptying, } trash_2d_object._privelemdict = { --- 229,234 ---- trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'warns_before_emptying' : _Prop_warns_before_emptying, } trash_2d_object._privelemdict = { *************** *** 254,279 **** 'ctnr' : container, 'ctrs' : trash_2d_object, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'capa' : capacity, - 'cwnd' : container_window, - 'dfmt' : format, - 'ects' : entire_contents, - 'frsp' : free_space, - 'igpr' : ignore_privileges, - 'isej' : ejectable, - 'isrv' : local_volume, - 'istd' : startup, - 'pexa' : expandable, - 'pexc' : completely_expanded, - 'pexp' : expanded, - 'warn' : warns_before_emptying, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 254,256 ---- Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Enumerations.py 29 Mar 2003 00:13:13 -0000 1.5 --- Enumerations.py 1 Apr 2003 22:04:36 -0000 1.6 *************** *** 125,145 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'earr' : _Enum_earr, - 'ecvw' : _Enum_ecvw, - 'edfm' : _Enum_edfm, - 'elsv' : _Enum_elsv, - 'ipnl' : _Enum_ipnl, - 'isiz' : _Enum_isiz, - 'lvic' : _Enum_lvic, - 'priv' : _Enum_priv, - 'sodr' : _Enum_sodr, - 'vwby' : _Enum_vwby, - } --- 125,126 ---- Index: Files.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Files.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Files.py 29 Mar 2003 00:13:14 -0000 1.1 --- Files.py 1 Apr 2003 22:04:37 -0000 1.2 *************** *** 19,27 **** """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the file class """ which = 'c@#^' want = 'file' ! class original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ which = 'orig' --- 19,27 ---- """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the file class """ which = 'c@#^' want = 'file' ! class _Prop_original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ which = 'orig' *************** *** 33,57 **** """application file - An application's file on disk """ want = 'appf' ! class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ which = 'isab' want = 'bool' ! class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class minimum_size(aetools.NProperty): """minimum size - the smallest memory size with which the application can be launched """ which = 'mprt' want = 'long' ! class opens_in_Classic(aetools.NProperty): """opens in Classic - Should the application launch in the Classic environment? """ which = 'Clsc' want = 'bool' ! class preferred_size(aetools.NProperty): """preferred size - the memory size with which the application will be launched """ which = 'appt' want = 'long' ! class suggested_size(aetools.NProperty): """suggested size - the memory size with which the developer recommends the application be launched """ which = 'sprt' --- 33,57 ---- """application file - An application's file on disk """ want = 'appf' ! class _Prop_accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ which = 'isab' want = 'bool' ! class _Prop_has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class _Prop_minimum_size(aetools.NProperty): """minimum size - the smallest memory size with which the application can be launched """ which = 'mprt' want = 'long' ! class _Prop_opens_in_Classic(aetools.NProperty): """opens in Classic - Should the application launch in the Classic environment? """ which = 'Clsc' want = 'bool' ! class _Prop_preferred_size(aetools.NProperty): """preferred size - the memory size with which the application will be launched """ which = 'appt' want = 'long' ! class _Prop_suggested_size(aetools.NProperty): """suggested size - the memory size with which the developer recommends the application be launched """ which = 'sprt' *************** *** 63,67 **** """clipping - A clipping """ want = 'clpf' ! class clipping_window(aetools.NProperty): """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ which = 'lwnd' --- 63,67 ---- """clipping - A clipping """ want = 'clpf' ! class _Prop_clipping_window(aetools.NProperty): """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ which = 'lwnd' *************** *** 79,99 **** """file - A file """ want = 'file' ! class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' ! class file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the item """ which = 'asty' want = 'type' ! class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'utxt' ! class stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' ! class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' --- 79,99 ---- """file - A file """ want = 'file' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the item """ which = 'asty' want = 'type' ! class _Prop_product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'utxt' ! class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' ! class _Prop_version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' *************** *** 105,109 **** """internet location file - An file containing an internet location """ want = 'inlf' ! class location(aetools.NProperty): """location - the internet location """ which = 'iloc' --- 105,109 ---- """internet location file - An file containing an internet location """ want = 'inlf' ! class _Prop_location(aetools.NProperty): """location - the internet location """ which = 'iloc' *************** *** 119,124 **** alias_file._superclassnames = ['file'] alias_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'original_item' : original_item, } alias_file._privelemdict = { --- 119,124 ---- alias_file._superclassnames = ['file'] alias_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'original_item' : _Prop_original_item, } alias_file._privelemdict = { *************** *** 126,136 **** application_file._superclassnames = ['file'] application_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'accepts_high_level_events' : accepts_high_level_events, ! 'has_scripting_terminology' : has_scripting_terminology, ! 'minimum_size' : minimum_size, ! 'opens_in_Classic' : opens_in_Classic, ! 'preferred_size' : preferred_size, ! 'suggested_size' : suggested_size, } application_file._privelemdict = { --- 126,136 ---- application_file._superclassnames = ['file'] application_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'minimum_size' : _Prop_minimum_size, ! 'opens_in_Classic' : _Prop_opens_in_Classic, ! 'preferred_size' : _Prop_preferred_size, ! 'suggested_size' : _Prop_suggested_size, } application_file._privelemdict = { *************** *** 138,143 **** clipping._superclassnames = ['file'] clipping._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'clipping_window' : clipping_window, } clipping._privelemdict = { --- 138,143 ---- clipping._superclassnames = ['file'] clipping._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'clipping_window' : _Prop_clipping_window, } clipping._privelemdict = { *************** *** 145,149 **** document_file._superclassnames = ['file'] document_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } document_file._privelemdict = { --- 145,149 ---- document_file._superclassnames = ['file'] document_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } document_file._privelemdict = { *************** *** 152,161 **** file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'creator_type' : creator_type, ! 'file_type' : file_type, ! 'product_version' : product_version, ! 'stationery' : stationery, ! 'version' : version, } file._privelemdict = { --- 152,161 ---- file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'product_version' : _Prop_product_version, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { *************** *** 163,168 **** internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'location' : location, } internet_location_file._privelemdict = { --- 163,168 ---- internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'location' : _Prop_location, } internet_location_file._privelemdict = { *************** *** 170,174 **** package._superclassnames = ['item'] package._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } package._privelemdict = { --- 170,174 ---- package._superclassnames = ['item'] package._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } package._privelemdict = { *************** *** 186,212 **** 'inlf' : internet_location_file, 'pack' : package, - } - - _propdeclarations = { - 'Clsc' : opens_in_Classic, - 'appt' : preferred_size, - 'asty' : file_type, - 'c@#^' : _3c_Inheritance_3e_, - 'fcrt' : creator_type, - 'hscr' : has_scripting_terminology, - 'iloc' : location, - 'isab' : accepts_high_level_events, - 'lwnd' : clipping_window, - 'mprt' : minimum_size, - 'orig' : original_item, - 'pspd' : stationery, - 'sprt' : suggested_size, - 'ver2' : product_version, - 'vers' : version, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 186,188 ---- Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Finder_Basics.py 29 Mar 2003 00:13:14 -0000 1.4 --- Finder_Basics.py 1 Apr 2003 22:04:38 -0000 1.5 *************** *** 62,114 **** """application - The Finder """ want = 'capp' ! class Finder_preferences(aetools.NProperty): """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ which = 'pfrp' want = 'cprf' ! class clipboard(aetools.NProperty): """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' ! class desktop(aetools.NProperty): """desktop - the desktop """ which = 'desk' want = 'cdsk' ! class frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' ! class home(aetools.NProperty): """home - the home directory """ which = 'home' want = 'cfol' ! class insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' ! class name(aetools.NProperty): """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' ! class product_version(aetools.NProperty): """product version - the version of the System software running on this computer """ which = 'ver2' want = 'utxt' ! class selection(aetools.NProperty): """selection - the selection in the frontmost Finder window """ which = 'sele' want = 'obj ' ! class startup_disk(aetools.NProperty): """startup disk - the startup disk """ which = 'sdsk' want = 'cdis' ! class trash(aetools.NProperty): """trash - the trash """ which = 'trsh' want = 'ctrs' ! class version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'utxt' ! class visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' --- 62,114 ---- """application - The Finder """ want = 'capp' ! class _Prop_Finder_preferences(aetools.NProperty): """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ which = 'pfrp' want = 'cprf' ! class _Prop_clipboard(aetools.NProperty): """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' ! class _Prop_desktop(aetools.NProperty): """desktop - the desktop """ which = 'desk' want = 'cdsk' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' ! class _Prop_home(aetools.NProperty): """home - the home directory """ which = 'home' want = 'cfol' ! class _Prop_insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' ! class _Prop_name(aetools.NProperty): """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' ! class _Prop_product_version(aetools.NProperty): """product version - the version of the System software running on this computer """ which = 'ver2' want = 'utxt' ! class _Prop_selection(aetools.NProperty): """selection - the selection in the frontmost Finder window """ which = 'sele' want = 'obj ' ! class _Prop_startup_disk(aetools.NProperty): """startup disk - the startup disk """ which = 'sdsk' want = 'cdis' ! class _Prop_trash(aetools.NProperty): """trash - the trash """ which = 'trsh' want = 'ctrs' ! class _Prop_version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'utxt' ! class _Prop_visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' *************** *** 134,150 **** import Finder_items application._privpropdict = { ! 'Finder_preferences' : Finder_preferences, ! 'clipboard' : clipboard, ! 'desktop' : desktop, ! 'frontmost' : frontmost, ! 'home' : home, ! 'insertion_location' : insertion_location, ! 'name' : name, ! 'product_version' : product_version, ! 'selection' : selection, ! 'startup_disk' : startup_disk, ! 'trash' : trash, ! 'version' : version, ! 'visible' : visible, } application._privelemdict = { --- 134,150 ---- import Finder_items application._privpropdict = { ! 'Finder_preferences' : _Prop_Finder_preferences, ! 'clipboard' : _Prop_clipboard, ! 'desktop' : _Prop_desktop, ! 'frontmost' : _Prop_frontmost, ! 'home' : _Prop_home, ! 'insertion_location' : _Prop_insertion_location, ! 'name' : _Prop_name, ! 'product_version' : _Prop_product_version, ! 'selection' : _Prop_selection, ! 'startup_disk' : _Prop_startup_disk, ! 'trash' : _Prop_trash, ! 'version' : _Prop_version, ! 'visible' : _Prop_visible, } application._privelemdict = { *************** *** 170,194 **** _classdeclarations = { 'capp' : application, - } - - _propdeclarations = { - 'desk' : desktop, - 'home' : home, - 'pcli' : clipboard, - 'pfrp' : Finder_preferences, - 'pins' : insertion_location, - 'pisf' : frontmost, - 'pnam' : name, - 'pvis' : visible, - 'sdsk' : startup_disk, - 'sele' : selection, - 'trsh' : trash, - 'ver2' : product_version, - 'vers' : version, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 170,172 ---- Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Finder_items.py 29 Mar 2003 00:13:14 -0000 1.4 --- Finder_items.py 1 Apr 2003 22:04:39 -0000 1.5 *************** *** 169,277 **** """item - An item """ want = 'cobj' ! class bounds(aetools.NProperty): """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ which = 'pbnd' want = 'qdrt' ! class comment(aetools.NProperty): """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' want = 'utxt' ! class container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' ! class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = 'ldt ' ! class description(aetools.NProperty): """description - a description of the item """ which = 'dscr' want = 'utxt' ! class disk(aetools.NProperty): """disk - the disk on which the item is stored """ which = 'cdis' want = 'obj ' ! class displayed_name(aetools.NProperty): """displayed name - the user-visible name of the item """ which = 'dnam' want = 'utxt' ! class everyones_privileges(aetools.NProperty): """everyones privileges - """ which = 'gstp' want = 'priv' ! class extension_hidden(aetools.NProperty): """extension hidden - Is the item's extension hidden from the user? """ which = 'hidx' want = 'bool' ! class group(aetools.NProperty): """group - the user or group that has special access to the container """ which = 'sgrp' want = 'utxt' ! class group_privileges(aetools.NProperty): """group privileges - """ which = 'gppr' want = 'priv' ! class icon(aetools.NProperty): """icon - the icon bitmap of the item """ which = 'iimg' want = 'ifam' ! class index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class information_window(aetools.NProperty): """information window - the information window for the item """ which = 'iwnd' want = 'obj ' ! class kind(aetools.NProperty): """kind - the kind of the item """ which = 'kind' want = 'utxt' ! class label_index(aetools.NProperty): """label index - the label of the item """ which = 'labi' want = 'long' ! class locked(aetools.NProperty): """locked - Is the file locked? """ which = 'aslk' want = 'bool' ! class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class name_extension(aetools.NProperty): """name extension - the name extension of the item (such as \xd2txt\xd3) """ which = 'nmxt' want = 'utxt' ! class owner(aetools.NProperty): """owner - the user that owns the container """ which = 'sown' want = 'utxt' ! class owner_privileges(aetools.NProperty): """owner privileges - """ which = 'ownr' want = 'priv' ! class physical_size(aetools.NProperty): """physical size - the actual space used by the item on disk """ which = 'phys' want = 'comp' ! class position(aetools.NProperty): """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ which = 'posn' want = 'QDpt' ! class properties(aetools.NProperty): """properties - every property of an item """ which = 'pALL' want = 'reco' ! class size(aetools.NProperty): """size - the logical size of the item """ which = 'ptsz' want = 'comp' ! class url(aetools.NProperty): """url - the url of the item """ which = 'pURL' --- 169,277 ---- """item - An item """ want = 'cobj' ! class _Prop_bounds(aetools.NProperty): """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ which = 'pbnd' want = 'qdrt' ! class _Prop_comment(aetools.NProperty): """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' want = 'utxt' ! class _Prop_container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' ! class _Prop_creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = 'ldt ' ! class _Prop_description(aetools.NProperty): """description - a description of the item """ which = 'dscr' want = 'utxt' ! class _Prop_disk(aetools.NProperty): """disk - the disk on which the item is stored """ which = 'cdis' want = 'obj ' ! class _Prop_displayed_name(aetools.NProperty): """displayed name - the user-visible name of the item """ which = 'dnam' want = 'utxt' ! class _Prop_everyones_privileges(aetools.NProperty): """everyones privileges - """ which = 'gstp' want = 'priv' ! class _Prop_extension_hidden(aetools.NProperty): """extension hidden - Is the item's extension hidden from the user? """ which = 'hidx' want = 'bool' ! class _Prop_group(aetools.NProperty): """group - the user or group that has special access to the container """ which = 'sgrp' want = 'utxt' ! class _Prop_group_privileges(aetools.NProperty): """group privileges - """ which = 'gppr' want = 'priv' ! class _Prop_icon(aetools.NProperty): """icon - the icon bitmap of the item """ which = 'iimg' want = 'ifam' ! class _Prop_index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class _Prop_information_window(aetools.NProperty): """information window - the information window for the item """ which = 'iwnd' want = 'obj ' ! class _Prop_kind(aetools.NProperty): """kind - the kind of the item """ which = 'kind' want = 'utxt' ! class _Prop_label_index(aetools.NProperty): """label index - the label of the item """ which = 'labi' want = 'long' ! class _Prop_locked(aetools.NProperty): """locked - Is the file locked? """ which = 'aslk' want = 'bool' ! class _Prop_modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class _Prop_name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class _Prop_name_extension(aetools.NProperty): """name extension - the name extension of the item (such as \xd2txt\xd3) """ which = 'nmxt' want = 'utxt' ! class _Prop_owner(aetools.NProperty): """owner - the user that owns the container """ which = 'sown' want = 'utxt' ! class _Prop_owner_privileges(aetools.NProperty): """owner privileges - """ which = 'ownr' want = 'priv' ! class _Prop_physical_size(aetools.NProperty): """physical size - the actual space used by the item on disk """ which = 'phys' want = 'comp' ! class _Prop_position(aetools.NProperty): """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ which = 'posn' want = 'QDpt' ! class _Prop_properties(aetools.NProperty): """properties - every property of an item """ which = 'pALL' want = 'reco' ! class _Prop_size(aetools.NProperty): """size - the logical size of the item """ which = 'ptsz' want = 'comp' ! class _Prop_url(aetools.NProperty): """url - the url of the item """ which = 'pURL' *************** *** 281,311 **** item._superclassnames = [] item._privpropdict = { ! 'bounds' : bounds, ! 'comment' : comment, ! 'container' : container, ! 'creation_date' : creation_date, ! 'description' : description, ! 'disk' : disk, ! 'displayed_name' : displayed_name, ! 'everyones_privileges' : everyones_privileges, ! 'extension_hidden' : extension_hidden, ! 'group' : group, ! 'group_privileges' : group_privileges, ! 'icon' : icon, ! 'index' : index, ! 'information_window' : information_window, ! 'kind' : kind, ! 'label_index' : label_index, ! 'locked' : locked, ! 'modification_date' : modification_date, ! 'name' : name, ! 'name_extension' : name_extension, ! 'owner' : owner, ! 'owner_privileges' : owner_privileges, ! 'physical_size' : physical_size, ! 'position' : position, ! 'properties' : properties, ! 'size' : size, ! 'url' : url, } item._privelemdict = { --- 281,311 ---- item._superclassnames = [] item._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'comment' : _Prop_comment, ! 'container' : _Prop_container, ! 'creation_date' : _Prop_creation_date, ! 'description' : _Prop_description, ! 'disk' : _Prop_disk, ! 'displayed_name' : _Prop_displayed_name, ! 'everyones_privileges' : _Prop_everyones_privileges, ! 'extension_hidden' : _Prop_extension_hidden, ! 'group' : _Prop_group, ! 'group_privileges' : _Prop_group_privileges, ! 'icon' : _Prop_icon, ! 'index' : _Prop_index, ! 'information_window' : _Prop_information_window, ! 'kind' : _Prop_kind, ! 'label_index' : _Prop_label_index, ! 'locked' : _Prop_locked, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'owner' : _Prop_owner, ! 'owner_privileges' : _Prop_owner_privileges, ! 'physical_size' : _Prop_physical_size, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'url' : _Prop_url, } item._privelemdict = { *************** *** 317,355 **** _classdeclarations = { 'cobj' : item, - } - - _propdeclarations = { - 'ascd' : creation_date, - 'aslk' : locked, - 'asmo' : modification_date, - 'cdis' : disk, - 'comt' : comment, - 'ctnr' : container, - 'dnam' : displayed_name, - 'dscr' : description, - 'gppr' : group_privileges, - 'gstp' : everyones_privileges, - 'hidx' : extension_hidden, - 'iimg' : icon, - 'iwnd' : information_window, - 'kind' : kind, - 'labi' : label_index, - 'nmxt' : name_extension, - 'ownr' : owner_privileges, - 'pALL' : properties, - 'pURL' : url, - 'pbnd' : bounds, - 'phys' : physical_size, - 'pidx' : index, - 'pnam' : name, - 'posn' : position, - 'ptsz' : size, - 'sgrp' : group, - 'sown' : owner, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 317,319 ---- Index: Legacy_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Legacy_suite.py 29 Mar 2003 00:13:14 -0000 1.1 --- Legacy_suite.py 1 Apr 2003 22:04:40 -0000 1.2 *************** *** 74,78 **** """application - The Finder """ want = 'capp' ! class desktop_picture(aetools.NProperty): """desktop picture - the desktop picture of the main monitor """ which = 'dpic' --- 74,78 ---- """application - The Finder """ want = 'capp' ! class _Prop_desktop_picture(aetools.NProperty): """desktop picture - the desktop picture of the main monitor """ which = 'dpic' *************** *** 82,90 **** """application process - A process launched from an application file """ want = 'pcap' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the process class """ which = 'c@#^' want = 'prcs' ! class application_file(aetools.NProperty): """application file - the application file from which this process was launched """ which = 'appf' --- 82,90 ---- """application process - A process launched from an application file """ want = 'pcap' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the process class """ which = 'c@#^' want = 'prcs' ! class _Prop_application_file(aetools.NProperty): """application file - the application file from which this process was launched """ which = 'appf' *************** *** 96,100 **** """desk accessory process - A process launched from a desk accessory file """ want = 'pcda' ! class desk_accessory_file(aetools.NProperty): """desk accessory file - the desk accessory file from which this process was launched """ which = 'dafi' --- 96,100 ---- """desk accessory process - A process launched from a desk accessory file """ want = 'pcda' ! class _Prop_desk_accessory_file(aetools.NProperty): """desk accessory file - the desk accessory file from which this process was launched """ which = 'dafi' *************** *** 106,150 **** """process - A process running on this computer """ want = 'prcs' ! class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'type' ! class file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = 'obj ' ! class file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'type' ! class frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process? """ which = 'pisf' want = 'bool' ! class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'itxt' ! class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' ! class total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'long' ! class visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' --- 106,150 ---- """process - A process running on this computer """ want = 'prcs' ! class _Prop_accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class _Prop_accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'type' ! class _Prop_file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = 'obj ' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'type' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process? """ which = 'pisf' want = 'bool' ! class _Prop_has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'itxt' ! class _Prop_partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' ! class _Prop_total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'long' ! class _Prop_visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' *************** *** 154,158 **** application._superclassnames = [] application._privpropdict = { ! 'desktop_picture' : desktop_picture, } application._privelemdict = { --- 154,158 ---- application._superclassnames = [] application._privpropdict = { ! 'desktop_picture' : _Prop_desktop_picture, } application._privelemdict = { *************** *** 160,165 **** application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'application_file' : application_file, } application_process._privelemdict = { --- 160,165 ---- application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'application_file' : _Prop_application_file, } application_process._privelemdict = { *************** *** 167,172 **** desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'desk_accessory_file' : desk_accessory_file, } desk_accessory_process._privelemdict = { --- 167,172 ---- desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'desk_accessory_file' : _Prop_desk_accessory_file, } desk_accessory_process._privelemdict = { *************** *** 174,188 **** process._superclassnames = [] process._privpropdict = { ! 'accepts_high_level_events' : accepts_high_level_events, ! 'accepts_remote_events' : accepts_remote_events, ! 'creator_type' : creator_type, ! 'file' : file, ! 'file_type' : file_type, ! 'frontmost' : frontmost, ! 'has_scripting_terminology' : has_scripting_terminology, ! 'name' : name, ! 'partition_space_used' : partition_space_used, ! 'total_partition_size' : total_partition_size, ! 'visible' : visible, } process._privelemdict = { --- 174,188 ---- process._superclassnames = [] process._privpropdict = { ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'accepts_remote_events' : _Prop_accepts_remote_events, ! 'creator_type' : _Prop_creator_type, ! 'file' : _Prop_file, ! 'file_type' : _Prop_file_type, ! 'frontmost' : _Prop_frontmost, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'name' : _Prop_name, ! 'partition_space_used' : _Prop_partition_space_used, ! 'total_partition_size' : _Prop_total_partition_size, ! 'visible' : _Prop_visible, } process._privelemdict = { *************** *** 197,223 **** 'pcda' : desk_accessory_process, 'prcs' : process, - } - - _propdeclarations = { - 'appf' : application_file, - 'appt' : total_partition_size, - 'asty' : file_type, - 'c@#^' : _3c_Inheritance_3e_, - 'dafi' : desk_accessory_file, - 'dpic' : desktop_picture, - 'fcrt' : creator_type, - 'file' : file, - 'hscr' : has_scripting_terminology, - 'isab' : accepts_high_level_events, - 'pisf' : frontmost, - 'pnam' : name, - 'pusd' : partition_space_used, - 'pvis' : visible, - 'revt' : accepts_remote_events, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 197,199 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 29 Mar 2003 00:13:14 -0000 1.4 --- Standard_Suite.py 1 Apr 2003 22:04:41 -0000 1.5 *************** *** 325,335 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 325,326 ---- Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Type_Definitions.py 30 Mar 2003 22:41:48 -0000 1.6 --- Type_Definitions.py 1 Apr 2003 22:04:41 -0000 1.7 *************** *** 23,35 **** """label - (NOT AVAILABLE YET) A Finder label (name and color) """ want = 'clbl' ! class color(aetools.NProperty): """color - the color associated with the label """ which = 'colr' want = 'cRGB' ! class index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class name(aetools.NProperty): """name - the name associated with the label """ which = 'pnam' --- 23,35 ---- """label - (NOT AVAILABLE YET) A Finder label (name and color) """ want = 'clbl' ! class _Prop_color(aetools.NProperty): """color - the color associated with the label """ which = 'colr' want = 'cRGB' ! class _Prop_index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class _Prop_name(aetools.NProperty): """name - the name associated with the label """ which = 'pnam' *************** *** 39,123 **** """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ want = 'cprf' ! class button_view_arrangement(aetools.NProperty): """button view arrangement - the method of arrangement of icons in default Finder button view windows """ which = 'barr' want = 'earr' ! class button_view_icon_size(aetools.NProperty): """button view icon size - the size of icons displayed in Finder button view windows. """ which = 'bisz' want = 'long' ! class calculates_folder_sizes(aetools.NProperty): """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ which = 'sfsz' want = 'bool' ! class delay_before_springing(aetools.NProperty): """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ which = 'dela' want = 'shor' ! class list_view_icon_size(aetools.NProperty): """list view icon size - the size of icons displayed in Finder list view windows. """ which = 'lisz' want = 'long' ! class shows_comments(aetools.NProperty): """shows comments - Are comments displayed in default Finder list view windows? """ which = 'scom' want = 'bool' ! class shows_creation_date(aetools.NProperty): """shows creation date - Are creation dates displayed in default Finder list view windows? """ which = 'scda' want = 'bool' ! class shows_kind(aetools.NProperty): """shows kind - Are document kinds displayed in default Finder list view windows? """ which = 'sknd' want = 'bool' ! class shows_label(aetools.NProperty): """shows label - Are labels displayed in default Finder list view windows? """ which = 'slbl' want = 'bool' ! class shows_modification_date(aetools.NProperty): """shows modification date - Are modification dates displayed in default Finder list view windows? """ which = 'sdat' want = 'bool' ! class shows_size(aetools.NProperty): """shows size - Are file sizes displayed in default Finder list view windows? """ which = 'ssiz' want = 'bool' ! class shows_version(aetools.NProperty): """shows version - Are file versions displayed in default Finder list view windows? """ which = 'svrs' want = 'bool' ! class spatial_view_arrangement(aetools.NProperty): """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ which = 'iarr' want = 'earr' ! class spatial_view_icon_size(aetools.NProperty): """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ which = 'iisz' want = 'long' ! class spring_open_folders(aetools.NProperty): """spring open folders - Spring open folders after the specified delay? """ which = 'sprg' want = 'bool' ! class uses_relative_dates(aetools.NProperty): """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ which = 'urdt' want = 'bool' ! class uses_simple_menus(aetools.NProperty): """uses simple menus - Use simplified Finder menus? """ which = 'usme' want = 'bool' ! class uses_wide_grid(aetools.NProperty): """uses wide grid - Space icons on a wide grid? """ which = 'uswg' want = 'bool' ! class view_font(aetools.NProperty): """view font - the id of the font used in Finder views. """ which = 'vfnt' want = 'long' ! class view_font_size(aetools.NProperty): """view font size - the size of the font used in Finder views """ which = 'vfsz' want = 'long' ! class window(aetools.NProperty): """window - the window that would open if Finder preferences was opened """ which = 'cwin' --- 39,123 ---- """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ want = 'cprf' ! class _Prop_button_view_arrangement(aetools.NProperty): """button view arrangement - the method of arrangement of icons in default Finder button view windows """ which = 'barr' want = 'earr' ! class _Prop_button_view_icon_size(aetools.NProperty): """button view icon size - the size of icons displayed in Finder button view windows. """ which = 'bisz' want = 'long' ! class _Prop_calculates_folder_sizes(aetools.NProperty): """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ which = 'sfsz' want = 'bool' ! class _Prop_delay_before_springing(aetools.NProperty): """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ which = 'dela' want = 'shor' ! class _Prop_list_view_icon_size(aetools.NProperty): """list view icon size - the size of icons displayed in Finder list view windows. """ which = 'lisz' want = 'long' ! class _Prop_shows_comments(aetools.NProperty): """shows comments - Are comments displayed in default Finder list view windows? """ which = 'scom' want = 'bool' ! class _Prop_shows_creation_date(aetools.NProperty): """shows creation date - Are creation dates displayed in default Finder list view windows? """ which = 'scda' want = 'bool' ! class _Prop_shows_kind(aetools.NProperty): """shows kind - Are document kinds displayed in default Finder list view windows? """ which = 'sknd' want = 'bool' ! class _Prop_shows_label(aetools.NProperty): """shows label - Are labels displayed in default Finder list view windows? """ which = 'slbl' want = 'bool' ! class _Prop_shows_modification_date(aetools.NProperty): """shows modification date - Are modification dates displayed in default Finder list view windows? """ which = 'sdat' want = 'bool' ! class _Prop_shows_size(aetools.NProperty): """shows size - Are file sizes displayed in default Finder list view windows? """ which = 'ssiz' want = 'bool' ! class _Prop_shows_version(aetools.NProperty): """shows version - Are file versions displayed in default Finder list view windows? """ which = 'svrs' want = 'bool' ! class _Prop_spatial_view_arrangement(aetools.NProperty): """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ which = 'iarr' want = 'earr' ! class _Prop_spatial_view_icon_size(aetools.NProperty): """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ which = 'iisz' want = 'long' ! class _Prop_spring_open_folders(aetools.NProperty): """spring open folders - Spring open folders after the specified delay? """ which = 'sprg' want = 'bool' ! class _Prop_uses_relative_dates(aetools.NProperty): """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ which = 'urdt' want = 'bool' ! class _Prop_uses_simple_menus(aetools.NProperty): """uses simple menus - Use simplified Finder menus? """ which = 'usme' want = 'bool' ! class _Prop_uses_wide_grid(aetools.NProperty): """uses wide grid - Space icons on a wide grid? """ which = 'uswg' want = 'bool' ! class _Prop_view_font(aetools.NProperty): """view font - the id of the font used in Finder views. """ which = 'vfnt' want = 'long' ! class _Prop_view_font_size(aetools.NProperty): """view font size - the size of the font used in Finder views """ which = 'vfsz' want = 'long' ! class _Prop_window(aetools.NProperty): """window - the window that would open if Finder preferences was opened """ which = 'cwin' *************** *** 129,134 **** want = 'icop' ! arrangement = spatial_view_arrangement ! class icon_size(aetools.NProperty): """icon size - the size of icons displayed in the icon view """ which = 'lvis' --- 129,134 ---- want = 'icop' ! _Prop_arrangement = _Prop_spatial_view_arrangement ! class _Prop_icon_size(aetools.NProperty): """icon size - the size of icons displayed in the icon view """ which = 'lvis' *************** *** 138,176 **** """icon family - (NOT AVAILABLE YET) A family of icons """ want = 'ifam' ! class large_32_bit_icon(aetools.NProperty): """large 32 bit icon - the large 32-bit color icon """ which = 'il32' want = 'il32' ! class large_4_bit_icon(aetools.NProperty): """large 4 bit icon - the large 4-bit color icon """ which = 'icl4' want = 'icl4' ! class large_8_bit_icon(aetools.NProperty): """large 8 bit icon - the large 8-bit color icon """ which = 'icl8' want = 'icl8' ! class large_8_bit_mask(aetools.NProperty): """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ which = 'l8mk' want = 'l8mk' ! class large_monochrome_icon_and_mask(aetools.NProperty): """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ which = 'ICN#' want = 'ICN#' ! class small_32_bit_icon(aetools.NProperty): """small 32 bit icon - the small 32-bit color icon """ which = 'is32' want = 'is32' ! class small_4_bit_icon(aetools.NProperty): """small 4 bit icon - the small 4-bit color icon """ which = 'ics4' want = 'ics4' ! class small_8_bit_icon(aetools.NProperty): """small 8 bit icon - the small 8-bit color icon """ which = 'ics8' want = 'ics8' ! small_8_bit_mask = small_8_bit_icon ! class small_monochrome_icon_and_mask(aetools.NProperty): """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ which = 'ics#' --- 138,176 ---- """icon family - (NOT AVAILABLE YET) A family of icons """ want = 'ifam' ! class _Prop_large_32_bit_icon(aetools.NProperty): """large 32 bit icon - the large 32-bit color icon """ which = 'il32' want = 'il32' ! class _Prop_large_4_bit_icon(aetools.NProperty): """large 4 bit icon - the large 4-bit color icon """ which = 'icl4' want = 'icl4' ! class _Prop_large_8_bit_icon(aetools.NProperty): """large 8 bit icon - the large 8-bit color icon """ which = 'icl8' want = 'icl8' ! class _Prop_large_8_bit_mask(aetools.NProperty): """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ which = 'l8mk' want = 'l8mk' ! class _Prop_large_monochrome_icon_and_mask(aetools.NProperty): """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ which = 'ICN#' want = 'ICN#' ! class _Prop_small_32_bit_icon(aetools.NProperty): """small 32 bit icon - the small 32-bit color icon """ which = 'is32' want = 'is32' ! class _Prop_small_4_bit_icon(aetools.NProperty): """small 4 bit icon - the small 4-bit color icon """ which = 'ics4' want = 'ics4' ! class _Prop_small_8_bit_icon(aetools.NProperty): """small 8 bit icon - the small 8-bit color icon """ which = 'ics8' want = 'ics8' ! _Prop_small_8_bit_mask = _Prop_small_8_bit_icon ! class _Prop_small_monochrome_icon_and_mask(aetools.NProperty): """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ which = 'ics#' *************** *** 180,192 **** """column - a column of a list view """ want = 'lvcl' ! class sort_direction(aetools.NProperty): """sort direction - The direction in which the window is sorted """ which = 'sord' want = 'sodr' ! class visible(aetools.NProperty): """visible - is this column visible """ which = 'pvis' want = 'bool' ! class width(aetools.NProperty): """width - the width of this column """ which = 'clwd' --- 180,192 ---- """column - a column of a list view """ want = 'lvcl' ! class _Prop_sort_direction(aetools.NProperty): """sort direction - The direction in which the window is sorted """ which = 'sord' want = 'sodr' ! class _Prop_visible(aetools.NProperty): """visible - is this column visible """ which = 'pvis' want = 'bool' ! class _Prop_width(aetools.NProperty): """width - the width of this column """ which = 'clwd' *************** *** 198,202 **** """list view options - the list view options """ want = 'lvop' ! class sort_column(aetools.NProperty): """sort column - the column that the list view is sorted on """ which = 'srtc' --- 198,202 ---- """list view options - the list view options """ want = 'lvop' ! class _Prop_sort_column(aetools.NProperty): """sort column - the column that the list view is sorted on """ which = 'srtc' *************** *** 210,216 **** label._superclassnames = [] label._privpropdict = { ! 'color' : color, ! 'index' : index, ! 'name' : name, } label._privelemdict = { --- 210,216 ---- label._superclassnames = [] label._privpropdict = { ! 'color' : _Prop_color, ! 'index' : _Prop_index, ! 'name' : _Prop_name, } label._privelemdict = { *************** *** 218,242 **** preferences._superclassnames = [] preferences._privpropdict = { ! 'button_view_arrangement' : button_view_arrangement, ! 'button_view_icon_size' : button_view_icon_size, ! 'calculates_folder_sizes' : calculates_folder_sizes, ! 'delay_before_springing' : delay_before_springing, ! 'list_view_icon_size' : list_view_icon_size, ! 'shows_comments' : shows_comments, ! 'shows_creation_date' : shows_creation_date, ! 'shows_kind' : shows_kind, ! 'shows_label' : shows_label, ! 'shows_modification_date' : shows_modification_date, ! 'shows_size' : shows_size, ! 'shows_version' : shows_version, ! 'spatial_view_arrangement' : spatial_view_arrangement, ! 'spatial_view_icon_size' : spatial_view_icon_size, ! 'spring_open_folders' : spring_open_folders, ! 'uses_relative_dates' : uses_relative_dates, ! 'uses_simple_menus' : uses_simple_menus, ! 'uses_wide_grid' : uses_wide_grid, ! 'view_font' : view_font, ! 'view_font_size' : view_font_size, ! 'window' : window, } preferences._privelemdict = { --- 218,242 ---- preferences._superclassnames = [] preferences._privpropdict = { ! 'button_view_arrangement' : _Prop_button_view_arrangement, ! 'button_view_icon_size' : _Prop_button_view_icon_size, ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'delay_before_springing' : _Prop_delay_before_springing, ! 'list_view_icon_size' : _Prop_list_view_icon_size, ! 'shows_comments' : _Prop_shows_comments, ! 'shows_creation_date' : _Prop_shows_creation_date, ! 'shows_kind' : _Prop_shows_kind, ! 'shows_label' : _Prop_shows_label, ! 'shows_modification_date' : _Prop_shows_modification_date, ! 'shows_size' : _Prop_shows_size, ! 'shows_version' : _Prop_shows_version, ! 'spatial_view_arrangement' : _Prop_spatial_view_arrangement, ! 'spatial_view_icon_size' : _Prop_spatial_view_icon_size, ! 'spring_open_folders' : _Prop_spring_open_folders, ! 'uses_relative_dates' : _Prop_uses_relative_dates, ! 'uses_simple_menus' : _Prop_uses_simple_menus, ! 'uses_wide_grid' : _Prop_uses_wide_grid, ! 'view_font' : _Prop_view_font, ! 'view_font_size' : _Prop_view_font_size, ! 'window' : _Prop_window, } preferences._privelemdict = { *************** *** 245,250 **** icon_view_options._superclassnames = [] icon_view_options._privpropdict = { ! 'arrangement' : arrangement, ! 'icon_size' : icon_size, } icon_view_options._privelemdict = { --- 245,250 ---- icon_view_options._superclassnames = [] icon_view_options._privpropdict = { ! 'arrangement' : _Prop_arrangement, ! 'icon_size' : _Prop_icon_size, } icon_view_options._privelemdict = { *************** *** 252,265 **** icon_family._superclassnames = [] icon_family._privpropdict = { ! 'large_32_bit_icon' : large_32_bit_icon, ! 'large_4_bit_icon' : large_4_bit_icon, ! 'large_8_bit_icon' : large_8_bit_icon, ! 'large_8_bit_mask' : large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, ! 'small_32_bit_icon' : small_32_bit_icon, ! 'small_4_bit_icon' : small_4_bit_icon, ! 'small_8_bit_icon' : small_8_bit_icon, ! 'small_8_bit_mask' : small_8_bit_mask, ! 'small_monochrome_icon_and_mask' : small_monochrome_icon_and_mask, } icon_family._privelemdict = { --- 252,265 ---- icon_family._superclassnames = [] icon_family._privpropdict = { ! 'large_32_bit_icon' : _Prop_large_32_bit_icon, ! 'large_4_bit_icon' : _Prop_large_4_bit_icon, ! 'large_8_bit_icon' : _Prop_large_8_bit_icon, ! 'large_8_bit_mask' : _Prop_large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : _Prop_large_monochrome_icon_and_mask, ! 'small_32_bit_icon' : _Prop_small_32_bit_icon, ! 'small_4_bit_icon' : _Prop_small_4_bit_icon, ! 'small_8_bit_icon' : _Prop_small_8_bit_icon, ! 'small_8_bit_mask' : _Prop_small_8_bit_mask, ! 'small_monochrome_icon_and_mask' : _Prop_small_monochrome_icon_and_mask, } icon_family._privelemdict = { *************** *** 267,275 **** column._superclassnames = [] column._privpropdict = { ! 'index' : index, ! 'name' : name, ! 'sort_direction' : sort_direction, ! 'visible' : visible, ! 'width' : width, } column._privelemdict = { --- 267,275 ---- column._superclassnames = [] column._privpropdict = { ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'sort_direction' : _Prop_sort_direction, ! 'visible' : _Prop_visible, ! 'width' : _Prop_width, } column._privelemdict = { *************** *** 277,284 **** list_view_options._superclassnames = [] list_view_options._privpropdict = { ! 'calculates_folder_sizes' : calculates_folder_sizes, ! 'icon_size' : icon_size, ! 'sort_column' : sort_column, ! 'uses_relative_dates' : uses_relative_dates, } list_view_options._privelemdict = { --- 277,284 ---- list_view_options._superclassnames = [] list_view_options._privpropdict = { ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'icon_size' : _Prop_icon_size, ! 'sort_column' : _Prop_sort_column, ! 'uses_relative_dates' : _Prop_uses_relative_dates, } list_view_options._privelemdict = { *************** *** 297,346 **** 'lvcl' : column, 'lvop' : list_view_options, - } - - _propdeclarations = { - 'ICN#' : large_monochrome_icon_and_mask, - 'barr' : button_view_arrangement, - 'bisz' : button_view_icon_size, - 'clwd' : width, - 'colr' : color, - 'cwin' : window, - 'dela' : delay_before_springing, - 'iarr' : spatial_view_arrangement, - 'icl4' : large_4_bit_icon, - 'icl8' : large_8_bit_icon, - 'ics#' : small_monochrome_icon_and_mask, - 'ics4' : small_4_bit_icon, - 'ics8' : small_8_bit_icon, - 'iisz' : spatial_view_icon_size, - 'il32' : large_32_bit_icon, - 'is32' : small_32_bit_icon, - 'l8mk' : large_8_bit_mask, - 'lisz' : list_view_icon_size, - 'lvis' : icon_size, - 'pidx' : index, - 'pnam' : name, - 'pvis' : visible, - 'scda' : shows_creation_date, - 'scom' : shows_comments, - 'sdat' : shows_modification_date, - 'sfsz' : calculates_folder_sizes, - 'sknd' : shows_kind, - 'slbl' : shows_label, - 'sord' : sort_direction, - 'sprg' : spring_open_folders, - 'srtc' : sort_column, - 'ssiz' : shows_size, - 'svrs' : shows_version, - 'urdt' : uses_relative_dates, - 'usme' : uses_simple_menus, - 'uswg' : uses_wide_grid, - 'vfnt' : view_font, - 'vfsz' : view_font_size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 297,299 ---- Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Window_classes.py 30 Mar 2003 22:41:48 -0000 1.6 --- Window_classes.py 1 Apr 2003 22:04:43 -0000 1.7 *************** *** 19,39 **** """Finder window - A file viewer window """ want = 'brow' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the window class """ which = 'c@#^' want = 'cwin' ! class current_view(aetools.NProperty): """current view - the current view for the container window """ which = 'pvew' want = 'ecvw' ! class icon_view_options(aetools.NProperty): """icon view options - the icon view options for the container window """ which = 'icop' want = 'icop' ! class list_view_options(aetools.NProperty): """list view options - the list view options for the container window """ which = 'lvop' want = 'lvop' ! class target(aetools.NProperty): """target - the container at which this file viewer is targeted """ which = 'fvtg' --- 19,39 ---- """Finder window - A file viewer window """ want = 'brow' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the window class """ which = 'c@#^' want = 'cwin' ! class _Prop_current_view(aetools.NProperty): """current view - the current view for the container window """ which = 'pvew' want = 'ecvw' ! class _Prop_icon_view_options(aetools.NProperty): """icon view options - the icon view options for the container window """ which = 'icop' want = 'icop' ! class _Prop_list_view_options(aetools.NProperty): """list view options - the list view options for the container window """ which = 'lvop' want = 'lvop' ! class _Prop_target(aetools.NProperty): """target - the container at which this file viewer is targeted """ which = 'fvtg' *************** *** 45,109 **** """window - A window """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class collapsed(aetools.NProperty): """collapsed - Is the window collapsed """ which = 'wshd' want = 'bool' ! class floating(aetools.NProperty): """floating - Does the window have a title bar? """ which = 'isfl' want = 'bool' ! class id(aetools.NProperty): """id - the unique id for this window """ which = 'ID ' want = 'magn' ! class index(aetools.NProperty): """index - the number of the window in the front-to-back layer ordering """ which = 'pidx' want = 'long' ! class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class name(aetools.NProperty): """name - the name of the window """ which = 'pnam' want = 'utxt' ! class position(aetools.NProperty): """position - the upper left position of the window """ which = 'posn' want = 'QDpt' ! class properties(aetools.NProperty): """properties - every property of a window """ which = 'pALL' want = 'reco' ! class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Is the window visible (always true for open Finder windows)? """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' want = 'bool' ! class zoomed_full_size(aetools.NProperty): """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ which = 'zumf' --- 45,109 ---- """window - A window """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class _Prop_collapsed(aetools.NProperty): """collapsed - Is the window collapsed """ which = 'wshd' want = 'bool' ! class _Prop_floating(aetools.NProperty): """floating - Does the window have a title bar? """ which = 'isfl' want = 'bool' ! class _Prop_id(aetools.NProperty): """id - the unique id for this window """ which = 'ID ' want = 'magn' ! class _Prop_index(aetools.NProperty): """index - the number of the window in the front-to-back layer ordering """ which = 'pidx' want = 'long' ! class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the window """ which = 'pnam' want = 'utxt' ! class _Prop_position(aetools.NProperty): """position - the upper left position of the window """ which = 'posn' want = 'QDpt' ! class _Prop_properties(aetools.NProperty): """properties - every property of a window """ which = 'pALL' want = 'reco' ! class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Is the window visible (always true for open Finder windows)? """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' want = 'bool' ! class _Prop_zoomed_full_size(aetools.NProperty): """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ which = 'zumf' *************** *** 115,123 **** """information window - An inspector window (opened by \xd2Show Info\xd3) """ want = 'iwnd' ! class current_panel(aetools.NProperty): """current panel - the current panel in the information window """ which = 'panl' want = 'ipnl' ! class item(aetools.NProperty): """item - the item from which this window was opened """ which = 'cobj' --- 115,123 ---- """information window - An inspector window (opened by \xd2Show Info\xd3) """ want = 'iwnd' ! class _Prop_current_panel(aetools.NProperty): """current panel - the current panel in the information window """ which = 'panl' want = 'ipnl' ! class _Prop_item(aetools.NProperty): """item - the item from which this window was opened """ which = 'cobj' *************** *** 135,143 **** Finder_window._superclassnames = ['window'] Finder_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'current_view' : current_view, ! 'icon_view_options' : icon_view_options, ! 'list_view_options' : list_view_options, ! 'target' : target, } Finder_window._privelemdict = { --- 135,143 ---- Finder_window._superclassnames = ['window'] Finder_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_view' : _Prop_current_view, ! 'icon_view_options' : _Prop_icon_view_options, ! 'list_view_options' : _Prop_list_view_options, ! 'target' : _Prop_target, } Finder_window._privelemdict = { *************** *** 145,164 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'collapsed' : collapsed, ! 'floating' : floating, ! 'id' : id, ! 'index' : index, ! 'modal' : modal, ! 'name' : name, ! 'position' : position, ! 'properties' : properties, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, ! 'zoomed_full_size' : zoomed_full_size, } window._privelemdict = { --- 145,164 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'collapsed' : _Prop_collapsed, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, ! 'zoomed_full_size' : _Prop_zoomed_full_size, } window._privelemdict = { *************** *** 166,172 **** information_window._superclassnames = ['window'] information_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'current_panel' : current_panel, ! 'item' : item, } information_window._privelemdict = { --- 166,172 ---- information_window._superclassnames = ['window'] information_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, ! 'item' : _Prop_item, } information_window._privelemdict = { *************** *** 174,178 **** clipping_window._superclassnames = ['window'] clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } clipping_window._privelemdict = { --- 174,178 ---- clipping_window._superclassnames = ['window'] clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } clipping_window._privelemdict = { *************** *** 180,185 **** preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'current_panel' : current_panel, } preferences_window._privelemdict = { --- 180,185 ---- preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, } preferences_window._privelemdict = { *************** *** 195,229 **** 'lwnd' : clipping_window, 'pwnd' : preferences_window, - } - - _propdeclarations = { - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'cobj' : item, - 'fvtg' : target, - 'hclb' : closeable, - 'icop' : icon_view_options, - 'isfl' : floating, - 'iszm' : zoomable, - 'lvop' : list_view_options, - 'pALL' : properties, - 'panl' : current_panel, - 'pbnd' : bounds, - 'pidx' : index, - 'pmod' : modal, - 'pnam' : name, - 'posn' : position, - 'prsz' : resizable, - 'ptit' : titled, - 'pvew' : current_view, - 'pvis' : visible, - 'pzum' : zoomed, - 'wshd' : collapsed, - 'zumf' : zoomed_full_size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 195,197 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 30 Mar 2003 22:41:48 -0000 1.6 --- __init__.py 1 Apr 2003 22:04:44 -0000 1.7 *************** *** 68,72 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(item) getbaseclasses(application) getbaseclasses(trash_2d_object) --- 68,71 ---- *************** *** 75,78 **** --- 74,78 ---- getbaseclasses(folder) getbaseclasses(disk) + getbaseclasses(item) getbaseclasses(package) getbaseclasses(file) *************** *** 87,90 **** --- 87,94 ---- getbaseclasses(clipping_window) getbaseclasses(information_window) + getbaseclasses(process) + getbaseclasses(application_process) + getbaseclasses(desk_accessory_process) + getbaseclasses(application) getbaseclasses(icon_view_options) getbaseclasses(label) *************** *** 94,101 **** getbaseclasses(icon_family) getbaseclasses(list_view_options) - getbaseclasses(process) - getbaseclasses(application_process) - getbaseclasses(desk_accessory_process) - getbaseclasses(application) getbaseclasses(StdSuites.Type_Names_Suite.double_integer) getbaseclasses(StdSuites.Type_Names_Suite.version) --- 98,101 ---- *************** *** 133,137 **** getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.null) --- 133,137 ---- getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.string) getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.null) *************** *** 143,147 **** # _classdeclarations = { - 'cobj' : item, 'capp' : application, 'ctrs' : trash_2d_object, --- 143,146 ---- *************** *** 150,153 **** --- 149,153 ---- 'cfol' : folder, 'cdis' : disk, + 'cobj' : item, 'pack' : package, 'file' : file, *************** *** 162,165 **** --- 162,169 ---- 'lwnd' : clipping_window, 'iwnd' : information_window, + 'prcs' : process, + 'pcap' : application_process, + 'pcda' : desk_accessory_process, + 'capp' : application, 'icop' : icon_view_options, 'clbl' : label, *************** *** 169,176 **** 'ifam' : icon_family, 'lvop' : list_view_options, - 'prcs' : process, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'capp' : application, 'comp' : StdSuites.Type_Names_Suite.double_integer, 'vers' : StdSuites.Type_Names_Suite.version, --- 173,176 ---- *************** *** 208,212 **** 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, 'sing' : StdSuites.Type_Names_Suite.small_real, 'null' : StdSuites.Type_Names_Suite.null, --- 208,212 ---- 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, 'sing' : StdSuites.Type_Names_Suite.small_real, 'null' : StdSuites.Type_Names_Suite.null, From jackjansen@users.sourceforge.net Tue Apr 1 22:05:37 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.5,1.6 Metrowerks_Shell_Suite.py,1.5,1.6 Required.py,1.2,1.3 Standard_Suite.py,1.4,1.5 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv20940/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CodeWarrior_suite.py 30 Mar 2003 22:41:47 -0000 1.5 --- CodeWarrior_suite.py 1 Apr 2003 22:04:25 -0000 1.6 *************** *** 248,252 **** """single class browser - a single class browser """ want = '1BRW' ! class inherits(aetools.NProperty): """inherits - all properties and elements of the given class are inherited by this class. """ which = 'c@#^' --- 248,252 ---- """single class browser - a single class browser """ want = '1BRW' ! class _Prop_inherits(aetools.NProperty): """inherits - all properties and elements of the given class are inherited by this class. """ which = 'c@#^' *************** *** 312,316 **** """project document - a project document """ want = 'PRJD' ! class current_target(aetools.NProperty): """current target - the current target """ which = 'CURT' --- 312,316 ---- """project document - a project document """ want = 'PRJD' ! class _Prop_current_target(aetools.NProperty): """current target - the current target """ which = 'CURT' *************** *** 323,331 **** """subtarget - a target that is prerequisite for another target """ want = 'SBTG' ! class link_against_output(aetools.NProperty): """link against output - is the output of this subtarget linked into its dependent target? """ which = 'LNKO' want = 'bool' ! class target(aetools.NProperty): """target - the target that is dependent on this subtarget """ which = 'TrgT' --- 323,331 ---- """subtarget - a target that is prerequisite for another target """ want = 'SBTG' ! class _Prop_link_against_output(aetools.NProperty): """link against output - is the output of this subtarget linked into its dependent target? """ which = 'LNKO' want = 'bool' ! class _Prop_target(aetools.NProperty): """target - the target that is dependent on this subtarget """ which = 'TrgT' *************** *** 337,401 **** """target file - a source or header file in a target """ want = 'SRCF' ! class code_size(aetools.NProperty): """code size - the size of the code (in bytes) produced by compiling this source file """ which = 'CSZE' want = 'long' ! class compiled_date(aetools.NProperty): """compiled date - the date and this source file was last compiled """ which = 'CMPD' want = 'ldt ' ! class data_size(aetools.NProperty): """data size - the size of the date (in bytes) produced by compiling this source file """ which = 'DSZE' want = 'long' ! class debug(aetools.NProperty): """debug - is debugging information generated for this source file? """ which = 'DBUG' want = 'bool' ! class dependents(aetools.NProperty): """dependents - the source files that need this source file in order to build """ which = 'DPND' want = 'list' ! class id(aetools.NProperty): """id - the unique ID number of the target file """ which = 'ID ' want = 'long' ! class init_before(aetools.NProperty): """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' ! class link_index(aetools.NProperty): """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' ! class linked(aetools.NProperty): """linked - is the source file in the link order of its target? """ which = 'LINK' want = 'bool' ! class location(aetools.NProperty): """location - the location of the target file on disk """ which = 'FILE' want = 'fss ' ! class merge_output(aetools.NProperty): """merge output - is this shared library merged into another code fragment? """ which = 'MRGE' want = 'bool' ! class modified_date(aetools.NProperty): """modified date - the date and time this source file was last modified """ which = 'MODD' want = 'ldt ' ! class path(aetools.NProperty): """path - the path of the source file on disk """ which = 'Path' want = 'itxt' ! class prerequisites(aetools.NProperty): """prerequisites - the source files needed to build this source file """ which = 'PRER' want = 'list' ! class type(aetools.NProperty): """type - the type of source file """ which = 'FTYP' want = 'FTYP' ! class weak_link(aetools.NProperty): """weak link - is this shared library linked weakly? """ which = 'WEAK' --- 337,401 ---- """target file - a source or header file in a target """ want = 'SRCF' ! class _Prop_code_size(aetools.NProperty): """code size - the size of the code (in bytes) produced by compiling this source file """ which = 'CSZE' want = 'long' ! class _Prop_compiled_date(aetools.NProperty): """compiled date - the date and this source file was last compiled """ which = 'CMPD' want = 'ldt ' ! class _Prop_data_size(aetools.NProperty): """data size - the size of the date (in bytes) produced by compiling this source file """ which = 'DSZE' want = 'long' ! class _Prop_debug(aetools.NProperty): """debug - is debugging information generated for this source file? """ which = 'DBUG' want = 'bool' ! class _Prop_dependents(aetools.NProperty): """dependents - the source files that need this source file in order to build """ which = 'DPND' want = 'list' ! class _Prop_id(aetools.NProperty): """id - the unique ID number of the target file """ which = 'ID ' want = 'long' ! class _Prop_init_before(aetools.NProperty): """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' ! class _Prop_link_index(aetools.NProperty): """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' ! class _Prop_linked(aetools.NProperty): """linked - is the source file in the link order of its target? """ which = 'LINK' want = 'bool' ! class _Prop_location(aetools.NProperty): """location - the location of the target file on disk """ which = 'FILE' want = 'fss ' ! class _Prop_merge_output(aetools.NProperty): """merge output - is this shared library merged into another code fragment? """ which = 'MRGE' want = 'bool' ! class _Prop_modified_date(aetools.NProperty): """modified date - the date and time this source file was last modified """ which = 'MODD' want = 'ldt ' ! class _Prop_path(aetools.NProperty): """path - the path of the source file on disk """ which = 'Path' want = 'itxt' ! class _Prop_prerequisites(aetools.NProperty): """prerequisites - the source files needed to build this source file """ which = 'PRER' want = 'list' ! class _Prop_type(aetools.NProperty): """type - the type of source file """ which = 'FTYP' want = 'FTYP' ! class _Prop_weak_link(aetools.NProperty): """weak link - is this shared library linked weakly? """ which = 'WEAK' *************** *** 419,427 **** """target - a target in a project """ want = 'TRGT' ! class name(aetools.NProperty): """name - """ which = 'pnam' want = 'itxt' ! class project_document(aetools.NProperty): """project document - the project document that contains this target """ which = 'PrjD' --- 419,427 ---- """target - a target in a project """ want = 'TRGT' ! class _Prop_name(aetools.NProperty): """name - """ which = 'pnam' want = 'itxt' ! class _Prop_project_document(aetools.NProperty): """project document - the project document that contains this target """ which = 'PrjD' *************** *** 435,443 **** """text document - a document that contains text """ want = 'TXTD' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class selection(aetools.NProperty): """selection - the selection visible to the user """ which = 'sele' --- 435,443 ---- """text document - a document that contains text """ want = 'TXTD' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class _Prop_selection(aetools.NProperty): """selection - the selection visible to the user """ which = 'sele' *************** *** 451,455 **** single_class_browser._superclassnames = ['text_document'] single_class_browser._privpropdict = { ! 'inherits' : inherits, } single_class_browser._privelemdict = { --- 451,455 ---- single_class_browser._superclassnames = ['text_document'] single_class_browser._privpropdict = { ! 'inherits' : _Prop_inherits, } single_class_browser._privelemdict = { *************** *** 458,462 **** single_class_hierarchy._superclassnames = ['document'] single_class_hierarchy._privpropdict = { ! 'inherits' : inherits, } single_class_hierarchy._privelemdict = { --- 458,462 ---- single_class_hierarchy._superclassnames = ['document'] single_class_hierarchy._privpropdict = { ! 'inherits' : _Prop_inherits, } single_class_hierarchy._privelemdict = { *************** *** 464,468 **** class_browser._superclassnames = ['text_document'] class_browser._privpropdict = { ! 'inherits' : inherits, } class_browser._privelemdict = { --- 464,468 ---- class_browser._superclassnames = ['text_document'] class_browser._privpropdict = { ! 'inherits' : _Prop_inherits, } class_browser._privelemdict = { *************** *** 470,474 **** file_compare_document._superclassnames = ['text_document'] file_compare_document._privpropdict = { ! 'inherits' : inherits, } file_compare_document._privelemdict = { --- 470,474 ---- file_compare_document._superclassnames = ['text_document'] file_compare_document._privpropdict = { ! 'inherits' : _Prop_inherits, } file_compare_document._privelemdict = { *************** *** 476,480 **** catalog_document._superclassnames = ['text_document'] catalog_document._privpropdict = { ! 'inherits' : inherits, } catalog_document._privelemdict = { --- 476,480 ---- catalog_document._superclassnames = ['text_document'] catalog_document._privpropdict = { ! 'inherits' : _Prop_inherits, } catalog_document._privelemdict = { *************** *** 482,486 **** editor_document._superclassnames = ['text_document'] editor_document._privpropdict = { ! 'inherits' : inherits, } editor_document._privelemdict = { --- 482,486 ---- editor_document._superclassnames = ['text_document'] editor_document._privpropdict = { ! 'inherits' : _Prop_inherits, } editor_document._privelemdict = { *************** *** 488,492 **** class_hierarchy._superclassnames = ['document'] class_hierarchy._privpropdict = { ! 'inherits' : inherits, } class_hierarchy._privelemdict = { --- 488,492 ---- class_hierarchy._superclassnames = ['document'] class_hierarchy._privpropdict = { ! 'inherits' : _Prop_inherits, } class_hierarchy._privelemdict = { *************** *** 494,498 **** project_inspector._superclassnames = ['document'] project_inspector._privpropdict = { ! 'inherits' : inherits, } project_inspector._privelemdict = { --- 494,498 ---- project_inspector._superclassnames = ['document'] project_inspector._privpropdict = { ! 'inherits' : _Prop_inherits, } project_inspector._privelemdict = { *************** *** 500,504 **** message_document._superclassnames = ['text_document'] message_document._privpropdict = { ! 'inherits' : inherits, } message_document._privelemdict = { --- 500,504 ---- message_document._superclassnames = ['text_document'] message_document._privpropdict = { ! 'inherits' : _Prop_inherits, } message_document._privelemdict = { *************** *** 506,510 **** build_progress_document._superclassnames = ['document'] build_progress_document._privpropdict = { ! 'inherits' : inherits, } build_progress_document._privelemdict = { --- 506,510 ---- build_progress_document._superclassnames = ['document'] build_progress_document._privpropdict = { ! 'inherits' : _Prop_inherits, } build_progress_document._privelemdict = { *************** *** 512,517 **** project_document._superclassnames = ['document'] project_document._privpropdict = { ! 'current_target' : current_target, ! 'inherits' : inherits, } project_document._privelemdict = { --- 512,517 ---- project_document._superclassnames = ['document'] project_document._privpropdict = { ! 'current_target' : _Prop_current_target, ! 'inherits' : _Prop_inherits, } project_document._privelemdict = { *************** *** 520,526 **** subtarget._superclassnames = ['target'] subtarget._privpropdict = { ! 'inherits' : inherits, ! 'link_against_output' : link_against_output, ! 'target' : target, } subtarget._privelemdict = { --- 520,526 ---- subtarget._superclassnames = ['target'] subtarget._privpropdict = { ! 'inherits' : _Prop_inherits, ! 'link_against_output' : _Prop_link_against_output, ! 'target' : _Prop_target, } subtarget._privelemdict = { *************** *** 528,547 **** target_file._superclassnames = [] target_file._privpropdict = { ! 'code_size' : code_size, ! 'compiled_date' : compiled_date, ! 'data_size' : data_size, ! 'debug' : debug, ! 'dependents' : dependents, ! 'id' : id, ! 'init_before' : init_before, ! 'link_index' : link_index, ! 'linked' : linked, ! 'location' : location, ! 'merge_output' : merge_output, ! 'modified_date' : modified_date, ! 'path' : path, ! 'prerequisites' : prerequisites, ! 'type' : type, ! 'weak_link' : weak_link, } target_file._privelemdict = { --- 528,547 ---- target_file._superclassnames = [] target_file._privpropdict = { ! 'code_size' : _Prop_code_size, ! 'compiled_date' : _Prop_compiled_date, ! 'data_size' : _Prop_data_size, ! 'debug' : _Prop_debug, ! 'dependents' : _Prop_dependents, ! 'id' : _Prop_id, ! 'init_before' : _Prop_init_before, ! 'link_index' : _Prop_link_index, ! 'linked' : _Prop_linked, ! 'location' : _Prop_location, ! 'merge_output' : _Prop_merge_output, ! 'modified_date' : _Prop_modified_date, ! 'path' : _Prop_path, ! 'prerequisites' : _Prop_prerequisites, ! 'type' : _Prop_type, ! 'weak_link' : _Prop_weak_link, } target_file._privelemdict = { *************** *** 549,553 **** symbol_browser._superclassnames = ['text_document'] symbol_browser._privpropdict = { ! 'inherits' : inherits, } symbol_browser._privelemdict = { --- 549,553 ---- symbol_browser._superclassnames = ['text_document'] symbol_browser._privpropdict = { ! 'inherits' : _Prop_inherits, } symbol_browser._privelemdict = { *************** *** 555,559 **** ToolServer_worksheet._superclassnames = ['text_document'] ToolServer_worksheet._privpropdict = { ! 'inherits' : inherits, } ToolServer_worksheet._privelemdict = { --- 555,559 ---- ToolServer_worksheet._superclassnames = ['text_document'] ToolServer_worksheet._privpropdict = { ! 'inherits' : _Prop_inherits, } ToolServer_worksheet._privelemdict = { *************** *** 561,566 **** target._superclassnames = [] target._privpropdict = { ! 'name' : name, ! 'project_document' : project_document, } target._privelemdict = { --- 561,566 ---- target._superclassnames = [] target._privpropdict = { ! 'name' : _Prop_name, ! 'project_document' : _Prop_project_document, } target._privelemdict = { *************** *** 570,576 **** text_document._superclassnames = ['document'] text_document._privpropdict = { ! 'inherits' : inherits, ! 'modified' : modified, ! 'selection' : selection, } text_document._privelemdict = { --- 570,576 ---- text_document._superclassnames = ['document'] text_document._privpropdict = { ! 'inherits' : _Prop_inherits, ! 'modified' : _Prop_modified, ! 'selection' : _Prop_selection, } text_document._privelemdict = { *************** *** 643,682 **** 'TRGT' : target, 'TXTD' : text_document, - } - - _propdeclarations = { - 'CMPD' : compiled_date, - 'CSZE' : code_size, - 'CURT' : current_target, - 'DBUG' : debug, - 'DPND' : dependents, - 'DSZE' : data_size, - 'FILE' : location, - 'FTYP' : type, - 'ID ' : id, - 'INIT' : init_before, - 'LIDX' : link_index, - 'LINK' : linked, - 'LNKO' : link_against_output, - 'MODD' : modified_date, - 'MRGE' : merge_output, - 'PRER' : prerequisites, - 'Path' : path, - 'PrjD' : project_document, - 'TrgT' : target, - 'WEAK' : weak_link, - 'c@#^' : inherits, - 'imod' : modified, - 'pnam' : name, - 'sele' : selection, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'DKND' : _Enum_DKND, - 'FTYP' : _Enum_FTYP, - 'Inte' : _Enum_Inte, - 'PERM' : _Enum_PERM, } --- 643,645 ---- Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Metrowerks_Shell_Suite.py 30 Mar 2003 22:41:47 -0000 1.5 --- Metrowerks_Shell_Suite.py 1 Apr 2003 22:04:26 -0000 1.6 *************** *** 794,834 **** """Browser Coloring - Colors for Browser symbols. """ want = 'BRKW' ! class Browser_Keywords(aetools.NProperty): """Browser Keywords - Mark Browser symbols with color. """ which = 'BW00' want = 'bool' ! class Classes_Color(aetools.NProperty): """Classes Color - The color for classes. """ which = 'BW01' want = 'cRGB' [...2507 lines suppressed...] - - _enumdeclarations = { - 'Acce' : _Enum_Acce, - 'BXbr' : _Enum_BXbr, - 'DbSA' : _Enum_DbSA, - 'DgBL' : _Enum_DgBL, - 'ErrT' : _Enum_ErrT, - 'Inte' : _Enum_Inte, - 'Lang' : _Enum_Lang, - 'PPrm' : _Enum_PPrm, - 'PXdg' : _Enum_PXdg, - 'PthF' : _Enum_PthF, - 'RefP' : _Enum_RefP, - 'STKd' : _Enum_STKd, - 'SrcT' : _Enum_SrcT, - 'TmpB' : _Enum_TmpB, - 'TxtF' : _Enum_TxtF, - 'savo' : _Enum_savo, } --- 2173,2175 ---- Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required.py 23 Mar 2003 22:07:27 -0000 1.2 --- Required.py 1 Apr 2003 22:04:27 -0000 1.3 *************** *** 51,62 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'Conv' : _Enum_Conv, - } --- 51,52 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 30 Mar 2003 22:41:47 -0000 1.4 --- Standard_Suite.py 1 Apr 2003 22:04:28 -0000 1.5 *************** *** 176,180 **** """application - an application program """ want = 'capp' ! class user_interaction(aetools.NProperty): """user interaction - user interaction level """ which = 'inte' --- 176,180 ---- """application - an application program """ want = 'capp' ! class _Prop_user_interaction(aetools.NProperty): """user interaction - user interaction level """ which = 'inte' *************** *** 186,194 **** """character - a character """ want = 'cha ' ! class length(aetools.NProperty): """length - length in characters of this object """ which = 'pLen' want = 'long' ! class offset(aetools.NProperty): """offset - offset of a text object from the beginning of the document (first char has offset 1) """ which = 'pOff' --- 186,194 ---- """character - a character """ want = 'cha ' ! class _Prop_length(aetools.NProperty): """length - length in characters of this object """ which = 'pLen' want = 'long' ! class _Prop_offset(aetools.NProperty): """offset - offset of a text object from the beginning of the document (first char has offset 1) """ which = 'pOff' *************** *** 202,206 **** """line - lines of text """ want = 'clin' ! class index(aetools.NProperty): """index - index of a line object from the beginning of the document (first line has index 1) """ which = 'pidx' --- 202,206 ---- """line - lines of text """ want = 'clin' ! class _Prop_index(aetools.NProperty): """index - index of a line object from the beginning of the document (first line has index 1) """ which = 'pidx' *************** *** 213,217 **** """selection-object - the selection visible to the user """ want = 'csel' ! class contents(aetools.NProperty): """contents - the contents of the selection """ which = 'pcnt' --- 213,217 ---- """selection-object - the selection visible to the user """ want = 'csel' ! class _Prop_contents(aetools.NProperty): """contents - the contents of the selection """ which = 'pcnt' *************** *** 232,256 **** """window - A window """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class document(aetools.NProperty): """document - the document that owns this window """ which = 'docu' want = 'docu' ! class name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' --- 232,256 ---- """window - A window """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_document(aetools.NProperty): """document - the document that owns this window """ which = 'docu' want = 'docu' ! class _Prop_name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class _Prop_position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class _Prop_visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' *************** *** 262,278 **** """document - a document """ want = 'docu' ! class file_permissions(aetools.NProperty): """file permissions - the file permissions for the document """ which = 'PERM' want = 'PERM' ! class kind(aetools.NProperty): """kind - the kind of document """ which = 'DKND' want = 'DKND' ! class location(aetools.NProperty): """location - the file of the document """ which = 'FILE' want = 'fss ' ! class window(aetools.NProperty): """window - the window of the document. """ which = 'cwin' --- 262,278 ---- """document - a document """ want = 'docu' ! class _Prop_file_permissions(aetools.NProperty): """file permissions - the file permissions for the document """ which = 'PERM' want = 'PERM' ! class _Prop_kind(aetools.NProperty): """kind - the kind of document """ which = 'DKND' want = 'DKND' ! class _Prop_location(aetools.NProperty): """location - the file of the document """ which = 'FILE' want = 'fss ' ! class _Prop_window(aetools.NProperty): """window - the window of the document. """ which = 'cwin' *************** *** 288,292 **** application._superclassnames = [] application._privpropdict = { ! 'user_interaction' : user_interaction, } application._privelemdict = { --- 288,292 ---- application._superclassnames = [] application._privpropdict = { ! 'user_interaction' : _Prop_user_interaction, } application._privelemdict = { *************** *** 296,301 **** character._superclassnames = [] character._privpropdict = { ! 'length' : length, ! 'offset' : offset, } character._privelemdict = { --- 296,301 ---- character._superclassnames = [] character._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } character._privelemdict = { *************** *** 303,308 **** insertion_point._superclassnames = [] insertion_point._privpropdict = { ! 'length' : length, ! 'offset' : offset, } insertion_point._privelemdict = { --- 303,308 ---- insertion_point._superclassnames = [] insertion_point._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } insertion_point._privelemdict = { *************** *** 310,316 **** line._superclassnames = [] line._privpropdict = { ! 'index' : index, ! 'length' : length, ! 'offset' : offset, } line._privelemdict = { --- 310,316 ---- line._superclassnames = [] line._privpropdict = { ! 'index' : _Prop_index, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } line._privelemdict = { *************** *** 319,325 **** selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : contents, ! 'length' : length, ! 'offset' : offset, } selection_2d_object._privelemdict = { --- 319,325 ---- selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : _Prop_contents, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } selection_2d_object._privelemdict = { *************** *** 330,335 **** text._superclassnames = [] text._privpropdict = { ! 'length' : length, ! 'offset' : offset, } text._privelemdict = { --- 330,335 ---- text._superclassnames = [] text._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } text._privelemdict = { *************** *** 341,351 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : bounds, ! 'document' : document, ! 'index' : index, ! 'name' : name, ! 'position' : position, ! 'visible' : visible, ! 'zoomed' : zoomed, } window._privelemdict = { --- 341,351 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'document' : _Prop_document, ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'visible' : _Prop_visible, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 353,362 **** document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : file_permissions, ! 'index' : index, ! 'kind' : kind, ! 'location' : location, ! 'name' : name, ! 'window' : window, } document._privelemdict = { --- 353,362 ---- document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : _Prop_file_permissions, ! 'index' : _Prop_index, ! 'kind' : _Prop_kind, ! 'location' : _Prop_location, ! 'name' : _Prop_name, ! 'window' : _Prop_window, } document._privelemdict = { *************** *** 381,407 **** 'docu' : document, 'file' : files, - } - - _propdeclarations = { - 'DKND' : kind, - 'FILE' : location, - 'PERM' : file_permissions, - 'cwin' : window, - 'docu' : document, - 'inte' : user_interaction, - 'pLen' : length, - 'pOff' : offset, - 'pbnd' : bounds, - 'pcnt' : contents, - 'pidx' : index, - 'pnam' : name, - 'ppos' : position, - 'pvis' : visible, - 'pzum' : zoomed, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 381,383 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 30 Mar 2003 22:41:47 -0000 1.6 --- __init__.py 1 Apr 2003 22:04:29 -0000 1.7 *************** *** 48,51 **** --- 48,60 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) getbaseclasses(single_class_browser) getbaseclasses(project_document) *************** *** 101,113 **** getbaseclasses(Debugger_Display) getbaseclasses(class_) - getbaseclasses(character) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) # --- 110,113 ---- *************** *** 115,118 **** --- 115,127 ---- # _classdeclarations = { + 'cha ' : character, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'clin' : line, + 'csel' : selection_2d_object, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, '1BRW' : single_class_browser, 'PRJD' : project_document, *************** *** 168,180 **** 'DbDS' : Debugger_Display, 'Clas' : class_, - 'cha ' : character, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'clin' : line, - 'csel' : selection_2d_object, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, } --- 177,180 ---- From jackjansen@users.sourceforge.net Tue Apr 1 22:05:40 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:40 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.5,1.6 Macintosh_Connectivity_Clas.py,1.5,1.6 QuickDraw_Graphics_Suite.py,1.5,1.6 QuickDraw_Graphics_Suppleme.py,1.4,1.5 Required_Suite.py,1.2,1.3 Standard_Suite.py,1.5,1.6 Table_Suite.py,1.4,1.5 Text_Suite.py,1.4,1.5 Type_Names_Suite.py,1.5,1.6 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv20940/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Required_Suite.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AppleScript_Suite.py 30 Mar 2003 22:41:49 -0000 1.5 --- AppleScript_Suite.py 1 Apr 2003 22:04:49 -0000 1.6 *************** *** 792,844 **** """application - specifies global properties of AppleScript """ want = 'capp' ! class AppleScript(aetools.NProperty): """AppleScript - the top-level script object """ which = 'ascr' want = 'scpt' ! class days(aetools.NProperty): """days - the number of seconds in a day """ which = 'days' want = 'long' ! class hours(aetools.NProperty): """hours - the number of seconds in an hour """ which = 'hour' want = 'long' ! class minutes(aetools.NProperty): """minutes - the number of seconds in a minute """ which = 'min ' want = 'long' ! class pi(aetools.NProperty): """pi - the constant pi """ which = 'pi ' want = 'doub' ! class print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' ! class print_length(aetools.NProperty): """print length - the maximum length to print """ which = 'prln' want = 'long' ! class result(aetools.NProperty): """result - the last result of evaluation """ which = 'rslt' want = '****' ! class return_(aetools.NProperty): """return - a return character """ which = 'ret ' want = 'cha ' ! class space(aetools.NProperty): """space - a space character """ which = 'spac' want = 'cha ' ! class tab(aetools.NProperty): """tab - a tab character """ which = 'tab ' want = 'cha ' ! class text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' ! class weeks(aetools.NProperty): """weeks - the number of seconds in a week """ which = 'week' --- 792,844 ---- """application - specifies global properties of AppleScript """ want = 'capp' ! class _Prop_AppleScript(aetools.NProperty): """AppleScript - the top-level script object """ which = 'ascr' want = 'scpt' ! class _Prop_days(aetools.NProperty): """days - the number of seconds in a day """ which = 'days' want = 'long' ! class _Prop_hours(aetools.NProperty): """hours - the number of seconds in an hour """ which = 'hour' want = 'long' ! class _Prop_minutes(aetools.NProperty): """minutes - the number of seconds in a minute """ which = 'min ' want = 'long' ! class _Prop_pi(aetools.NProperty): """pi - the constant pi """ which = 'pi ' want = 'doub' ! class _Prop_print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' ! class _Prop_print_length(aetools.NProperty): """print length - the maximum length to print """ which = 'prln' want = 'long' ! class _Prop_result(aetools.NProperty): """result - the last result of evaluation """ which = 'rslt' want = '****' ! class _Prop_return_(aetools.NProperty): """return - a return character """ which = 'ret ' want = 'cha ' ! class _Prop_space(aetools.NProperty): """space - a space character """ which = 'spac' want = 'cha ' ! class _Prop_tab(aetools.NProperty): """tab - a tab character """ which = 'tab ' want = 'cha ' ! class _Prop_text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' ! class _Prop_weeks(aetools.NProperty): """weeks - the number of seconds in a week """ which = 'week' *************** *** 872,880 **** """writing code info - script code and language code of text run """ want = 'citl' ! class language_code(aetools.NProperty): """language code - the language code for the text """ which = 'plcd' want = 'shor' ! class script_code(aetools.NProperty): """script code - the script code for the text """ which = 'pscd' --- 872,880 ---- """writing code info - script code and language code of text run """ want = 'citl' ! class _Prop_language_code(aetools.NProperty): """language code - the language code for the text """ which = 'plcd' want = 'shor' ! class _Prop_script_code(aetools.NProperty): """script code - the script code for the text """ which = 'pscd' *************** *** 904,908 **** """item - An item of any type """ want = 'cobj' ! class id(aetools.NProperty): """id - the unique ID number of this object """ which = 'ID ' --- 904,908 ---- """item - An item of any type """ want = 'cobj' ! class _Prop_id(aetools.NProperty): """id - the unique ID number of this object """ which = 'ID ' *************** *** 1042,1054 **** """keystroke - a press of a key combination on a Macintosh keyboard """ want = 'kprs' ! class key(aetools.NProperty): """key - the character for the key was pressed (ignoring modifiers) """ which = 'kMsg' want = 'cha ' ! class key_kind(aetools.NProperty): """key kind - the kind of key that was pressed """ which = 'kknd' want = 'ekst' ! class modifiers(aetools.NProperty): """modifiers - the modifier keys pressed in combination """ which = 'kMod' --- 1042,1054 ---- """keystroke - a press of a key combination on a Macintosh keyboard """ want = 'kprs' ! class _Prop_key(aetools.NProperty): """key - the character for the key was pressed (ignoring modifiers) """ which = 'kMsg' want = 'cha ' ! class _Prop_key_kind(aetools.NProperty): """key kind - the kind of key that was pressed """ which = 'kknd' want = 'ekst' ! class _Prop_modifiers(aetools.NProperty): """modifiers - the modifier keys pressed in combination """ which = 'kMod' *************** *** 1064,1092 **** """date - Absolute date and time values """ want = 'ldt ' ! class date_string(aetools.NProperty): """date string - the date portion of a date-time value as text """ which = 'dstr' want = 'TEXT' ! class day(aetools.NProperty): """day - the day of the month of a date """ which = 'day ' want = 'long' ! class month(aetools.NProperty): """month - the month of a date """ which = 'mnth' want = 'mnth' ! class time(aetools.NProperty): """time - the time since midnight of a date """ which = 'time' want = 'long' ! class time_string(aetools.NProperty): """time string - the time portion of a date-time value as text """ which = 'tstr' want = 'TEXT' ! class weekday(aetools.NProperty): """weekday - the day of a week of a date """ which = 'wkdy' want = 'wkdy' ! class year(aetools.NProperty): """year - the year of a date """ which = 'year' --- 1064,1092 ---- """date - Absolute date and time values """ want = 'ldt ' ! class _Prop_date_string(aetools.NProperty): """date string - the date portion of a date-time value as text """ which = 'dstr' want = 'TEXT' ! class _Prop_day(aetools.NProperty): """day - the day of the month of a date """ which = 'day ' want = 'long' ! class _Prop_month(aetools.NProperty): """month - the month of a date """ which = 'mnth' want = 'mnth' ! class _Prop_time(aetools.NProperty): """time - the time since midnight of a date """ which = 'time' want = 'long' ! class _Prop_time_string(aetools.NProperty): """time string - the time portion of a date-time value as text """ which = 'tstr' want = 'TEXT' ! class _Prop_weekday(aetools.NProperty): """weekday - the day of a week of a date """ which = 'wkdy' want = 'wkdy' ! class _Prop_year(aetools.NProperty): """year - the year of a date """ which = 'year' *************** *** 1098,1110 **** """list - An ordered collection of items """ want = 'list' ! class length(aetools.NProperty): """length - the length of a list """ which = 'leng' want = 'long' ! class rest(aetools.NProperty): """rest - all items of the list excluding first """ which = 'rest' want = 'list' ! class reverse(aetools.NProperty): """reverse - the items of the list in reverse order """ which = 'rvse' --- 1098,1110 ---- """list - An ordered collection of items """ want = 'list' ! class _Prop_length(aetools.NProperty): """length - the length of a list """ which = 'leng' want = 'long' ! class _Prop_rest(aetools.NProperty): """rest - all items of the list excluding first """ which = 'rest' want = 'list' ! class _Prop_reverse(aetools.NProperty): """reverse - the items of the list in reverse order """ which = 'rvse' *************** *** 1222,1226 **** """class - the type of a value """ want = 'pcls' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' --- 1222,1226 ---- """class - the type of a value """ want = 'pcls' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' *************** *** 1276,1284 **** """script - An AppleScript script """ want = 'scpt' ! class name(aetools.NProperty): """name - the name of the script """ which = 'pnam' want = 'TEXT' ! class parent(aetools.NProperty): """parent - its parent, i.e. the script that will handle events that this script doesn\xd5t """ which = 'pare' --- 1276,1284 ---- """script - An AppleScript script """ want = 'scpt' ! class _Prop_name(aetools.NProperty): """name - the name of the script """ which = 'pnam' want = 'TEXT' ! class _Prop_parent(aetools.NProperty): """parent - its parent, i.e. the script that will handle events that this script doesn\xd5t """ which = 'pare' *************** *** 1444,1460 **** application._superclassnames = [] application._privpropdict = { ! 'AppleScript' : AppleScript, ! 'days' : days, ! 'hours' : hours, ! 'minutes' : minutes, ! 'pi' : pi, ! 'print_depth' : print_depth, ! 'print_length' : print_length, ! 'result' : result, ! 'return_' : return_, ! 'space' : space, ! 'tab' : tab, ! 'text_item_delimiters' : text_item_delimiters, ! 'weeks' : weeks, } application._privelemdict = { --- 1444,1460 ---- application._superclassnames = [] application._privpropdict = { ! 'AppleScript' : _Prop_AppleScript, ! 'days' : _Prop_days, ! 'hours' : _Prop_hours, ! 'minutes' : _Prop_minutes, ! 'pi' : _Prop_pi, ! 'print_depth' : _Prop_print_depth, ! 'print_length' : _Prop_print_length, ! 'result' : _Prop_result, ! 'return_' : _Prop_return_, ! 'space' : _Prop_space, ! 'tab' : _Prop_tab, ! 'text_item_delimiters' : _Prop_text_item_delimiters, ! 'weeks' : _Prop_weeks, } application._privelemdict = { *************** *** 1482,1487 **** writing_code_info._superclassnames = [] writing_code_info._privpropdict = { ! 'language_code' : language_code, ! 'script_code' : script_code, } writing_code_info._privelemdict = { --- 1482,1487 ---- writing_code_info._superclassnames = [] writing_code_info._privpropdict = { ! 'language_code' : _Prop_language_code, ! 'script_code' : _Prop_script_code, } writing_code_info._privelemdict = { *************** *** 1504,1508 **** item._superclassnames = [] item._privpropdict = { ! 'id' : id, } item._privelemdict = { --- 1504,1508 ---- item._superclassnames = [] item._privpropdict = { ! 'id' : _Prop_id, } item._privelemdict = { *************** *** 1650,1656 **** keystroke._superclassnames = [] keystroke._privpropdict = { ! 'key' : key, ! 'key_kind' : key_kind, ! 'modifiers' : modifiers, } keystroke._privelemdict = { --- 1650,1656 ---- keystroke._superclassnames = [] keystroke._privpropdict = { ! 'key' : _Prop_key, ! 'key_kind' : _Prop_key_kind, ! 'modifiers' : _Prop_modifiers, } keystroke._privelemdict = { *************** *** 1663,1673 **** date._superclassnames = [] date._privpropdict = { ! 'date_string' : date_string, ! 'day' : day, ! 'month' : month, ! 'time' : time, ! 'time_string' : time_string, ! 'weekday' : weekday, ! 'year' : year, } date._privelemdict = { --- 1663,1673 ---- date._superclassnames = [] date._privpropdict = { ! 'date_string' : _Prop_date_string, ! 'day' : _Prop_day, ! 'month' : _Prop_month, ! 'time' : _Prop_time, ! 'time_string' : _Prop_time_string, ! 'weekday' : _Prop_weekday, ! 'year' : _Prop_year, } date._privelemdict = { *************** *** 1675,1681 **** list._superclassnames = [] list._privpropdict = { ! 'length' : length, ! 'rest' : rest, ! 'reverse' : reverse, } list._privelemdict = { --- 1675,1681 ---- list._superclassnames = [] list._privpropdict = { ! 'length' : _Prop_length, ! 'rest' : _Prop_rest, ! 'reverse' : _Prop_reverse, } list._privelemdict = { *************** *** 1688,1692 **** linked_list._superclassnames = [] linked_list._privpropdict = { ! 'length' : length, } linked_list._privelemdict = { --- 1688,1692 ---- linked_list._superclassnames = [] linked_list._privpropdict = { ! 'length' : _Prop_length, } linked_list._privelemdict = { *************** *** 1794,1798 **** class_._superclassnames = ['type_class'] class_._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } class_._privelemdict = { --- 1794,1798 ---- class_._superclassnames = ['type_class'] class_._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } class_._privelemdict = { *************** *** 1845,1850 **** script._superclassnames = [] script._privpropdict = { ! 'name' : name, ! 'parent' : parent, } script._privelemdict = { --- 1845,1850 ---- script._superclassnames = [] script._privpropdict = { ! 'name' : _Prop_name, ! 'parent' : _Prop_parent, } script._privelemdict = { *************** *** 1947,1951 **** vector._superclassnames = [] vector._privpropdict = { ! 'length' : length, } vector._privelemdict = { --- 1947,1951 ---- vector._superclassnames = [] vector._privpropdict = { ! 'length' : _Prop_length, } vector._privelemdict = { *************** *** 2147,2195 **** 'yard' : yards, 'zone' : zones, - } - - _propdeclarations = { - 'ID ' : id, - 'ascr' : AppleScript, - 'c@#^' : _3c_Inheritance_3e_, - 'day ' : day, - 'days' : days, - 'dstr' : date_string, - 'hour' : hours, - 'kMod' : modifiers, - 'kMsg' : key, - 'kknd' : key_kind, - 'leng' : length, - 'min ' : minutes, - 'mnth' : month, - 'pare' : parent, - 'pi ' : pi, - 'plcd' : language_code, - 'pnam' : name, - 'prdp' : print_depth, - 'prln' : print_length, - 'pscd' : script_code, - 'rest' : rest, - 'ret ' : return_, - 'rslt' : result, - 'rvse' : reverse, - 'spac' : space, - 'tab ' : tab, - 'time' : time, - 'tstr' : time_string, - 'txdl' : text_item_delimiters, - 'week' : weeks, - 'wkdy' : weekday, - 'year' : year, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'boov' : _Enum_boov, - 'cons' : _Enum_cons, - 'eMds' : _Enum_eMds, - 'ekst' : _Enum_ekst, - 'misc' : _Enum_misc, } --- 2147,2149 ---- Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Macintosh_Connectivity_Clas.py 30 Mar 2003 22:41:50 -0000 1.5 --- Macintosh_Connectivity_Clas.py 1 Apr 2003 22:04:52 -0000 1.6 *************** *** 19,27 **** """ADB address - Addresses a device connected via Apple Desktop Bus """ want = 'cadb' ! class _3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'cadr' ! class ID(aetools.NProperty): """ID - the Apple Desktop Bus device ID """ which = 'ID ' --- 19,27 ---- """ADB address - Addresses a device connected via Apple Desktop Bus """ want = 'cadb' ! class _Prop__3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'cadr' ! class _Prop_ID(aetools.NProperty): """ID - the Apple Desktop Bus device ID """ which = 'ID ' *************** *** 33,45 **** """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' ! class conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ which = 'pcon' want = 'econ' ! class properties(aetools.NProperty): """properties - property that allows getting and setting of multiple properties """ which = 'pALL' want = 'reco' ! class protocol(aetools.NProperty): """protocol - How to talk to this addressee """ which = 'pprt' --- 33,45 ---- """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' ! class _Prop_conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ which = 'pcon' want = 'econ' ! class _Prop_properties(aetools.NProperty): """properties - property that allows getting and setting of multiple properties """ which = 'pALL' want = 'reco' ! class _Prop_protocol(aetools.NProperty): """protocol - How to talk to this addressee """ which = 'pprt' *************** *** 51,63 **** """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ want = 'cat ' ! class AppleTalk_machine(aetools.NProperty): """AppleTalk machine - the machine name part of the address """ which = 'patm' want = 'TEXT' ! class AppleTalk_type(aetools.NProperty): """AppleTalk type - the type part of the AppleTalk address """ which = 'patt' want = 'TEXT' ! class AppleTalk_zone(aetools.NProperty): """AppleTalk zone - the zone part of the address """ which = 'patz' --- 51,63 ---- """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ want = 'cat ' ! class _Prop_AppleTalk_machine(aetools.NProperty): """AppleTalk machine - the machine name part of the address """ which = 'patm' want = 'TEXT' ! class _Prop_AppleTalk_type(aetools.NProperty): """AppleTalk type - the type part of the AppleTalk address """ which = 'patt' want = 'TEXT' ! class _Prop_AppleTalk_zone(aetools.NProperty): """AppleTalk zone - the zone part of the address """ which = 'patz' *************** *** 75,83 **** """device specification - A device connected to a computer """ want = 'cdev' ! class device_address(aetools.NProperty): """device address - the address of the device """ which = 'pdva' want = 'cadr' ! class device_type(aetools.NProperty): """device type - the kind of device """ which = 'pdvt' --- 75,83 ---- """device specification - A device connected to a computer """ want = 'cdev' ! class _Prop_device_address(aetools.NProperty): """device address - the address of the device """ which = 'pdva' want = 'cadr' ! class _Prop_device_type(aetools.NProperty): """device type - the kind of device """ which = 'pdvt' *************** *** 101,109 **** """IP address - Addresses a device or service via the Internet Protocol (IP) """ want = 'cip ' ! class DNS_form(aetools.NProperty): """DNS form - the address in the form "apple.com" """ which = 'pdns' want = 'TEXT' ! class port(aetools.NProperty): """port - the port number of the service or client being addressed """ which = 'ppor' --- 101,109 ---- """IP address - Addresses a device or service via the Internet Protocol (IP) """ want = 'cip ' ! class _Prop_DNS_form(aetools.NProperty): """DNS form - the address in the form "apple.com" """ which = 'pdns' want = 'TEXT' ! class _Prop_port(aetools.NProperty): """port - the port number of the service or client being addressed """ which = 'ppor' *************** *** 115,127 **** """LocalTalk address - Addresses a device by its LocalTalk address """ want = 'clt ' ! class network(aetools.NProperty): """network - the LocalTalk network number """ which = 'pnet' want = 'shor' ! class node(aetools.NProperty): """node - the LocalTalk node number """ which = 'pnod' want = 'shor' ! class socket(aetools.NProperty): """socket - the LocalTalk socket number """ which = 'psoc' --- 115,127 ---- """LocalTalk address - Addresses a device by its LocalTalk address """ want = 'clt ' ! class _Prop_network(aetools.NProperty): """network - the LocalTalk network number """ which = 'pnet' want = 'shor' ! class _Prop_node(aetools.NProperty): """node - the LocalTalk node number """ which = 'pnod' want = 'shor' ! class _Prop_socket(aetools.NProperty): """socket - the LocalTalk socket number """ which = 'psoc' *************** *** 133,141 **** """SCSI address - Addresses a SCSI device """ want = 'cscs' ! class LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ which = 'pslu' want = 'shor' ! class SCSI_bus(aetools.NProperty): """SCSI bus - the SCSI bus number """ which = 'pscb' --- 133,141 ---- """SCSI address - Addresses a SCSI device """ want = 'cscs' ! class _Prop_LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ which = 'pslu' want = 'shor' ! class _Prop_SCSI_bus(aetools.NProperty): """SCSI bus - the SCSI bus number """ which = 'pscb' *************** *** 153,157 **** """USB address - Addresses a device on the Universal Serial Bus """ want = 'cusb' ! class name(aetools.NProperty): """name - the USB device name """ which = 'pnam' --- 153,157 ---- """USB address - Addresses a device on the Universal Serial Bus """ want = 'cusb' ! class _Prop_name(aetools.NProperty): """name - the USB device name """ which = 'pnam' *************** *** 161,166 **** ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ADB_address._privelemdict = { --- 161,166 ---- ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } ADB_address._privelemdict = { *************** *** 168,174 **** address_specification._superclassnames = [] address_specification._privpropdict = { ! 'conduit' : conduit, ! 'properties' : properties, ! 'protocol' : protocol, } address_specification._privelemdict = { --- 168,174 ---- address_specification._superclassnames = [] address_specification._privpropdict = { ! 'conduit' : _Prop_conduit, ! 'properties' : _Prop_properties, ! 'protocol' : _Prop_protocol, } address_specification._privelemdict = { *************** *** 176,183 **** AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { ! 'AppleTalk_machine' : AppleTalk_machine, ! 'AppleTalk_type' : AppleTalk_type, ! 'AppleTalk_zone' : AppleTalk_zone, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } AppleTalk_address._privelemdict = { --- 176,183 ---- AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { ! 'AppleTalk_machine' : _Prop_AppleTalk_machine, ! 'AppleTalk_type' : _Prop_AppleTalk_type, ! 'AppleTalk_zone' : _Prop_AppleTalk_zone, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } AppleTalk_address._privelemdict = { *************** *** 185,190 **** bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } bus_slot._privelemdict = { --- 185,190 ---- bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } bus_slot._privelemdict = { *************** *** 192,198 **** device_specification._superclassnames = [] device_specification._privpropdict = { ! 'device_address' : device_address, ! 'device_type' : device_type, ! 'properties' : properties, } device_specification._privelemdict = { --- 192,198 ---- device_specification._superclassnames = [] device_specification._privpropdict = { ! 'device_address' : _Prop_device_address, ! 'device_type' : _Prop_device_type, ! 'properties' : _Prop_properties, } device_specification._privelemdict = { *************** *** 200,205 **** Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } Ethernet_address._privelemdict = { --- 200,205 ---- Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Ethernet_address._privelemdict = { *************** *** 207,212 **** FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } FireWire_address._privelemdict = { --- 207,212 ---- FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } FireWire_address._privelemdict = { *************** *** 214,221 **** IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { ! 'DNS_form' : DNS_form, ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'port' : port, } IP_address._privelemdict = { --- 214,221 ---- IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { ! 'DNS_form' : _Prop_DNS_form, ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'port' : _Prop_port, } IP_address._privelemdict = { *************** *** 223,230 **** LocalTalk_address._superclassnames = ['address_specification'] LocalTalk_address._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'network' : network, ! 'node' : node, ! 'socket' : socket, } LocalTalk_address._privelemdict = { --- 223,230 ---- LocalTalk_address._superclassnames = ['address_specification'] LocalTalk_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'network' : _Prop_network, ! 'node' : _Prop_node, ! 'socket' : _Prop_socket, } LocalTalk_address._privelemdict = { *************** *** 232,239 **** SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { ! 'ID' : ID, ! 'LUN' : LUN, ! 'SCSI_bus' : SCSI_bus, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } SCSI_address._privelemdict = { --- 232,239 ---- SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { ! 'ID' : _Prop_ID, ! 'LUN' : _Prop_LUN, ! 'SCSI_bus' : _Prop_SCSI_bus, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } SCSI_address._privelemdict = { *************** *** 241,246 **** Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } Token_Ring_address._privelemdict = { --- 241,246 ---- Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Token_Ring_address._privelemdict = { *************** *** 248,253 **** USB_address._superclassnames = ['address_specification'] USB_address._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'name' : name, } USB_address._privelemdict = { --- 248,253 ---- USB_address._superclassnames = ['address_specification'] USB_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } USB_address._privelemdict = { *************** *** 341,373 **** 'ctok' : Token_Ring_address, 'cusb' : USB_address, - } - - _propdeclarations = { - 'ID ' : ID, - 'c@#^' : _3c_inheritance_3e_, - 'pALL' : properties, - 'patm' : AppleTalk_machine, - 'patt' : AppleTalk_type, - 'patz' : AppleTalk_zone, - 'pcon' : conduit, - 'pdns' : DNS_form, - 'pdva' : device_address, - 'pdvt' : device_type, - 'pnam' : name, - 'pnet' : network, - 'pnod' : node, - 'ppor' : port, - 'pprt' : protocol, - 'pscb' : SCSI_bus, - 'pslu' : LUN, - 'psoc' : socket, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'econ' : _Enum_econ, - 'edvt' : _Enum_edvt, - 'epro' : _Enum_epro, } --- 341,343 ---- Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QuickDraw_Graphics_Suite.py 30 Mar 2003 22:41:50 -0000 1.5 --- QuickDraw_Graphics_Suite.py 1 Apr 2003 22:04:52 -0000 1.6 *************** *** 19,59 **** """arc - An arc """ want = 'carc' ! class arc_angle(aetools.NProperty): """arc angle - the angle of the arc in degrees """ which = 'parc' want = 'fixd' ! class bounds(aetools.NProperty): """bounds - the smallest rectangle that contains the entire arc """ which = 'pbnd' want = 'qdrt' ! class definition_rect(aetools.NProperty): """definition rect - the rectangle that contains the circle or oval used to define the arc """ which = 'pdrt' want = 'qdrt' ! class fill_color(aetools.NProperty): """fill color - the fill color """ which = 'flcl' want = 'cRGB' ! class fill_pattern(aetools.NProperty): """fill pattern - the fill pattern """ which = 'flpt' want = 'cpix' ! class pen_color(aetools.NProperty): """pen color - the pen color """ which = 'ppcl' want = 'cRGB' ! class pen_pattern(aetools.NProperty): """pen pattern - the pen pattern """ which = 'pppa' want = 'cpix' ! class pen_width(aetools.NProperty): """pen width - the pen width """ which = 'ppwd' want = 'shor' ! class start_angle(aetools.NProperty): """start angle - the angle that defines the start of the arc, in degrees """ which = 'pang' want = 'fixd' ! class transfer_mode(aetools.NProperty): """transfer mode - the transfer mode """ which = 'pptm' --- 19,59 ---- """arc - An arc """ want = 'carc' ! class _Prop_arc_angle(aetools.NProperty): """arc angle - the angle of the arc in degrees """ which = 'parc' want = 'fixd' ! class _Prop_bounds(aetools.NProperty): """bounds - the smallest rectangle that contains the entire arc """ which = 'pbnd' want = 'qdrt' ! class _Prop_definition_rect(aetools.NProperty): """definition rect - the rectangle that contains the circle or oval used to define the arc """ which = 'pdrt' want = 'qdrt' ! class _Prop_fill_color(aetools.NProperty): """fill color - the fill color """ which = 'flcl' want = 'cRGB' ! class _Prop_fill_pattern(aetools.NProperty): """fill pattern - the fill pattern """ which = 'flpt' want = 'cpix' ! class _Prop_pen_color(aetools.NProperty): """pen color - the pen color """ which = 'ppcl' want = 'cRGB' ! class _Prop_pen_pattern(aetools.NProperty): """pen pattern - the pen pattern """ which = 'pppa' want = 'cpix' ! class _Prop_pen_width(aetools.NProperty): """pen width - the pen width """ which = 'ppwd' want = 'shor' ! class _Prop_start_angle(aetools.NProperty): """start angle - the angle that defines the start of the arc, in degrees """ which = 'pang' want = 'fixd' ! class _Prop_transfer_mode(aetools.NProperty): """transfer mode - the transfer mode """ which = 'pptm' *************** *** 65,117 **** """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class background_color(aetools.NProperty): """background color - the color used to fill in unoccupied areas """ which = 'pbcl' want = 'cRGB' ! class background_pattern(aetools.NProperty): """background pattern - the pattern used to fill in unoccupied areas """ which = 'pbpt' want = 'cpix' ! class color_table(aetools.NProperty): """color table - the color table """ which = 'cltb' want = 'clrt' ! class default_font(aetools.NProperty): """default font - the name of the default font for text objects """ which = 'ptxf' want = 'itxt' ! class default_location(aetools.NProperty): """default location - the default location of each new graphic object """ which = 'pnel' want = 'QDpt' ! class default_size(aetools.NProperty): """default size - the default size for text objects """ which = 'ptps' want = 'fixd' ! class name(aetools.NProperty): """name - the name """ which = 'pnam' want = 'itxt' ! class ordering(aetools.NProperty): """ordering - the ordered list of graphic objects in the drawing area """ which = 'gobs' want = 'obj ' ! class pixel_depth(aetools.NProperty): """pixel depth - the number of bits per pixel """ which = 'pdpt' want = 'shor' ! class style(aetools.NProperty): """style - the default text style for text objects """ which = 'txst' want = 'tsty' ! class text_color(aetools.NProperty): """text color - the default color for text objects """ which = 'ptxc' want = 'cRGB' ! class update_on_change(aetools.NProperty): """update on change - Redraw after each change? """ which = 'pupd' want = 'bool' ! class writing_code(aetools.NProperty): """writing code - the script system and language of text objects in the drawing area """ which = 'psct' --- 65,117 ---- """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class _Prop_background_color(aetools.NProperty): """background color - the color used to fill in unoccupied areas """ which = 'pbcl' want = 'cRGB' ! class _Prop_background_pattern(aetools.NProperty): """background pattern - the pattern used to fill in unoccupied areas """ which = 'pbpt' want = 'cpix' ! class _Prop_color_table(aetools.NProperty): """color table - the color table """ which = 'cltb' want = 'clrt' ! class _Prop_default_font(aetools.NProperty): """default font - the name of the default font for text objects """ which = 'ptxf' want = 'itxt' ! class _Prop_default_location(aetools.NProperty): """default location - the default location of each new graphic object """ which = 'pnel' want = 'QDpt' ! class _Prop_default_size(aetools.NProperty): """default size - the default size for text objects """ which = 'ptps' want = 'fixd' ! class _Prop_name(aetools.NProperty): """name - the name """ which = 'pnam' want = 'itxt' ! class _Prop_ordering(aetools.NProperty): """ordering - the ordered list of graphic objects in the drawing area """ which = 'gobs' want = 'obj ' ! class _Prop_pixel_depth(aetools.NProperty): """pixel depth - the number of bits per pixel """ which = 'pdpt' want = 'shor' ! class _Prop_style(aetools.NProperty): """style - the default text style for text objects """ which = 'txst' want = 'tsty' ! class _Prop_text_color(aetools.NProperty): """text color - the default color for text objects """ which = 'ptxc' want = 'cRGB' ! class _Prop_update_on_change(aetools.NProperty): """update on change - Redraw after each change? """ which = 'pupd' want = 'bool' ! class _Prop_writing_code(aetools.NProperty): """writing code - the script system and language of text objects in the drawing area """ which = 'psct' *************** *** 135,151 **** """graphic text - A series of characters within a drawing area """ want = 'cgtx' ! class color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' --- 135,151 ---- """graphic text - A series of characters within a drawing area """ want = 'cgtx' ! class _Prop_color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class _Prop_font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class _Prop_size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class _Prop_uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' *************** *** 161,165 **** """polygon - A polygon """ want = 'cpgn' ! class point_list(aetools.NProperty): """point list - the list of points that define the polygon """ which = 'ptlt' --- 161,165 ---- """polygon - A polygon """ want = 'cpgn' ! class _Prop_point_list(aetools.NProperty): """point list - the list of points that define the polygon """ which = 'ptlt' *************** *** 195,203 **** """rounded rectangle - A rounded rectangle """ want = 'crrc' ! class corner_curve_height(aetools.NProperty): """corner curve height - the height of the oval used to define the shape of the rounded corners """ which = 'pchd' want = 'shor' ! class corner_curve_width(aetools.NProperty): """corner curve width - the width of the oval used to define the shape of the rounded corners """ which = 'pcwd' --- 195,203 ---- """rounded rectangle - A rounded rectangle """ want = 'crrc' ! class _Prop_corner_curve_height(aetools.NProperty): """corner curve height - the height of the oval used to define the shape of the rounded corners """ which = 'pchd' want = 'shor' ! class _Prop_corner_curve_width(aetools.NProperty): """corner curve width - the width of the oval used to define the shape of the rounded corners """ which = 'pcwd' *************** *** 209,225 **** """graphic line - A graphic line """ want = 'glin' ! class arrow_style(aetools.NProperty): """arrow style - the arrow style """ which = 'arro' want = 'arro' ! class dash_style(aetools.NProperty): """dash style - the dash style """ which = 'pdst' want = 'tdas' ! class end_point(aetools.NProperty): """end point - the ending point of the line """ which = 'pend' want = 'QDpt' ! class start_point(aetools.NProperty): """start point - the starting point of the line """ which = 'pstp' --- 209,225 ---- """graphic line - A graphic line """ want = 'glin' ! class _Prop_arrow_style(aetools.NProperty): """arrow style - the arrow style """ which = 'arro' want = 'arro' ! class _Prop_dash_style(aetools.NProperty): """dash style - the dash style """ which = 'pdst' want = 'tdas' ! class _Prop_end_point(aetools.NProperty): """end point - the ending point of the line """ which = 'pend' want = 'QDpt' ! class _Prop_start_point(aetools.NProperty): """start point - the starting point of the line """ which = 'pstp' *************** *** 229,242 **** arc._superclassnames = [] arc._privpropdict = { ! 'arc_angle' : arc_angle, ! 'bounds' : bounds, ! 'definition_rect' : definition_rect, ! 'fill_color' : fill_color, ! 'fill_pattern' : fill_pattern, ! 'pen_color' : pen_color, ! 'pen_pattern' : pen_pattern, ! 'pen_width' : pen_width, ! 'start_angle' : start_angle, ! 'transfer_mode' : transfer_mode, } arc._privelemdict = { --- 229,242 ---- arc._superclassnames = [] arc._privpropdict = { ! 'arc_angle' : _Prop_arc_angle, ! 'bounds' : _Prop_bounds, ! 'definition_rect' : _Prop_definition_rect, ! 'fill_color' : _Prop_fill_color, ! 'fill_pattern' : _Prop_fill_pattern, ! 'pen_color' : _Prop_pen_color, ! 'pen_pattern' : _Prop_pen_pattern, ! 'pen_width' : _Prop_pen_width, ! 'start_angle' : _Prop_start_angle, ! 'transfer_mode' : _Prop_transfer_mode, } arc._privelemdict = { *************** *** 244,260 **** drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'background_color' : background_color, ! 'background_pattern' : background_pattern, ! 'color_table' : color_table, ! 'default_font' : default_font, ! 'default_location' : default_location, ! 'default_size' : default_size, ! 'name' : name, ! 'ordering' : ordering, ! 'pixel_depth' : pixel_depth, ! 'style' : style, ! 'text_color' : text_color, ! 'update_on_change' : update_on_change, ! 'writing_code' : writing_code, } drawing_area._privelemdict = { --- 244,260 ---- drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'background_color' : _Prop_background_color, ! 'background_pattern' : _Prop_background_pattern, ! 'color_table' : _Prop_color_table, ! 'default_font' : _Prop_default_font, ! 'default_location' : _Prop_default_location, ! 'default_size' : _Prop_default_size, ! 'name' : _Prop_name, ! 'ordering' : _Prop_ordering, ! 'pixel_depth' : _Prop_pixel_depth, ! 'style' : _Prop_style, ! 'text_color' : _Prop_text_color, ! 'update_on_change' : _Prop_update_on_change, ! 'writing_code' : _Prop_writing_code, } drawing_area._privelemdict = { *************** *** 272,279 **** graphic_text._superclassnames = [] graphic_text._privpropdict = { ! 'color' : color, ! 'font' : font, ! 'size' : size, ! 'uniform_styles' : uniform_styles, } graphic_text._privelemdict = { --- 272,279 ---- graphic_text._superclassnames = [] graphic_text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'uniform_styles' : _Prop_uniform_styles, } graphic_text._privelemdict = { *************** *** 286,290 **** polygon._superclassnames = [] polygon._privpropdict = { ! 'point_list' : point_list, } polygon._privelemdict = { --- 286,290 ---- polygon._superclassnames = [] polygon._privpropdict = { ! 'point_list' : _Prop_point_list, } polygon._privelemdict = { *************** *** 302,306 **** pixel._superclassnames = [] pixel._privpropdict = { ! 'color' : color, } pixel._privelemdict = { --- 302,306 ---- pixel._superclassnames = [] pixel._privpropdict = { ! 'color' : _Prop_color, } pixel._privelemdict = { *************** *** 313,318 **** rounded_rectangle._superclassnames = [] rounded_rectangle._privpropdict = { ! 'corner_curve_height' : corner_curve_height, ! 'corner_curve_width' : corner_curve_width, } rounded_rectangle._privelemdict = { --- 313,318 ---- rounded_rectangle._superclassnames = [] rounded_rectangle._privpropdict = { ! 'corner_curve_height' : _Prop_corner_curve_height, ! 'corner_curve_width' : _Prop_corner_curve_width, } rounded_rectangle._privelemdict = { *************** *** 320,327 **** graphic_line._superclassnames = [] graphic_line._privpropdict = { ! 'arrow_style' : arrow_style, ! 'dash_style' : dash_style, ! 'end_point' : end_point, ! 'start_point' : start_point, } graphic_line._privelemdict = { --- 320,327 ---- graphic_line._superclassnames = [] graphic_line._privpropdict = { ! 'arrow_style' : _Prop_arrow_style, ! 'dash_style' : _Prop_dash_style, ! 'end_point' : _Prop_end_point, ! 'start_point' : _Prop_start_point, } graphic_line._privelemdict = { *************** *** 370,417 **** 'crrc' : rounded_rectangle, 'glin' : graphic_line, - } - - _propdeclarations = { - 'arro' : arrow_style, - 'cltb' : color_table, - 'colr' : color, - 'flcl' : fill_color, - 'flpt' : fill_pattern, - 'font' : font, - 'gobs' : ordering, - 'pang' : start_angle, - 'parc' : arc_angle, - 'pbcl' : background_color, - 'pbnd' : bounds, - 'pbpt' : background_pattern, - 'pchd' : corner_curve_height, - 'pcwd' : corner_curve_width, - 'pdpt' : pixel_depth, - 'pdrt' : definition_rect, - 'pdst' : dash_style, - 'pend' : end_point, - 'pnam' : name, - 'pnel' : default_location, - 'ppcl' : pen_color, - 'pppa' : pen_pattern, - 'pptm' : transfer_mode, - 'ppwd' : pen_width, - 'psct' : writing_code, - 'pstp' : start_point, - 'ptlt' : point_list, - 'ptps' : default_size, - 'ptsz' : size, - 'ptxc' : text_color, - 'ptxf' : default_font, - 'pupd' : update_on_change, - 'txst' : style, - 'ustl' : uniform_styles, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'arro' : _Enum_arro, - 'tran' : _Enum_tran, } --- 370,372 ---- Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QuickDraw_Graphics_Suppleme.py 30 Mar 2003 22:41:50 -0000 1.4 --- QuickDraw_Graphics_Suppleme.py 1 Apr 2003 22:04:54 -0000 1.5 *************** *** 19,31 **** """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class rotation(aetools.NProperty): """rotation - the default rotation for objects in the drawing area """ which = 'prot' want = 'trot' ! class scale(aetools.NProperty): """scale - the default scaling for objects in the drawing area """ which = 'pscl' want = 'fixd' ! class translation(aetools.NProperty): """translation - the default repositioning for objects in the drawing area """ which = 'ptrs' --- 19,31 ---- """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class _Prop_rotation(aetools.NProperty): """rotation - the default rotation for objects in the drawing area """ which = 'prot' want = 'trot' ! class _Prop_scale(aetools.NProperty): """scale - the default scaling for objects in the drawing area """ which = 'pscl' want = 'fixd' ! class _Prop_translation(aetools.NProperty): """translation - the default repositioning for objects in the drawing area """ which = 'ptrs' *************** *** 41,47 **** drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'rotation' : rotation, ! 'scale' : scale, ! 'translation' : translation, } drawing_area._privelemdict = { --- 41,47 ---- drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'rotation' : _Prop_rotation, ! 'scale' : _Prop_scale, ! 'translation' : _Prop_translation, } drawing_area._privelemdict = { *************** *** 59,73 **** 'cdrw' : drawing_area, 'cpic' : graphic_groups, - } - - _propdeclarations = { - 'prot' : rotation, - 'pscl' : scale, - 'ptrs' : translation, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 59,61 ---- Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Required_Suite.py 1 Apr 2003 22:04:54 -0000 1.3 *************** *** 22,32 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 22,23 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 30 Mar 2003 22:41:50 -0000 1.5 --- Standard_Suite.py 1 Apr 2003 22:04:55 -0000 1.6 *************** *** 458,478 **** """application - An application program """ want = 'capp' ! class clipboard(aetools.NProperty): """clipboard - the contents of the clipboard for this application """ which = 'pcli' want = '****' ! class frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' ! class name(aetools.NProperty): """name - the name of the application """ which = 'pnam' want = 'itxt' ! class selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' ! class version(aetools.NProperty): """version - the version of the application """ which = 'vers' --- 458,478 ---- """application - An application program """ want = 'capp' ! class _Prop_clipboard(aetools.NProperty): """clipboard - the contents of the clipboard for this application """ which = 'pcli' want = '****' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the application """ which = 'pnam' want = 'itxt' ! class _Prop_selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' ! class _Prop_version(aetools.NProperty): """version - the version of the application """ which = 'vers' *************** *** 490,494 **** """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """ want = 'csel' ! class contents(aetools.NProperty): """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """ which = 'pcnt' --- 490,494 ---- """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """ want = 'csel' ! class _Prop_contents(aetools.NProperty): """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """ which = 'pcnt' *************** *** 498,538 **** """window - A window """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Is the window visible? """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' --- 498,538 ---- """window - A window """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class _Prop_floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class _Prop_index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Is the window visible? """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' *************** *** 544,548 **** """document - A document of a scriptable application """ want = 'docu' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' --- 544,548 ---- """document - A document of a scriptable application """ want = 'docu' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' *************** *** 554,558 **** """file - a file on a disk or server """ want = 'file' ! class stationery(aetools.NProperty): """stationery - Is the file a stationery file? """ which = 'pspd' --- 554,558 ---- """file - a file on a disk or server """ want = 'file' ! class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery file? """ which = 'pspd' *************** *** 567,575 **** application._superclassnames = [] application._privpropdict = { ! 'clipboard' : clipboard, ! 'frontmost' : frontmost, ! 'name' : name, ! 'selection' : selection, ! 'version' : version, } application._privelemdict = { --- 567,575 ---- application._superclassnames = [] application._privpropdict = { ! 'clipboard' : _Prop_clipboard, ! 'frontmost' : _Prop_frontmost, ! 'name' : _Prop_name, ! 'selection' : _Prop_selection, ! 'version' : _Prop_version, } application._privelemdict = { *************** *** 582,586 **** selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : contents, } selection_2d_object._privelemdict = { --- 582,586 ---- selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : _Prop_contents, } selection_2d_object._privelemdict = { *************** *** 588,601 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'floating' : floating, ! 'index' : index, ! 'modal' : modal, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 588,601 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'floating' : _Prop_floating, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 603,607 **** document._superclassnames = [] document._privpropdict = { ! 'modified' : modified, } document._privelemdict = { --- 603,607 ---- document._superclassnames = [] document._privpropdict = { ! 'modified' : _Prop_modified, } document._privelemdict = { *************** *** 609,613 **** file._superclassnames = [] file._privpropdict = { ! 'stationery' : stationery, } file._privelemdict = { --- 609,613 ---- file._superclassnames = [] file._privpropdict = { ! 'stationery' : _Prop_stationery, } file._privelemdict = { *************** *** 671,711 **** 'docu' : document, 'file' : file, - } - - _propdeclarations = { - 'hclb' : closeable, - 'imod' : modified, - 'isfl' : floating, - 'iszm' : zoomable, - 'pbnd' : bounds, - 'pcli' : clipboard, - 'pcnt' : contents, - 'pidx' : index, - 'pisf' : frontmost, - 'pmod' : modal, - 'pnam' : name, - 'prsz' : resizable, - 'pspd' : stationery, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'sele' : selection, - 'vers' : version, - } - - _compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, - } - - _enumdeclarations = { - 'kfrm' : _Enum_kfrm, - 'savo' : _Enum_savo, - 'styl' : _Enum_styl, } --- 671,673 ---- Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Table_Suite.py 30 Mar 2003 22:41:50 -0000 1.4 --- Table_Suite.py 1 Apr 2003 22:04:56 -0000 1.5 *************** *** 19,27 **** """cell - A cell """ want = 'ccel' ! class formula(aetools.NProperty): """formula - the formula of the cell """ which = 'pfor' want = 'ctxt' ! class protection(aetools.NProperty): """protection - Indicates whether value or formula in the cell can be changed """ which = 'ppro' --- 19,27 ---- """cell - A cell """ want = 'ccel' ! class _Prop_formula(aetools.NProperty): """formula - the formula of the cell """ which = 'pfor' want = 'ctxt' ! class _Prop_protection(aetools.NProperty): """protection - Indicates whether value or formula in the cell can be changed """ which = 'ppro' *************** *** 33,37 **** """column - A column """ want = 'ccol' ! class name(aetools.NProperty): """name - the name of the column """ which = 'pnam' --- 33,37 ---- """column - A column """ want = 'ccol' ! class _Prop_name(aetools.NProperty): """name - the name of the column """ which = 'pnam' *************** *** 53,58 **** cell._superclassnames = [] cell._privpropdict = { ! 'formula' : formula, ! 'protection' : protection, } cell._privelemdict = { --- 53,58 ---- cell._superclassnames = [] cell._privpropdict = { ! 'formula' : _Prop_formula, ! 'protection' : _Prop_protection, } cell._privelemdict = { *************** *** 60,64 **** column._superclassnames = [] column._privpropdict = { ! 'name' : name, } column._privelemdict = { --- 60,64 ---- column._superclassnames = [] column._privpropdict = { ! 'name' : _Prop_name, } column._privelemdict = { *************** *** 89,104 **** 'crow' : rows, 'ctbl' : tables, - } - - _propdeclarations = { - 'pfor' : formula, - 'pnam' : name, - 'ppro' : protection, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'prtn' : _Enum_prtn, } --- 89,91 ---- Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Text_Suite.py 30 Mar 2003 22:41:50 -0000 1.4 --- Text_Suite.py 1 Apr 2003 22:04:57 -0000 1.5 *************** *** 19,27 **** """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ want = 'cflo' ! class _3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'ctxt' ! class name(aetools.NProperty): """name - the name """ which = 'pnam' --- 19,27 ---- """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ want = 'cflo' ! class _Prop__3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'ctxt' ! class _Prop_name(aetools.NProperty): """name - the name """ which = 'pnam' *************** *** 37,41 **** """line - A line of text """ want = 'clin' ! class justification(aetools.NProperty): """justification - the justification of the text """ which = 'pjst' --- 37,41 ---- """line - A line of text """ want = 'clin' ! class _Prop_justification(aetools.NProperty): """justification - the justification of the text """ which = 'pjst' *************** *** 53,77 **** """text - Text """ want = 'ctxt' ! class color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class style(aetools.NProperty): """style - the text style of the first character of the first character """ which = 'txst' want = 'tsty' ! class uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' want = 'tsty' ! class writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' --- 53,77 ---- """text - Text """ want = 'ctxt' ! class _Prop_color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class _Prop_font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class _Prop_size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class _Prop_style(aetools.NProperty): """style - the text style of the first character of the first character """ which = 'txst' want = 'tsty' ! class _Prop_uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' want = 'tsty' ! class _Prop_writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' *************** *** 92,100 **** """text style info - On and Off styles of text run """ want = 'tsty' ! class off_styles(aetools.NProperty): """off styles - the styles that are off for the text """ which = 'ofst' want = 'styl' ! class on_styles(aetools.NProperty): """on styles - the styles that are on for the text """ which = 'onst' --- 92,100 ---- """text style info - On and Off styles of text run """ want = 'tsty' ! class _Prop_off_styles(aetools.NProperty): """off styles - the styles that are off for the text """ which = 'ofst' want = 'styl' ! class _Prop_on_styles(aetools.NProperty): """on styles - the styles that are on for the text """ which = 'onst' *************** *** 104,109 **** text_flow._superclassnames = ['text'] text_flow._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'name' : name, } text_flow._privelemdict = { --- 104,109 ---- text_flow._superclassnames = ['text'] text_flow._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } text_flow._privelemdict = { *************** *** 111,115 **** character._superclassnames = ['text'] character._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } character._privelemdict = { --- 111,115 ---- character._superclassnames = ['text'] character._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } character._privelemdict = { *************** *** 117,122 **** line._superclassnames = ['text'] line._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'justification' : justification, } line._privelemdict = { --- 117,122 ---- line._superclassnames = ['text'] line._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'justification' : _Prop_justification, } line._privelemdict = { *************** *** 124,128 **** paragraph._superclassnames = ['text'] paragraph._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } paragraph._privelemdict = { --- 124,128 ---- paragraph._superclassnames = ['text'] paragraph._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } paragraph._privelemdict = { *************** *** 130,139 **** text._superclassnames = [] text._privpropdict = { ! 'color' : color, ! 'font' : font, ! 'size' : size, ! 'style' : style, ! 'uniform_styles' : uniform_styles, ! 'writing_code' : writing_code, } text._privelemdict = { --- 130,139 ---- text._superclassnames = [] text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'uniform_styles' : _Prop_uniform_styles, ! 'writing_code' : _Prop_writing_code, } text._privelemdict = { *************** *** 146,150 **** word._superclassnames = ['text'] word._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } word._privelemdict = { --- 146,150 ---- word._superclassnames = ['text'] word._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } word._privelemdict = { *************** *** 152,157 **** text_style_info._superclassnames = [] text_style_info._privpropdict = { ! 'off_styles' : off_styles, ! 'on_styles' : on_styles, } text_style_info._privelemdict = { --- 152,157 ---- text_style_info._superclassnames = [] text_style_info._privpropdict = { ! 'off_styles' : _Prop_off_styles, ! 'on_styles' : _Prop_on_styles, } text_style_info._privelemdict = { *************** *** 194,218 **** 'cwor' : word, 'tsty' : text_style_info, - } - - _propdeclarations = { - 'c@#^' : _3c_inheritance_3e_, - 'colr' : color, - 'font' : font, - 'ofst' : off_styles, - 'onst' : on_styles, - 'pjst' : justification, - 'pnam' : name, - 'psct' : writing_code, - 'ptsz' : size, - 'txst' : style, - 'ustl' : uniform_styles, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'just' : _Enum_just, - 'styl' : _Enum_styl, } --- 194,196 ---- Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Type_Names_Suite.py 30 Mar 2003 22:41:50 -0000 1.5 --- Type_Names_Suite.py 1 Apr 2003 22:04:57 -0000 1.6 *************** *** 425,435 **** 'vers' : version, } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 425,426 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 29 Mar 2003 00:13:15 -0000 1.5 --- __init__.py 1 Apr 2003 22:04:59 -0000 1.6 *************** *** 174,195 **** getbaseclasses(file_specification) getbaseclasses(text) ! getbaseclasses(graphic_group) ! getbaseclasses(drawing_area) ! getbaseclasses(cell) ! getbaseclasses(column) ! getbaseclasses(table) ! getbaseclasses(row) ! getbaseclasses(AppleTalk_address) ! getbaseclasses(address_specification) ! getbaseclasses(Token_Ring_address) ! getbaseclasses(FireWire_address) ! getbaseclasses(bus_slot) ! getbaseclasses(SCSI_address) ! getbaseclasses(ADB_address) ! getbaseclasses(USB_address) ! getbaseclasses(device_specification) ! getbaseclasses(LocalTalk_address) ! getbaseclasses(IP_address) ! getbaseclasses(Ethernet_address) getbaseclasses(small_integer) getbaseclasses(RGB16_color) --- 174,184 ---- getbaseclasses(file_specification) getbaseclasses(text) ! getbaseclasses(window) ! getbaseclasses(file) ! getbaseclasses(selection_2d_object) ! getbaseclasses(alias) ! getbaseclasses(application) ! getbaseclasses(insertion_point) ! getbaseclasses(document) getbaseclasses(small_integer) getbaseclasses(RGB16_color) *************** *** 239,249 **** getbaseclasses(word) getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(selection_2d_object) - getbaseclasses(alias) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) getbaseclasses(graphic_group) getbaseclasses(oval) --- 228,231 ---- *************** *** 259,262 **** --- 241,262 ---- getbaseclasses(pixel_map) getbaseclasses(rectangle) + getbaseclasses(graphic_group) + getbaseclasses(drawing_area) + getbaseclasses(AppleTalk_address) + getbaseclasses(address_specification) + getbaseclasses(Token_Ring_address) + getbaseclasses(FireWire_address) + getbaseclasses(bus_slot) + getbaseclasses(SCSI_address) + getbaseclasses(ADB_address) + getbaseclasses(USB_address) + getbaseclasses(device_specification) + getbaseclasses(LocalTalk_address) + getbaseclasses(IP_address) + getbaseclasses(Ethernet_address) + getbaseclasses(cell) + getbaseclasses(column) + getbaseclasses(table) + getbaseclasses(row) # *************** *** 369,390 **** 'fss ' : file_specification, 'ctxt' : text, ! 'cpic' : graphic_group, ! 'cdrw' : drawing_area, ! 'ccel' : cell, ! 'ccol' : column, ! 'ctbl' : table, ! 'crow' : row, ! 'cat ' : AppleTalk_address, ! 'cadr' : address_specification, ! 'ctok' : Token_Ring_address, ! 'cfw ' : FireWire_address, ! 'cbus' : bus_slot, ! 'cscs' : SCSI_address, ! 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cen ' : Ethernet_address, 'shor' : small_integer, 'tr16' : RGB16_color, --- 369,379 ---- 'fss ' : file_specification, 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'csel' : selection_2d_object, ! 'alis' : alias, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, 'shor' : small_integer, 'tr16' : RGB16_color, *************** *** 434,444 **** 'cwor' : word, 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'csel' : selection_2d_object, - 'alis' : alias, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, 'cpic' : graphic_group, 'covl' : oval, --- 423,426 ---- *************** *** 454,457 **** --- 436,457 ---- 'cpix' : pixel_map, 'crec' : rectangle, + 'cpic' : graphic_group, + 'cdrw' : drawing_area, + 'cat ' : AppleTalk_address, + 'cadr' : address_specification, + 'ctok' : Token_Ring_address, + 'cfw ' : FireWire_address, + 'cbus' : bus_slot, + 'cscs' : SCSI_address, + 'cadb' : ADB_address, + 'cusb' : USB_address, + 'cdev' : device_specification, + 'clt ' : LocalTalk_address, + 'cip ' : IP_address, + 'cen ' : Ethernet_address, + 'ccel' : cell, + 'ccol' : column, + 'ctbl' : table, + 'crow' : row, } From jackjansen@users.sourceforge.net Tue Apr 1 22:05:49 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:49 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.4,1.5 Netscape_Suite.py,1.3,1.4 Required_Suite.py,1.4,1.5 Standard_Suite.py,1.3,1.4 URL_Suite.py,1.3,1.4 Web_Browser_Suite.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Explorer Modified Files: Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py Standard_Suite.py URL_Suite.py Web_Browser_Suite.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Microsoft_Internet_Explorer.py 29 Mar 2003 00:13:11 -0000 1.4 --- Microsoft_Internet_Explorer.py 1 Apr 2003 22:04:31 -0000 1.5 *************** *** 86,96 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 86,87 ---- Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Netscape_Suite.py 29 Mar 2003 00:13:11 -0000 1.3 --- Netscape_Suite.py 1 Apr 2003 22:04:32 -0000 1.4 *************** *** 39,49 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 39,40 ---- Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required_Suite.py 29 Mar 2003 00:13:11 -0000 1.4 --- Required_Suite.py 1 Apr 2003 22:04:33 -0000 1.5 *************** *** 98,108 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 98,99 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 29 Mar 2003 00:13:11 -0000 1.3 --- Standard_Suite.py 1 Apr 2003 22:04:34 -0000 1.4 *************** *** 43,47 **** """application - An application program """ want = 'capp' ! class selected_text(aetools.NProperty): """selected text - the selected text """ which = 'stxt' --- 43,47 ---- """application - An application program """ want = 'capp' ! class _Prop_selected_text(aetools.NProperty): """selected text - the selected text """ which = 'stxt' *************** *** 49,53 **** application._superclassnames = [] application._privpropdict = { ! 'selected_text' : selected_text, } application._privelemdict = { --- 49,53 ---- application._superclassnames = [] application._privpropdict = { ! 'selected_text' : _Prop_selected_text, } application._privelemdict = { *************** *** 59,71 **** _classdeclarations = { 'capp' : application, - } - - _propdeclarations = { - 'stxt' : selected_text, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 59,61 ---- Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** URL_Suite.py 29 Mar 2003 00:13:12 -0000 1.3 --- URL_Suite.py 1 Apr 2003 22:04:34 -0000 1.4 *************** *** 44,54 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 44,45 ---- Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Web_Browser_Suite.py 29 Mar 2003 00:13:12 -0000 1.4 --- Web_Browser_Suite.py 1 Apr 2003 22:04:34 -0000 1.5 *************** *** 216,226 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 216,217 ---- From jackjansen@users.sourceforge.net Tue Apr 1 22:05:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Standard_Suite.py,1.2,1.3 Terminal_Suite.py,1.5,1.6 Text_Suite.py,1.1,1.2 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Terminal Modified Files: Standard_Suite.py Terminal_Suite.py Text_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 30 Mar 2003 22:41:53 -0000 1.2 --- Standard_Suite.py 1 Apr 2003 22:05:10 -0000 1.3 *************** *** 334,350 **** """application - An application's top level scripting object. """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class version(aetools.NProperty): """version - The version of the application. """ which = 'vers' --- 334,350 ---- """application - An application's top level scripting object. """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' *************** *** 358,366 **** """item - A scriptable object. """ want = 'cobj' ! class class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' --- 358,366 ---- """item - A scriptable object. """ want = 'cobj' ! class _Prop_class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class _Prop_properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' *************** *** 378,434 **** """window - A window. """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' --- 378,434 ---- """window - A window. """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class _Prop_document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class _Prop_floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class _Prop_id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class _Prop_index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class _Prop_miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class _Prop_miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class _Prop_modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class _Prop_resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' *************** *** 440,448 **** """document - A document. """ want = 'docu' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class path(aetools.NProperty): """path - The document's path. """ which = 'ppth' --- 440,448 ---- """document - A document. """ want = 'docu' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class _Prop_path(aetools.NProperty): """path - The document's path. """ which = 'ppth' *************** *** 452,459 **** application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'frontmost' : frontmost, ! 'name' : name, ! 'version' : version, } application._privelemdict = { --- 452,459 ---- application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'frontmost' : _Prop_frontmost, ! 'name' : _Prop_name, ! 'version' : _Prop_version, } application._privelemdict = { *************** *** 463,468 **** item._superclassnames = [] item._privpropdict = { ! 'class_' : class_, ! 'properties' : properties, } item._privelemdict = { --- 463,468 ---- item._superclassnames = [] item._privpropdict = { ! 'class_' : _Prop_class_, ! 'properties' : _Prop_properties, } item._privelemdict = { *************** *** 470,474 **** color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color._privelemdict = { --- 470,474 ---- color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } color._privelemdict = { *************** *** 476,495 **** window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'document' : document, ! 'floating' : floating, ! 'id' : id, ! 'index' : index, ! 'miniaturizable' : miniaturizable, ! 'miniaturized' : miniaturized, ! 'modal' : modal, ! 'name' : name, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 476,495 ---- window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'document' : _Prop_document, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'miniaturizable' : _Prop_miniaturizable, ! 'miniaturized' : _Prop_miniaturized, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 497,504 **** document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'modified' : modified, ! 'name' : name, ! 'path' : path, } document._privelemdict = { --- 497,504 ---- document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'modified' : _Prop_modified, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } document._privelemdict = { *************** *** 536,578 **** 'cwin' : window, 'docu' : document, - } - - _propdeclarations = { - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'docu' : document, - 'hclb' : closeable, - 'imod' : modified, - 'isfl' : floating, - 'ismn' : miniaturizable, - 'iszm' : zoomable, - 'pALL' : properties, - 'pbnd' : bounds, - 'pcls' : class_, - 'pidx' : index, - 'pisf' : frontmost, - 'pmnd' : miniaturized, - 'pmod' : modal, - 'pnam' : name, - 'ppth' : path, - 'prsz' : resizable, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'vers' : version, - } - - _compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, - } - - _enumdeclarations = { - 'savo' : _Enum_savo, } --- 536,538 ---- Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Terminal_Suite.py 29 Mar 2003 00:13:17 -0000 1.5 --- Terminal_Suite.py 1 Apr 2003 22:05:12 -0000 1.6 *************** *** 65,73 **** """application - The Terminal program """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class properties(aetools.NProperty): """properties - every property of the Terminal program """ which = 'pALL' --- 65,73 ---- """application - The Terminal program """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class _Prop_properties(aetools.NProperty): """properties - every property of the Terminal program """ which = 'pALL' *************** *** 81,169 **** """window - A Terminal window """ want = 'cwin' ! class background_color(aetools.NProperty): """background color - the background color for the window """ which = 'pbcl' want = '****' ! class bold_text_color(aetools.NProperty): """bold text color - the bold text color for the window """ which = 'pbtc' want = '****' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' want = '****' ! class busy(aetools.NProperty): """busy - Is the window busy running a process? """ which = 'busy' want = 'bool' ! class contents(aetools.NProperty): """contents - the currently visible contents of the window """ which = 'pcnt' want = 'utxt' ! class cursor_color(aetools.NProperty): """cursor color - the cursor color for the window """ which = 'pcuc' want = '****' ! class custom_title(aetools.NProperty): """custom title - the custom title for the window """ which = 'titl' want = 'utxt' ! class frame(aetools.NProperty): """frame - the origin and size of the window """ which = 'pfra' want = '****' ! class frontmost(aetools.NProperty): """frontmost - Is the window in front of the other Terminal windows? """ which = 'pisf' want = 'bool' ! class history(aetools.NProperty): """history - the contents of the entire scrolling buffer of the window """ which = 'hist' want = 'utxt' ! class normal_text_color(aetools.NProperty): """normal text color - the normal text color for the window """ which = 'ptxc' want = '****' ! class number_of_columns(aetools.NProperty): """number of columns - the number of columns in the window """ which = 'ccol' want = 'long' ! class number_of_rows(aetools.NProperty): """number of rows - the number of rows in the window """ which = 'crow' want = 'long' ! class origin(aetools.NProperty): """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ which = 'pori' want = '****' ! class position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = '****' ! class processes(aetools.NProperty): """processes - a list of the currently running processes """ which = 'prcs' want = 'utxt' ! class size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' want = '****' ! class title_displays_custom_title(aetools.NProperty): """title displays custom title - Does the title for the window contain a custom title? """ which = 'tdct' want = 'bool' ! class title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ which = 'tddn' want = 'bool' ! class title_displays_file_name(aetools.NProperty): """title displays file name - Does the title for the window contain the file name? """ which = 'tdfn' want = 'bool' ! class title_displays_shell_path(aetools.NProperty): """title displays shell path - Does the title for the window contain the shell path? """ which = 'tdsp' want = 'bool' ! class title_displays_window_size(aetools.NProperty): """title displays window size - Does the title for the window contain the window size? """ which = 'tdws' --- 81,169 ---- """window - A Terminal window """ want = 'cwin' ! class _Prop_background_color(aetools.NProperty): """background color - the background color for the window """ which = 'pbcl' want = '****' ! class _Prop_bold_text_color(aetools.NProperty): """bold text color - the bold text color for the window """ which = 'pbtc' want = '****' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' want = '****' ! class _Prop_busy(aetools.NProperty): """busy - Is the window busy running a process? """ which = 'busy' want = 'bool' ! class _Prop_contents(aetools.NProperty): """contents - the currently visible contents of the window """ which = 'pcnt' want = 'utxt' ! class _Prop_cursor_color(aetools.NProperty): """cursor color - the cursor color for the window """ which = 'pcuc' want = '****' ! class _Prop_custom_title(aetools.NProperty): """custom title - the custom title for the window """ which = 'titl' want = 'utxt' ! class _Prop_frame(aetools.NProperty): """frame - the origin and size of the window """ which = 'pfra' want = '****' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the window in front of the other Terminal windows? """ which = 'pisf' want = 'bool' ! class _Prop_history(aetools.NProperty): """history - the contents of the entire scrolling buffer of the window """ which = 'hist' want = 'utxt' ! class _Prop_normal_text_color(aetools.NProperty): """normal text color - the normal text color for the window """ which = 'ptxc' want = '****' ! class _Prop_number_of_columns(aetools.NProperty): """number of columns - the number of columns in the window """ which = 'ccol' want = 'long' ! class _Prop_number_of_rows(aetools.NProperty): """number of rows - the number of rows in the window """ which = 'crow' want = 'long' ! class _Prop_origin(aetools.NProperty): """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ which = 'pori' want = '****' ! class _Prop_position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = '****' ! class _Prop_processes(aetools.NProperty): """processes - a list of the currently running processes """ which = 'prcs' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' want = '****' ! class _Prop_title_displays_custom_title(aetools.NProperty): """title displays custom title - Does the title for the window contain a custom title? """ which = 'tdct' want = 'bool' ! class _Prop_title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ which = 'tddn' want = 'bool' ! class _Prop_title_displays_file_name(aetools.NProperty): """title displays file name - Does the title for the window contain the file name? """ which = 'tdfn' want = 'bool' ! class _Prop_title_displays_shell_path(aetools.NProperty): """title displays shell path - Does the title for the window contain the shell path? """ which = 'tdsp' want = 'bool' ! class _Prop_title_displays_window_size(aetools.NProperty): """title displays window size - Does the title for the window contain the window size? """ which = 'tdws' *************** *** 174,179 **** import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, } application._privelemdict = { --- 174,179 ---- import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } application._privelemdict = { *************** *** 183,210 **** window._superclassnames = [] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'background_color' : background_color, ! 'bold_text_color' : bold_text_color, ! 'bounds' : bounds, ! 'busy' : busy, ! 'contents' : contents, ! 'cursor_color' : cursor_color, ! 'custom_title' : custom_title, ! 'frame' : frame, ! 'frontmost' : frontmost, ! 'history' : history, ! 'normal_text_color' : normal_text_color, ! 'number_of_columns' : number_of_columns, ! 'number_of_rows' : number_of_rows, ! 'origin' : origin, ! 'position' : position, ! 'processes' : processes, ! 'properties' : properties, ! 'size' : size, ! 'title_displays_custom_title' : title_displays_custom_title, ! 'title_displays_device_name' : title_displays_device_name, ! 'title_displays_file_name' : title_displays_file_name, ! 'title_displays_shell_path' : title_displays_shell_path, ! 'title_displays_window_size' : title_displays_window_size, } window._privelemdict = { --- 183,210 ---- window._superclassnames = [] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'background_color' : _Prop_background_color, ! 'bold_text_color' : _Prop_bold_text_color, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'contents' : _Prop_contents, ! 'cursor_color' : _Prop_cursor_color, ! 'custom_title' : _Prop_custom_title, ! 'frame' : _Prop_frame, ! 'frontmost' : _Prop_frontmost, ! 'history' : _Prop_history, ! 'normal_text_color' : _Prop_normal_text_color, ! 'number_of_columns' : _Prop_number_of_columns, ! 'number_of_rows' : _Prop_number_of_rows, ! 'origin' : _Prop_origin, ! 'position' : _Prop_position, ! 'processes' : _Prop_processes, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'title_displays_custom_title' : _Prop_title_displays_custom_title, ! 'title_displays_device_name' : _Prop_title_displays_device_name, ! 'title_displays_file_name' : _Prop_title_displays_file_name, ! 'title_displays_shell_path' : _Prop_title_displays_shell_path, ! 'title_displays_window_size' : _Prop_title_displays_window_size, } window._privelemdict = { *************** *** 217,252 **** 'capp' : application, 'cwin' : window, - } - - _propdeclarations = { - 'busy' : busy, - 'c@#^' : _3c_Inheritance_3e_, - 'ccol' : number_of_columns, - 'crow' : number_of_rows, - 'hist' : history, - 'pALL' : properties, - 'pbcl' : background_color, - 'pbnd' : bounds, - 'pbtc' : bold_text_color, - 'pcnt' : contents, - 'pcuc' : cursor_color, - 'pfra' : frame, - 'pisf' : frontmost, - 'pori' : origin, - 'ppos' : position, - 'prcs' : processes, - 'psiz' : size, - 'ptxc' : normal_text_color, - 'tdct' : title_displays_custom_title, - 'tddn' : title_displays_device_name, - 'tdfn' : title_displays_file_name, - 'tdsp' : title_displays_shell_path, - 'tdws' : title_displays_window_size, - 'titl' : custom_title, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 217,219 ---- Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Text_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text_Suite.py 29 Mar 2003 00:13:17 -0000 1.1 --- Text_Suite.py 1 Apr 2003 22:05:13 -0000 1.2 *************** *** 19,27 **** """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' --- 19,27 ---- """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class _Prop_file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' *************** *** 35,47 **** """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' --- 35,47 ---- """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class _Prop_color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class _Prop_font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' *************** *** 93,98 **** attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'file_name' : file_name, } attachment._privelemdict = { --- 93,98 ---- attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { *************** *** 105,112 **** attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } attribute_run._privelemdict = { --- 105,112 ---- attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { *************** *** 118,125 **** character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } character._privelemdict = { --- 118,125 ---- character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { *************** *** 131,138 **** paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } paragraph._privelemdict = { --- 131,138 ---- paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { *************** *** 144,151 **** text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } text._privelemdict = { --- 144,151 ---- text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { *************** *** 157,164 **** word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } word._privelemdict = { --- 157,164 ---- word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { *************** *** 179,195 **** 'ctxt' : text, 'cwor' : word, - } - - _propdeclarations = { - 'atfn' : file_name, - 'c@#^' : _3c_Inheritance_3e_, - 'colr' : color, - 'font' : font, - 'ptsz' : size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 179,181 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 29 Mar 2003 00:13:17 -0000 1.5 --- __init__.py 1 Apr 2003 22:05:14 -0000 1.6 *************** *** 44,49 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(window) - getbaseclasses(application) getbaseclasses(character) getbaseclasses(attachment) --- 44,47 ---- *************** *** 52,55 **** --- 50,55 ---- getbaseclasses(attribute_run) getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(application) getbaseclasses(color) getbaseclasses(window) *************** *** 62,67 **** # _classdeclarations = { - 'cwin' : window, - 'capp' : application, 'cha ' : character, 'atts' : attachment, --- 62,65 ---- *************** *** 70,73 **** --- 68,73 ---- 'catr' : attribute_run, 'ctxt' : text, + 'cwin' : window, + 'capp' : application, 'colr' : color, 'cwin' : window, From jackjansen@users.sourceforge.net Tue Apr 1 22:05:53 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents Disk_2d_Folder_2d_File_Suite.py,1.1,1.2 Folder_Actions_Suite.py,1.1,1.2 Hidden_Suite.py,1.1,1.2 Login_Items_Suite.py,1.1,1.2 Power_Suite.py,1.1,1.2 Processes_Suite.py,1.1,1.2 Standard_Suite.py,1.1,1.2 System_Events_Suite.py,1.1,1.2 Text_Suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents In directory sc8-pr-cvs1:/tmp/cvs-serv20940/SystemEvents Modified Files: Disk_2d_Folder_2d_File_Suite.py Folder_Actions_Suite.py Hidden_Suite.py Login_Items_Suite.py Power_Suite.py Processes_Suite.py Standard_Suite.py System_Events_Suite.py Text_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Disk_2d_Folder_2d_File_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_2d_Folder_2d_File_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Disk_2d_Folder_2d_File_Suite.py 30 Mar 2003 22:41:51 -0000 1.1 --- Disk_2d_Folder_2d_File_Suite.py 1 Apr 2003 22:05:00 -0000 1.2 *************** *** 43,55 **** """alias - An alias in the file system """ want = 'alis' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class properties(aetools.NProperty): """properties - every property of the alias """ which = 'pALL' want = '****' ! class version(aetools.NProperty): """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ which = 'vers' --- 43,55 ---- """alias - An alias in the file system """ want = 'alis' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_properties(aetools.NProperty): """properties - every property of the alias """ which = 'pALL' want = '****' ! class _Prop_version(aetools.NProperty): """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ which = 'vers' *************** *** 65,93 **** """disk - A disk in the file system """ want = 'cdis' ! class capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'magn' ! class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class format(aetools.NProperty): """format - the file system format of this disk """ which = 'dfmt' want = 'edfm' ! class free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'magn' ! class ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' --- 65,93 ---- """disk - A disk in the file system """ want = 'cdis' ! class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'magn' ! class _Prop_ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class _Prop_format(aetools.NProperty): """format - the file system format of this disk """ which = 'dfmt' want = 'edfm' ! class _Prop_free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'magn' ! class _Prop_ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class _Prop_local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' *************** *** 113,161 **** """item - An item in the file system """ want = 'cobj' ! class POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the item """ which = 'posx' want = 'utxt' ! class busy_status(aetools.NProperty): """busy status - Is the item busy? """ which = 'busy' want = 'bool' ! class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = '****' ! class displayed_name(aetools.NProperty): """displayed name - the name of the item as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = '****' ! class name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class name_extension(aetools.NProperty): """name extension - the extension portion of the name """ which = 'extn' want = 'utxt' ! class package_folder(aetools.NProperty): """package folder - Is the item a package? """ which = 'pkgf' want = 'bool' ! class path(aetools.NProperty): """path - the file system path of the item """ which = 'ppth' want = 'utxt' ! class url(aetools.NProperty): """url - the url of the item """ which = 'url ' want = 'utxt' ! class visible(aetools.NProperty): """visible - Is the item visible? """ which = 'pvis' want = 'bool' ! class volume(aetools.NProperty): """volume - the volume on which the item resides """ which = 'volu' --- 113,161 ---- """item - An item in the file system """ want = 'cobj' ! class _Prop_POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the item """ which = 'posx' want = 'utxt' ! class _Prop_busy_status(aetools.NProperty): """busy status - Is the item busy? """ which = 'busy' want = 'bool' ! class _Prop_creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = '****' ! class _Prop_displayed_name(aetools.NProperty): """displayed name - the name of the item as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class _Prop_modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = '****' ! class _Prop_name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class _Prop_name_extension(aetools.NProperty): """name extension - the extension portion of the name """ which = 'extn' want = 'utxt' ! class _Prop_package_folder(aetools.NProperty): """package folder - Is the item a package? """ which = 'pkgf' want = 'bool' ! class _Prop_path(aetools.NProperty): """path - the file system path of the item """ which = 'ppth' want = 'utxt' ! class _Prop_url(aetools.NProperty): """url - the url of the item """ which = 'url ' want = 'utxt' ! class _Prop_visible(aetools.NProperty): """visible - Is the item visible? """ which = 'pvis' want = 'bool' ! class _Prop_volume(aetools.NProperty): """volume - the volume on which the item resides """ which = 'volu' *************** *** 167,191 **** """file - A file in the file system """ want = 'file' ! class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the file """ which = 'fcrt' want = 'utxt' ! class file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the file """ which = 'asty' want = 'utxt' ! class physical_size(aetools.NProperty): """physical size - the actual space used by the file on disk """ which = 'phys' want = '****' ! class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the "Get Info" window) """ which = 'ver2' want = 'utxt' ! class size(aetools.NProperty): """size - the logical size of the file """ which = 'ptsz' want = '****' ! class stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' --- 167,191 ---- """file - A file in the file system """ want = 'file' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the file """ which = 'fcrt' want = 'utxt' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the file """ which = 'asty' want = 'utxt' ! class _Prop_physical_size(aetools.NProperty): """physical size - the actual space used by the file on disk """ which = 'phys' want = '****' ! class _Prop_product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the "Get Info" window) """ which = 'ver2' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - the logical size of the file """ which = 'ptsz' want = '****' ! class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' *************** *** 195,201 **** alias._superclassnames = ['item'] alias._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, ! 'version' : version, } alias._privelemdict = { --- 195,201 ---- alias._superclassnames = ['item'] alias._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, ! 'version' : _Prop_version, } alias._privelemdict = { *************** *** 207,219 **** disk._superclassnames = ['item'] disk._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'capacity' : capacity, ! 'ejectable' : ejectable, ! 'format' : format, ! 'free_space' : free_space, ! 'ignore_privileges' : ignore_privileges, ! 'local_volume' : local_volume, ! 'properties' : properties, ! 'startup' : startup, } disk._privelemdict = { --- 207,219 ---- disk._superclassnames = ['item'] disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'properties' : _Prop_properties, ! 'startup' : _Prop_startup, } disk._privelemdict = { *************** *** 225,230 **** folder._superclassnames = ['item'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, } folder._privelemdict = { --- 225,230 ---- folder._superclassnames = ['item'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } folder._privelemdict = { *************** *** 236,253 **** item._superclassnames = [] item._privpropdict = { ! 'POSIX_path' : POSIX_path, ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'busy_status' : busy_status, ! 'creation_date' : creation_date, ! 'displayed_name' : displayed_name, ! 'modification_date' : modification_date, ! 'name' : name, ! 'name_extension' : name_extension, ! 'package_folder' : package_folder, ! 'path' : path, ! 'properties' : properties, ! 'url' : url, ! 'visible' : visible, ! 'volume' : volume, } item._privelemdict = { --- 236,253 ---- item._superclassnames = [] item._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'busy_status' : _Prop_busy_status, ! 'creation_date' : _Prop_creation_date, ! 'displayed_name' : _Prop_displayed_name, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'package_folder' : _Prop_package_folder, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'url' : _Prop_url, ! 'visible' : _Prop_visible, ! 'volume' : _Prop_volume, } item._privelemdict = { *************** *** 255,267 **** file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'creator_type' : creator_type, ! 'file_type' : file_type, ! 'physical_size' : physical_size, ! 'product_version' : product_version, ! 'properties' : properties, ! 'size' : size, ! 'stationery' : stationery, ! 'version' : version, } file._privelemdict = { --- 255,267 ---- file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'physical_size' : _Prop_physical_size, ! 'product_version' : _Prop_product_version, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { *************** *** 295,335 **** 'cobj' : item, 'file' : file, - } - - _propdeclarations = { - 'ascd' : creation_date, - 'asmo' : modification_date, - 'asty' : file_type, - 'busy' : busy_status, - 'c@#^' : _3c_Inheritance_3e_, - 'capa' : capacity, - 'dfmt' : format, - 'dnam' : displayed_name, - 'extn' : name_extension, - 'fcrt' : creator_type, - 'frsp' : free_space, - 'igpr' : ignore_privileges, - 'isej' : ejectable, - 'isrv' : local_volume, - 'istd' : startup, - 'pALL' : properties, - 'phys' : physical_size, - 'pkgf' : package_folder, - 'pnam' : name, - 'posx' : POSIX_path, - 'ppth' : path, - 'pspd' : stationery, - 'ptsz' : size, - 'pvis' : visible, - 'url ' : url, - 'ver2' : product_version, - 'vers' : version, - 'volu' : volume, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'edfm' : _Enum_edfm, } --- 295,297 ---- Index: Folder_Actions_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Folder_Actions_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Folder_Actions_Suite.py 1 Apr 2003 22:05:02 -0000 1.2 *************** *** 151,175 **** """folder action - An action attached to a folder in the file system """ want = 'foac' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class enabled(aetools.NProperty): """enabled - Is the folder action enabled? """ which = 'enaB' want = 'bool' ! class name(aetools.NProperty): """name - the name of the folder action, which is also the name of the folder """ which = 'pnam' want = 'utxt' ! class path(aetools.NProperty): """path - the path to the folder to which the folder action applies """ which = 'ppth' want = '****' ! class properties(aetools.NProperty): """properties - every property of the folder action """ which = 'pALL' want = '****' ! class volume(aetools.NProperty): """volume - the volume on which the folder action resides """ which = 'volu' --- 151,175 ---- """folder action - An action attached to a folder in the file system """ want = 'foac' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_enabled(aetools.NProperty): """enabled - Is the folder action enabled? """ which = 'enaB' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the folder action, which is also the name of the folder """ which = 'pnam' want = 'utxt' ! class _Prop_path(aetools.NProperty): """path - the path to the folder to which the folder action applies """ which = 'ppth' want = '****' ! class _Prop_properties(aetools.NProperty): """properties - every property of the folder action """ which = 'pALL' want = '****' ! class _Prop_volume(aetools.NProperty): """volume - the volume on which the folder action resides """ which = 'volu' *************** *** 182,186 **** """script - A script invoked by a folder action """ want = 'scpt' ! class POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the disk """ which = 'posx' --- 182,186 ---- """script - A script invoked by a folder action """ want = 'scpt' ! class _Prop_POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the disk """ which = 'posx' *************** *** 191,200 **** folder_action._superclassnames = ['item'] folder_action._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'enabled' : enabled, ! 'name' : name, ! 'path' : path, ! 'properties' : properties, ! 'volume' : volume, } folder_action._privelemdict = { --- 191,200 ---- folder_action._superclassnames = ['item'] folder_action._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'enabled' : _Prop_enabled, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'volume' : _Prop_volume, } folder_action._privelemdict = { *************** *** 203,211 **** script._superclassnames = ['item'] script._privpropdict = { ! 'POSIX_path' : POSIX_path, ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'name' : name, ! 'path' : path, ! 'properties' : properties, } script._privelemdict = { --- 203,211 ---- script._superclassnames = ['item'] script._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, } script._privelemdict = { *************** *** 226,245 **** 'foac' : folder_action, 'scpt' : script, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'enaB' : enabled, - 'pALL' : properties, - 'pnam' : name, - 'posx' : POSIX_path, - 'ppth' : path, - 'volu' : volume, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'actn' : _Enum_actn, } --- 226,228 ---- Index: Hidden_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Hidden_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Hidden_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Hidden_Suite.py 1 Apr 2003 22:05:03 -0000 1.2 *************** *** 40,50 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 40,41 ---- Index: Login_Items_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Login_Items_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Login_Items_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Login_Items_Suite.py 1 Apr 2003 22:05:03 -0000 1.2 *************** *** 19,39 **** """login item - an item to be launched or opened at login """ want = 'logi' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class hidden(aetools.NProperty): """hidden - Is the Login Item hidden when launched? """ which = 'hidn' want = 'bool' ! class kind(aetools.NProperty): """kind - the file type of the Login Item """ which = 'kind' want = 'utxt' ! class name(aetools.NProperty): """name - the name of the Login Item """ which = 'pnam' want = 'utxt' ! class path(aetools.NProperty): """path - the file system path to the Login Item """ which = 'ppth' --- 19,39 ---- """login item - an item to be launched or opened at login """ want = 'logi' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_hidden(aetools.NProperty): """hidden - Is the Login Item hidden when launched? """ which = 'hidn' want = 'bool' ! class _Prop_kind(aetools.NProperty): """kind - the file type of the Login Item """ which = 'kind' want = 'utxt' ! class _Prop_name(aetools.NProperty): """name - the name of the Login Item """ which = 'pnam' want = 'utxt' ! class _Prop_path(aetools.NProperty): """path - the file system path to the Login Item """ which = 'ppth' *************** *** 44,52 **** login_item._superclassnames = ['item'] login_item._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'hidden' : hidden, ! 'kind' : kind, ! 'name' : name, ! 'path' : path, } login_item._privelemdict = { --- 44,52 ---- login_item._superclassnames = ['item'] login_item._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'hidden' : _Prop_hidden, ! 'kind' : _Prop_kind, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } login_item._privelemdict = { *************** *** 58,74 **** _classdeclarations = { 'logi' : login_item, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'hidn' : hidden, - 'kind' : kind, - 'pnam' : name, - 'ppth' : path, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 58,60 ---- Index: Power_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Power_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Power_Suite.py 1 Apr 2003 22:05:05 -0000 1.2 *************** *** 79,89 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 79,80 ---- Index: Processes_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Processes_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Processes_Suite.py 1 Apr 2003 22:05:06 -0000 1.2 *************** *** 228,232 **** """browser - A browser belonging to a window """ want = 'broW' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' --- 228,232 ---- """browser - A browser belonging to a window """ want = 'broW' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' *************** *** 1207,1211 **** """application process - A process launched from an application file """ want = 'pcap' ! class application_file(aetools.NProperty): """application file - a reference to the application file from which this process was launched """ which = 'appf' --- 1207,1211 ---- """application process - A process launched from an application file """ want = 'pcap' ! class _Prop_application_file(aetools.NProperty): """application file - a reference to the application file from which this process was launched """ which = 'appf' *************** *** 1260,1264 **** """desk accessory process - A process launched from an desk accessory file """ want = 'pcda' ! class desk_accessory_file(aetools.NProperty): """desk accessory file - a reference to the desk accessory file from which this process was launched """ which = 'dafi' --- 1260,1264 ---- """desk accessory process - A process launched from an desk accessory file """ want = 'pcda' ! class _Prop_desk_accessory_file(aetools.NProperty): """desk accessory file - a reference to the desk accessory file from which this process was launched """ which = 'dafi' *************** *** 1360,1416 **** """process - A process running on this computer """ want = 'prcs' ! class Classic(aetools.NProperty): """Classic - Is the process running in the Classic environment? """ which = 'clsc' want = 'bool' ! class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'utxt' ! class displayed_name(aetools.NProperty): """displayed name - the name of the file from which the process was launched, as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = '****' ! class file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'utxt' ! class frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process """ which = 'pisf' want = 'bool' ! class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'utxt' ! class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'magn' ! class properties(aetools.NProperty): """properties - every property of the process """ which = 'pALL' want = '****' ! class total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'magn' ! class visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' --- 1360,1416 ---- """process - A process running on this computer """ want = 'prcs' ! class _Prop_Classic(aetools.NProperty): """Classic - Is the process running in the Classic environment? """ which = 'clsc' want = 'bool' ! class _Prop_accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class _Prop_accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'utxt' ! class _Prop_displayed_name(aetools.NProperty): """displayed name - the name of the file from which the process was launched, as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class _Prop_file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = '****' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'utxt' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process """ which = 'pisf' want = 'bool' ! class _Prop_has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'utxt' ! class _Prop_partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'magn' ! class _Prop_properties(aetools.NProperty): """properties - every property of the process """ which = 'pALL' want = '****' ! class _Prop_total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'magn' ! class _Prop_visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' *************** *** 2315,2375 **** """UI element - A piece of the user interface of a process """ want = 'uiel' ! class class_(aetools.NProperty): """class - the class of the UI Element, which identifies it function """ which = 'pcls' want = 'type' ! class description(aetools.NProperty): """description - a more complete description of the UI element and its capabilities """ which = 'desc' want = 'utxt' ! class enabled(aetools.NProperty): """enabled - Is the UI element enabled? ( Does it accept clicks? ) """ which = 'enab' want = 'bool' ! class focused(aetools.NProperty): """focused - Is the focus on this UI element? """ which = 'focu' want = 'bool' ! class help(aetools.NProperty): """help - an encoded description of the UI element and its capabilities """ which = 'help' want = 'utxt' ! class maximum(aetools.NProperty): """maximum - the maximum vale that the UI element can take on """ which = 'maxi' want = 'long' ! class minimum(aetools.NProperty): """minimum - the minimum vale that the UI element can take on """ which = 'mini' want = 'long' ! class orientation(aetools.NProperty): """orientation - the orientation of the UI element """ which = 'orie' want = 'utxt' ! class position(aetools.NProperty): """position - the position of the UI element """ which = 'posn' want = 'QDpt' ! class role(aetools.NProperty): """role - an encoded description of the UI element and its capabilities """ which = 'role' want = 'utxt' ! class selected(aetools.NProperty): """selected - Is the UI element selected? """ which = 'selE' want = '****' ! class size(aetools.NProperty): """size - the size of the UI element """ which = 'ptsz' want = 'QDpt' ! class subrole(aetools.NProperty): """subrole - an encoded description of the UI element and its capabilities """ which = 'sbrl' want = 'utxt' ! class title(aetools.NProperty): """title - the title of the UI element as it appears on the screen """ which = 'titl' want = 'utxt' ! class value(aetools.NProperty): """value - the current value of the UI element """ which = 'valu' --- 2315,2375 ---- """UI element - A piece of the user interface of a process """ want = 'uiel' ! class _Prop_class_(aetools.NProperty): """class - the class of the UI Element, which identifies it function """ which = 'pcls' want = 'type' ! class _Prop_description(aetools.NProperty): """description - a more complete description of the UI element and its capabilities """ which = 'desc' want = 'utxt' ! class _Prop_enabled(aetools.NProperty): """enabled - Is the UI element enabled? ( Does it accept clicks? ) """ which = 'enab' want = 'bool' ! class _Prop_focused(aetools.NProperty): """focused - Is the focus on this UI element? """ which = 'focu' want = 'bool' ! class _Prop_help(aetools.NProperty): """help - an encoded description of the UI element and its capabilities """ which = 'help' want = 'utxt' ! class _Prop_maximum(aetools.NProperty): """maximum - the maximum vale that the UI element can take on """ which = 'maxi' want = 'long' ! class _Prop_minimum(aetools.NProperty): """minimum - the minimum vale that the UI element can take on """ which = 'mini' want = 'long' ! class _Prop_orientation(aetools.NProperty): """orientation - the orientation of the UI element """ which = 'orie' want = 'utxt' ! class _Prop_position(aetools.NProperty): """position - the position of the UI element """ which = 'posn' want = 'QDpt' ! class _Prop_role(aetools.NProperty): """role - an encoded description of the UI element and its capabilities """ which = 'role' want = 'utxt' ! class _Prop_selected(aetools.NProperty): """selected - Is the UI element selected? """ which = 'selE' want = '****' ! class _Prop_size(aetools.NProperty): """size - the size of the UI element """ which = 'ptsz' want = 'QDpt' ! class _Prop_subrole(aetools.NProperty): """subrole - an encoded description of the UI element and its capabilities """ which = 'sbrl' want = 'utxt' ! class _Prop_title(aetools.NProperty): """title - the title of the UI element as it appears on the screen """ which = 'titl' want = 'utxt' ! class _Prop_value(aetools.NProperty): """value - the current value of the UI element """ which = 'valu' *************** *** 2467,2471 **** browser._superclassnames = ['UI_element'] browser._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } browser._privelemdict = { --- 2467,2471 ---- browser._superclassnames = ['UI_element'] browser._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } browser._privelemdict = { *************** *** 2514,2518 **** busy_indicator._superclassnames = ['UI_element'] busy_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } busy_indicator._privelemdict = { --- 2514,2518 ---- busy_indicator._superclassnames = ['UI_element'] busy_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } busy_indicator._privelemdict = { *************** *** 2561,2565 **** button._superclassnames = ['UI_element'] button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } button._privelemdict = { --- 2561,2565 ---- button._superclassnames = ['UI_element'] button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } button._privelemdict = { *************** *** 2608,2612 **** application._superclassnames = ['UI_element'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } application._privelemdict = { --- 2608,2612 ---- application._superclassnames = ['UI_element'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } application._privelemdict = { *************** *** 2655,2659 **** column._superclassnames = ['UI_element'] column._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } column._privelemdict = { --- 2655,2659 ---- column._superclassnames = ['UI_element'] column._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } column._privelemdict = { *************** *** 2702,2706 **** check_box._superclassnames = ['UI_element'] check_box._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } check_box._privelemdict = { --- 2702,2706 ---- check_box._superclassnames = ['UI_element'] check_box._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } check_box._privelemdict = { *************** *** 2749,2753 **** color_well._superclassnames = ['UI_element'] color_well._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color_well._privelemdict = { --- 2749,2753 ---- color_well._superclassnames = ['UI_element'] color_well._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } color_well._privelemdict = { *************** *** 2796,2800 **** combo_box._superclassnames = ['UI_element'] combo_box._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } combo_box._privelemdict = { --- 2796,2800 ---- combo_box._superclassnames = ['UI_element'] combo_box._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } combo_box._privelemdict = { *************** *** 2843,2847 **** row._superclassnames = ['UI_element'] row._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } row._privelemdict = { --- 2843,2847 ---- row._superclassnames = ['UI_element'] row._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } row._privelemdict = { *************** *** 2890,2894 **** window._superclassnames = ['UI_element'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } window._privelemdict = { --- 2890,2894 ---- window._superclassnames = ['UI_element'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } window._privelemdict = { *************** *** 2969,2973 **** drawer._superclassnames = ['UI_element'] drawer._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } drawer._privelemdict = { --- 2969,2973 ---- drawer._superclassnames = ['UI_element'] drawer._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } drawer._privelemdict = { *************** *** 3016,3020 **** grow_area._superclassnames = ['UI_element'] grow_area._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } grow_area._privelemdict = { --- 3016,3020 ---- grow_area._superclassnames = ['UI_element'] grow_area._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } grow_area._privelemdict = { *************** *** 3063,3067 **** image._superclassnames = ['UI_element'] image._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } image._privelemdict = { --- 3063,3067 ---- image._superclassnames = ['UI_element'] image._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } image._privelemdict = { *************** *** 3110,3114 **** incrementor._superclassnames = ['UI_element'] incrementor._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } incrementor._privelemdict = { --- 3110,3114 ---- incrementor._superclassnames = ['UI_element'] incrementor._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } incrementor._privelemdict = { *************** *** 3157,3161 **** list._superclassnames = ['UI_element'] list._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } list._privelemdict = { --- 3157,3161 ---- list._superclassnames = ['UI_element'] list._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } list._privelemdict = { *************** *** 3204,3208 **** menu_bar._superclassnames = ['UI_element'] menu_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu_bar._privelemdict = { --- 3204,3208 ---- menu_bar._superclassnames = ['UI_element'] menu_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu_bar._privelemdict = { *************** *** 3252,3256 **** menu_button._superclassnames = ['UI_element'] menu_button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu_button._privelemdict = { --- 3252,3256 ---- menu_button._superclassnames = ['UI_element'] menu_button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu_button._privelemdict = { *************** *** 3299,3303 **** menu._superclassnames = ['UI_element'] menu._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu._privelemdict = { --- 3299,3303 ---- menu._superclassnames = ['UI_element'] menu._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu._privelemdict = { *************** *** 3347,3351 **** menu_item._superclassnames = ['UI_element'] menu_item._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu_item._privelemdict = { --- 3347,3351 ---- menu_item._superclassnames = ['UI_element'] menu_item._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu_item._privelemdict = { *************** *** 3395,3399 **** outline._superclassnames = ['UI_element'] outline._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } outline._privelemdict = { --- 3395,3399 ---- outline._superclassnames = ['UI_element'] outline._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } outline._privelemdict = { *************** *** 3442,3447 **** application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'application_file' : application_file, } application_process._privelemdict = { --- 3442,3447 ---- application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'application_file' : _Prop_application_file, } application_process._privelemdict = { *************** *** 3492,3497 **** desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'desk_accessory_file' : desk_accessory_file, } desk_accessory_process._privelemdict = { --- 3492,3497 ---- desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'desk_accessory_file' : _Prop_desk_accessory_file, } desk_accessory_process._privelemdict = { *************** *** 3542,3546 **** pop_up_button._superclassnames = ['UI_element'] pop_up_button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } pop_up_button._privelemdict = { --- 3542,3546 ---- pop_up_button._superclassnames = ['UI_element'] pop_up_button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } pop_up_button._privelemdict = { *************** *** 3589,3607 **** process._superclassnames = ['UI_element'] process._privpropdict = { ! 'Classic' : Classic, ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'accepts_high_level_events' : accepts_high_level_events, ! 'accepts_remote_events' : accepts_remote_events, ! 'creator_type' : creator_type, ! 'displayed_name' : displayed_name, ! 'file' : file, ! 'file_type' : file_type, ! 'frontmost' : frontmost, ! 'has_scripting_terminology' : has_scripting_terminology, ! 'name' : name, ! 'partition_space_used' : partition_space_used, ! 'properties' : properties, ! 'total_partition_size' : total_partition_size, ! 'visible' : visible, } process._privelemdict = { --- 3589,3607 ---- process._superclassnames = ['UI_element'] process._privpropdict = { ! 'Classic' : _Prop_Classic, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'accepts_remote_events' : _Prop_accepts_remote_events, ! 'creator_type' : _Prop_creator_type, ! 'displayed_name' : _Prop_displayed_name, ! 'file' : _Prop_file, ! 'file_type' : _Prop_file_type, ! 'frontmost' : _Prop_frontmost, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'name' : _Prop_name, ! 'partition_space_used' : _Prop_partition_space_used, ! 'properties' : _Prop_properties, ! 'total_partition_size' : _Prop_total_partition_size, ! 'visible' : _Prop_visible, } process._privelemdict = { *************** *** 3652,3656 **** progress_indicator._superclassnames = ['UI_element'] progress_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } progress_indicator._privelemdict = { --- 3652,3656 ---- progress_indicator._superclassnames = ['UI_element'] progress_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } progress_indicator._privelemdict = { *************** *** 3699,3703 **** radio_button._superclassnames = ['UI_element'] radio_button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } radio_button._privelemdict = { --- 3699,3703 ---- radio_button._superclassnames = ['UI_element'] radio_button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } radio_button._privelemdict = { *************** *** 3746,3750 **** relevance_indicator._superclassnames = ['UI_element'] relevance_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } relevance_indicator._privelemdict = { --- 3746,3750 ---- relevance_indicator._superclassnames = ['UI_element'] relevance_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } relevance_indicator._privelemdict = { *************** *** 3793,3797 **** radio_group._superclassnames = ['UI_element'] radio_group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } radio_group._privelemdict = { --- 3793,3797 ---- radio_group._superclassnames = ['UI_element'] radio_group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } radio_group._privelemdict = { *************** *** 3841,3845 **** scroll_area._superclassnames = ['UI_element'] scroll_area._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } scroll_area._privelemdict = { --- 3841,3845 ---- scroll_area._superclassnames = ['UI_element'] scroll_area._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } scroll_area._privelemdict = { *************** *** 3888,3892 **** scroll_bar._superclassnames = ['UI_element'] scroll_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } scroll_bar._privelemdict = { --- 3888,3892 ---- scroll_bar._superclassnames = ['UI_element'] scroll_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } scroll_bar._privelemdict = { *************** *** 3937,3941 **** group._superclassnames = ['UI_element'] group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } group._privelemdict = { --- 3937,3941 ---- group._superclassnames = ['UI_element'] group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } group._privelemdict = { *************** *** 3986,3990 **** sheet._superclassnames = ['UI_element'] sheet._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } sheet._privelemdict = { --- 3986,3990 ---- sheet._superclassnames = ['UI_element'] sheet._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } sheet._privelemdict = { *************** *** 4033,4037 **** slider._superclassnames = ['UI_element'] slider._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } slider._privelemdict = { --- 4033,4037 ---- slider._superclassnames = ['UI_element'] slider._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } slider._privelemdict = { *************** *** 4080,4084 **** splitter_group._superclassnames = ['UI_element'] splitter_group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } splitter_group._privelemdict = { --- 4080,4084 ---- splitter_group._superclassnames = ['UI_element'] splitter_group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } splitter_group._privelemdict = { *************** *** 4127,4131 **** splitter._superclassnames = ['UI_element'] splitter._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } splitter._privelemdict = { --- 4127,4131 ---- splitter._superclassnames = ['UI_element'] splitter._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } splitter._privelemdict = { *************** *** 4174,4178 **** static_text._superclassnames = ['UI_element'] static_text._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } static_text._privelemdict = { --- 4174,4178 ---- static_text._superclassnames = ['UI_element'] static_text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } static_text._privelemdict = { *************** *** 4222,4226 **** system_wide_UI_element._superclassnames = ['UI_element'] system_wide_UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } system_wide_UI_element._privelemdict = { --- 4222,4226 ---- system_wide_UI_element._superclassnames = ['UI_element'] system_wide_UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } system_wide_UI_element._privelemdict = { *************** *** 4269,4273 **** tab_group._superclassnames = ['UI_element'] tab_group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } tab_group._privelemdict = { --- 4269,4273 ---- tab_group._superclassnames = ['UI_element'] tab_group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } tab_group._privelemdict = { *************** *** 4316,4320 **** table._superclassnames = ['UI_element'] table._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } table._privelemdict = { --- 4316,4320 ---- table._superclassnames = ['UI_element'] table._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } table._privelemdict = { *************** *** 4363,4367 **** tool_bar._superclassnames = ['UI_element'] tool_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } tool_bar._privelemdict = { --- 4363,4367 ---- tool_bar._superclassnames = ['UI_element'] tool_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } tool_bar._privelemdict = { *************** *** 4410,4414 **** text_area._superclassnames = ['UI_element'] text_area._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } text_area._privelemdict = { --- 4410,4414 ---- text_area._superclassnames = ['UI_element'] text_area._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } text_area._privelemdict = { *************** *** 4457,4461 **** text_field._superclassnames = ['UI_element'] text_field._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } text_field._privelemdict = { --- 4457,4461 ---- text_field._superclassnames = ['UI_element'] text_field._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } text_field._privelemdict = { *************** *** 4505,4525 **** UI_element._superclassnames = ['item'] UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'class_' : class_, ! 'description' : description, ! 'enabled' : enabled, ! 'focused' : focused, ! 'help' : help, ! 'maximum' : maximum, ! 'minimum' : minimum, ! 'name' : name, ! 'orientation' : orientation, ! 'position' : position, ! 'role' : role, ! 'selected' : selected, ! 'size' : size, ! 'subrole' : subrole, ! 'title' : title, ! 'value' : value, } UI_element._privelemdict = { --- 4505,4525 ---- UI_element._superclassnames = ['item'] UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'class_' : _Prop_class_, ! 'description' : _Prop_description, ! 'enabled' : _Prop_enabled, ! 'focused' : _Prop_focused, ! 'help' : _Prop_help, ! 'maximum' : _Prop_maximum, ! 'minimum' : _Prop_minimum, ! 'name' : _Prop_name, ! 'orientation' : _Prop_orientation, ! 'position' : _Prop_position, ! 'role' : _Prop_role, ! 'selected' : _Prop_selected, ! 'size' : _Prop_size, ! 'subrole' : _Prop_subrole, ! 'title' : _Prop_title, ! 'value' : _Prop_value, } UI_element._privelemdict = { *************** *** 4568,4572 **** value_indicator._superclassnames = ['UI_element'] value_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } value_indicator._privelemdict = { --- 4568,4572 ---- value_indicator._superclassnames = ['UI_element'] value_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } value_indicator._privelemdict = { *************** *** 4676,4721 **** 'uiel' : UI_element, 'vali' : value_indicator, - } - - _propdeclarations = { - 'appf' : application_file, - 'appt' : total_partition_size, - 'asty' : file_type, - 'c@#^' : _3c_Inheritance_3e_, - 'clsc' : Classic, - 'dafi' : desk_accessory_file, - 'desc' : description, - 'dnam' : displayed_name, - 'enab' : enabled, - 'fcrt' : creator_type, - 'file' : file, - 'focu' : focused, - 'help' : help, - 'hscr' : has_scripting_terminology, - 'isab' : accepts_high_level_events, - 'maxi' : maximum, - 'mini' : minimum, - 'orie' : orientation, - 'pALL' : properties, - 'pcls' : class_, - 'pisf' : frontmost, - 'pnam' : name, - 'posn' : position, - 'ptsz' : size, - 'pusd' : partition_space_used, - 'pvis' : visible, - 'revt' : accepts_remote_events, - 'role' : role, - 'sbrl' : subrole, - 'selE' : selected, - 'titl' : title, - 'valu' : value, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'eMds' : _Enum_eMds, - 'eMky' : _Enum_eMky, } --- 4676,4678 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Standard_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 334,350 **** """application - An application's top level scripting object. """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class version(aetools.NProperty): """version - The version of the application. """ which = 'vers' --- 334,350 ---- """application - An application's top level scripting object. """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' *************** *** 358,366 **** """item - A scriptable object. """ want = 'cobj' ! class class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' --- 358,366 ---- """item - A scriptable object. """ want = 'cobj' ! class _Prop_class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class _Prop_properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' *************** *** 378,434 **** """window - A window. """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' --- 378,434 ---- """window - A window. """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class _Prop_document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class _Prop_floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class _Prop_id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class _Prop_index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class _Prop_miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class _Prop_miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class _Prop_modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class _Prop_resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' *************** *** 440,448 **** """document - A document. """ want = 'docu' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class path(aetools.NProperty): """path - The document's path. """ which = 'ppth' --- 440,448 ---- """document - A document. """ want = 'docu' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class _Prop_path(aetools.NProperty): """path - The document's path. """ which = 'ppth' *************** *** 452,459 **** application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'frontmost' : frontmost, ! 'name' : name, ! 'version' : version, } application._privelemdict = { --- 452,459 ---- application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'frontmost' : _Prop_frontmost, ! 'name' : _Prop_name, ! 'version' : _Prop_version, } application._privelemdict = { *************** *** 463,468 **** item._superclassnames = [] item._privpropdict = { ! 'class_' : class_, ! 'properties' : properties, } item._privelemdict = { --- 463,468 ---- item._superclassnames = [] item._privpropdict = { ! 'class_' : _Prop_class_, ! 'properties' : _Prop_properties, } item._privelemdict = { *************** *** 470,474 **** color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color._privelemdict = { --- 470,474 ---- color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } color._privelemdict = { *************** *** 476,495 **** window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'document' : document, ! 'floating' : floating, ! 'id' : id, ! 'index' : index, ! 'miniaturizable' : miniaturizable, ! 'miniaturized' : miniaturized, ! 'modal' : modal, ! 'name' : name, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 476,495 ---- window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'document' : _Prop_document, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'miniaturizable' : _Prop_miniaturizable, ! 'miniaturized' : _Prop_miniaturized, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 497,504 **** document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'modified' : modified, ! 'name' : name, ! 'path' : path, } document._privelemdict = { --- 497,504 ---- document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'modified' : _Prop_modified, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } document._privelemdict = { *************** *** 536,578 **** 'cwin' : window, 'docu' : document, - } - - _propdeclarations = { - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'docu' : document, - 'hclb' : closeable, - 'imod' : modified, - 'isfl' : floating, - 'ismn' : miniaturizable, - 'iszm' : zoomable, - 'pALL' : properties, - 'pbnd' : bounds, - 'pcls' : class_, - 'pidx' : index, - 'pisf' : frontmost, - 'pmnd' : miniaturized, - 'pmod' : modal, - 'pnam' : name, - 'ppth' : path, - 'prsz' : resizable, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'vers' : version, - } - - _compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, - } - - _enumdeclarations = { - 'savo' : _Enum_savo, } --- 536,538 ---- Index: System_Events_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** System_Events_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- System_Events_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 19,35 **** """application - The System Events application """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class folder_actions_enabled(aetools.NProperty): """folder actions enabled - Are Folder Actions currently being processed? """ which = 'faen' want = 'bool' ! class properties(aetools.NProperty): """properties - every property of the System Events application """ which = 'pALL' want = '****' ! class system_wide_UI_element(aetools.NProperty): """system wide UI element - the UI element for the entire system """ which = 'swui' --- 19,35 ---- """application - The System Events application """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class _Prop_folder_actions_enabled(aetools.NProperty): """folder actions enabled - Are Folder Actions currently being processed? """ which = 'faen' want = 'bool' ! class _Prop_properties(aetools.NProperty): """properties - every property of the System Events application """ which = 'pALL' want = '****' ! class _Prop_system_wide_UI_element(aetools.NProperty): """system wide UI element - the UI element for the entire system """ which = 'swui' *************** *** 57,64 **** import Processes_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'folder_actions_enabled' : folder_actions_enabled, ! 'properties' : properties, ! 'system_wide_UI_element' : system_wide_UI_element, } application._privelemdict = { --- 57,64 ---- import Processes_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'folder_actions_enabled' : _Prop_folder_actions_enabled, ! 'properties' : _Prop_properties, ! 'system_wide_UI_element' : _Prop_system_wide_UI_element, } application._privelemdict = { *************** *** 83,98 **** _classdeclarations = { 'capp' : application, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'faen' : folder_actions_enabled, - 'pALL' : properties, - 'swui' : system_wide_UI_element, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 83,85 ---- Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Text_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Text_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 19,27 **** """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' --- 19,27 ---- """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class _Prop_file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' *************** *** 35,47 **** """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' --- 35,47 ---- """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class _Prop_color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class _Prop_font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' *************** *** 93,98 **** attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'file_name' : file_name, } attachment._privelemdict = { --- 93,98 ---- attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { *************** *** 105,112 **** attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } attribute_run._privelemdict = { --- 105,112 ---- attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { *************** *** 118,125 **** character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } character._privelemdict = { --- 118,125 ---- character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { *************** *** 131,138 **** paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } paragraph._privelemdict = { --- 131,138 ---- paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { *************** *** 144,151 **** text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } text._privelemdict = { --- 144,151 ---- text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { *************** *** 157,164 **** word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } word._privelemdict = { --- 157,164 ---- word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { *************** *** 179,195 **** 'ctxt' : text, 'cwor' : word, - } - - _propdeclarations = { - 'atfn' : file_name, - 'c@#^' : _3c_Inheritance_3e_, - 'colr' : color, - 'font' : font, - 'ptsz' : size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 179,181 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Mar 2003 22:41:52 -0000 1.1 --- __init__.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 74,79 **** getbaseclasses(attribute_run) getbaseclasses(text) - getbaseclasses(script) - getbaseclasses(folder_action) getbaseclasses(file) getbaseclasses(alias) --- 74,77 ---- *************** *** 86,130 **** getbaseclasses(item) getbaseclasses(document) ! getbaseclasses(login_item) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) ! getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.color_table) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) ! getbaseclasses(StdSuites.Type_Names_Suite.machine_location) ! getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.point) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.menu_item) ! getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) ! getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.menu) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) ! getbaseclasses(StdSuites.Type_Names_Suite.rotation) ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.long_point) ! getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) ! getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) ! getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) ! getbaseclasses(StdSuites.Type_Names_Suite.extended_real) ! getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) ! getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) getbaseclasses(window) getbaseclasses(radio_button) --- 84,89 ---- getbaseclasses(item) getbaseclasses(document) ! getbaseclasses(script) ! getbaseclasses(folder_action) getbaseclasses(window) getbaseclasses(radio_button) *************** *** 171,175 **** --- 130,175 ---- getbaseclasses(combo_box) getbaseclasses(browser) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.string) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) getbaseclasses(application) + getbaseclasses(login_item) # *************** *** 183,188 **** 'catr' : attribute_run, 'ctxt' : text, - 'scpt' : script, - 'foac' : folder_action, 'file' : file, 'alis' : alias, --- 183,186 ---- *************** *** 195,239 **** 'cobj' : item, 'docu' : document, ! 'logi' : login_item, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, 'cwin' : window, 'radB' : radio_button, --- 193,198 ---- 'cobj' : item, 'docu' : document, ! 'scpt' : script, ! 'foac' : folder_action, 'cwin' : window, 'radB' : radio_button, *************** *** 280,284 **** --- 239,284 ---- 'comB' : combo_box, 'broW' : browser, + 'comp' : StdSuites.Type_Names_Suite.double_integer, + 'vers' : StdSuites.Type_Names_Suite.version, + 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, + 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, + 'clrt' : StdSuites.Type_Names_Suite.color_table, + 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, + 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, + 'elin' : StdSuites.Type_Names_Suite.type_element_info, + 'evin' : StdSuites.Type_Names_Suite.type_event_info, + 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, + 'cmen' : StdSuites.Type_Names_Suite.menu_item, + 'styl' : StdSuites.Type_Names_Suite.scrap_styles, + 'aete' : StdSuites.Type_Names_Suite.application_dictionary, + 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, + 'cmnu' : StdSuites.Type_Names_Suite.menu, + 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, + 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, + 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, + 'suin' : StdSuites.Type_Names_Suite.type_suite_info, + 'trot' : StdSuites.Type_Names_Suite.rotation, + 'shor' : StdSuites.Type_Names_Suite.small_integer, + 'fixd' : StdSuites.Type_Names_Suite.fixed, + 'lpnt' : StdSuites.Type_Names_Suite.long_point, + 'gcli' : StdSuites.Type_Names_Suite.type_class_info, + 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, + 'targ' : StdSuites.Type_Names_Suite.target_id, + 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, + 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, + 'exte' : StdSuites.Type_Names_Suite.extended_real, + 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, + 'tdas' : StdSuites.Type_Names_Suite.dash_style, + 'TEXT' : StdSuites.Type_Names_Suite.string, + 'sing' : StdSuites.Type_Names_Suite.small_real, + 'null' : StdSuites.Type_Names_Suite.null, + 'insl' : StdSuites.Type_Names_Suite.location_reference, + 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, 'capp' : application, + 'logi' : login_item, } From nnorwitz@users.sourceforge.net Tue Apr 1 22:13:35 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:13:35 -0800 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.14,2.10.8.15 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv25809/Python Modified Files: Tag: ast-branch symtable.c Log Message: initialize ste_tmpname so list comps start at 1 instead of random numbers Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.14 retrieving revision 2.10.8.15 diff -C2 -d -r2.10.8.14 -r2.10.8.15 *** symtable.c 28 Mar 2003 17:22:24 -0000 2.10.8.14 --- symtable.c 1 Apr 2003 22:13:31 -0000 2.10.8.15 *************** *** 20,23 **** --- 20,24 ---- ste->ste_table = st; ste->ste_id = k; + ste->ste_tmpname = 0; ste->ste_name = name; From nnorwitz@users.sourceforge.net Tue Apr 1 22:17:08 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:17:08 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.49,1.1.2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv26806/Python Modified Files: Tag: ast-branch newcompile.c Log Message: I get to the prompt with this change. Although importing site still fails. * fix referencing freed memory (b) after a resize * always use compiler_use_next_block() after JUMP_FORWARD this fixes a problem with if 1: try: pass ; except ImportError: pass Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.49 retrieving revision 1.1.2.50 diff -C2 -d -r1.1.2.49 -r1.1.2.50 *** newcompile.c 31 Mar 2003 21:44:31 -0000 1.1.2.49 --- newcompile.c 1 Apr 2003 22:17:00 -0000 1.1.2.50 *************** *** 473,476 **** --- 473,477 ---- fprintf(stderr, "resize block %d\n", block); c->u->u_blocks[block] = (struct basicblock *)ptr; + b = ptr; } } *************** *** 816,820 **** VISIT_SEQ(c, stmt, s->v.If.body); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_block(c, next); ADDOP(c, POP_TOP); if (s->v.If.orelse) { --- 817,821 ---- VISIT_SEQ(c, stmt, s->v.If.body); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_next_block(c, next); ADDOP(c, POP_TOP); if (s->v.If.orelse) { *************** *** 1586,1590 **** int end = compiler_new_block(c); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_block(c, cleanup); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); --- 1587,1591 ---- int end = compiler_new_block(c); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_next_block(c, cleanup); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); From nnorwitz@users.sourceforge.net Tue Apr 1 22:17:49 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:17:49 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.23,1.1.2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27840/Python Modified Files: Tag: ast-branch ast.c Log Message: fix one memory leak, doc another, still need to fix XXX comments, remove unnecessary breaks Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -C2 -d -r1.1.2.23 -r1.1.2.24 *** ast.c 31 Mar 2003 21:40:03 -0000 1.1.2.23 --- ast.c 1 Apr 2003 22:17:47 -0000 1.1.2.24 *************** *** 534,537 **** --- 534,538 ---- ch = CHILD(ch, 2); } + /* XXX ifs is leaked, we surely have to do something with it */ /* on exit, must guarantee that ch is a list_for */ if (TYPE(ch) == list_iter) *************** *** 770,780 **** case PLUS: return UnaryOp(UAdd, ast_for_expr(CHILD(n, 1))); - break; case MINUS: return UnaryOp(USub, ast_for_expr(CHILD(n, 1))); - break; case TILDE: return UnaryOp(Invert, ast_for_expr(CHILD(n, 1))); - break; } break; --- 771,778 ---- *************** *** 820,824 **** } return e; - break; } default: --- 818,821 ---- *************** *** 1106,1113 **** } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ alias_ty mod = alias_for_import_name(CHILD(n, 1)); aliases = asdl_seq_new((NCH(n) - 2) / 2); for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); ! return ImportFrom(mod->name, aliases, LINENO(n)); } return NULL; --- 1103,1115 ---- } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ alias_ty mod = alias_for_import_name(CHILD(n, 1)); + stmt_ty import; aliases = asdl_seq_new((NCH(n) - 2) / 2); for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); ! import = ImportFrom(mod->name, aliases, LINENO(n)); ! /* XXX we should probably not be using PyObject_Free directly ! should we use asdl_seq_free? we need to cast if so */ ! PyObject_Free(mod); ! return import; } return NULL; From jackjansen@users.sourceforge.net Tue Apr 1 22:30:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:30:29 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation scripting.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv570 Modified Files: scripting.html Log Message: The minimal scripting example now actually works. Index: scripting.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scripting.html 31 Mar 2003 15:10:46 -0000 1.1 --- scripting.html 1 Apr 2003 22:30:23 -0000 1.2 *************** *** 15,32 **** Architecure (OSA, also commonly referred to as AppleScript), allowing you to control scriptable applications from your Python program, ! and with a fairly pythonic interface. The following pieces of ! AppleScript and Python are rougly identical (XXXX Not true right now!):

- tell application "Finder"
- 	get name of window 1
- end tell
- 
- -
  import Finder
  
  f = Finder.Finder()
  print f.get(Finder.window(1).name)
  
--- 15,34 ---- Architecure (OSA, also commonly referred to as AppleScript), allowing you to control scriptable applications from your Python program, ! and with a fairly pythonic interface. This piece of ! Python:

  import Finder
  
  f = Finder.Finder()
  print f.get(Finder.window(1).name)
+ 
+ +

is identical to the following piece of AppleScript:

+ +
+ tell application "Finder"
+ 	get name of window 1
+ end tell
  
From jackjansen@users.sourceforge.net Tue Apr 1 22:33:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:33:41 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.708,1.709 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1802 Modified Files: NEWS Log Message: Added a note about scripting support and the IDE builtin help. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.708 retrieving revision 1.709 diff -C2 -d -r1.708 -r1.709 *** NEWS 31 Mar 2003 18:07:36 -0000 1.708 --- NEWS 1 Apr 2003 22:33:37 -0000 1.709 *************** *** 150,153 **** --- 150,159 ---- currently in the background they will ask to be moved to the foreground before displaying. + + - OSA Scripting support has improved a lot, and gensuitemodule.py can now + be used by mere mortals. + + - The IDE (in a framework build) now includes introductory documentation + in Apple Help Viewer format. From jackjansen@users.sourceforge.net Tue Apr 1 22:27:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:27:22 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv31003 Modified Files: aetools.py Log Message: Sigh... The get() and set() commands are not declared in the aete for the Standard_Suite, but various other suites do expect it (the Finder implements get() without declaring it itself). It is probably another case of OSA magic. Adding them to the global base class. Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aetools.py 31 Mar 2003 13:29:32 -0000 1.5 --- aetools.py 1 Apr 2003 22:27:18 -0000 1.6 *************** *** 255,278 **** item.__class__ = as return item ! def _set(self, _object, _arguments = {}, _attributes = {}): ! """ _set: set data for an object ! Required argument: the object ! Keyword argument _parameters: Parameter dictionary for the set operation Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the data """ _code = 'core' _subcode = 'setd' ! _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise Error, decodeerror(_arguments) ! if _arguments.has_key('----'): return _arguments['----'] # Tiny Finder class, for local use only --- 255,287 ---- item.__class__ = as return item + + get = _get + + _argmap_set = { + 'to' : 'data', + } ! def _set(self, _object, _attributes={}, **_arguments): ! """set: Set an object's data. ! Required argument: the object for the command ! Keyword argument to: The new value. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'setd' ! ! keysubst(_arguments, self._argmap_set) _arguments['----'] = _object + _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] + + set = _set # Tiny Finder class, for local use only From jhylton@users.sourceforge.net Wed Apr 2 04:22:19 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 01 Apr 2003 20:22:19 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.24,1.1.2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2380 Modified Files: Tag: ast-branch ast.c Log Message: Two bugs fixes. When creating Raise() stmts, get CHILD of ch not n! When freeing object for ImportFrom, use free() since Python-ast.c uses malloc(). XXX The asdl_c.py generator should use PyObject_Malloc(). Also add abort() to the default: branches of switches for expr and stmt. These cases should be covered. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.24 retrieving revision 1.1.2.25 diff -C2 -d -r1.1.2.24 -r1.1.2.25 *** ast.c 1 Apr 2003 22:17:47 -0000 1.1.2.24 --- ast.c 2 Apr 2003 04:22:16 -0000 1.1.2.25 *************** *** 821,824 **** --- 821,825 ---- default: fprintf(stderr, "unhandled expr: %d\n", TYPE(n)); + abort(); return NULL; } *************** *** 1004,1018 **** return Raise(NULL, NULL, NULL, LINENO(n)); else if (NCH(ch) == 2) ! return Raise(ast_for_expr(CHILD(n, 1)), NULL, NULL, LINENO(n)); else if (NCH(ch) == 4) ! return Raise(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), NULL, LINENO(n)); else if (NCH(ch) == 6) ! return Raise(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), ! ast_for_expr(CHILD(n, 5)), LINENO(n)); default: fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); return NULL; } --- 1005,1020 ---- return Raise(NULL, NULL, NULL, LINENO(n)); else if (NCH(ch) == 2) ! return Raise(ast_for_expr(CHILD(ch, 1)), NULL, NULL, LINENO(n)); else if (NCH(ch) == 4) ! return Raise(ast_for_expr(CHILD(ch, 1)), ! ast_for_expr(CHILD(ch, 3)), NULL, LINENO(n)); else if (NCH(ch) == 6) ! return Raise(ast_for_expr(CHILD(ch, 1)), ! ast_for_expr(CHILD(ch, 3)), ! ast_for_expr(CHILD(ch, 5)), LINENO(n)); default: fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); + abort(); return NULL; } *************** *** 1108,1114 **** asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); import = ImportFrom(mod->name, aliases, LINENO(n)); ! /* XXX we should probably not be using PyObject_Free directly ! should we use asdl_seq_free? we need to cast if so */ ! PyObject_Free(mod); return import; } --- 1110,1114 ---- asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); import = ImportFrom(mod->name, aliases, LINENO(n)); ! free(mod); return import; } From bwarsaw@users.sourceforge.net Wed Apr 2 04:51:36 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 01 Apr 2003 20:51:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv16075 Modified Files: _compat22.py Log Message: Fix a comment Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _compat22.py 26 Mar 2003 17:57:25 -0000 1.6 --- _compat22.py 2 Apr 2003 04:51:33 -0000 1.7 *************** *** 10,14 **** from types import StringTypes ! # Python 2.2.x where x < 2 lacks True/False try: True, False --- 10,14 ---- from types import StringTypes ! # Python 2.2.x where x < 1 lacks True/False try: True, False From doerwalter@users.sourceforge.net Wed Apr 2 16:37:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:37:26 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.709,1.710 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13323/Misc Modified Files: NEWS Log Message: Change formatchar(), so that u"%c" % 0xffffffff now raises an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.709 retrieving revision 1.710 diff -C2 -d -r1.709 -r1.710 *** NEWS 1 Apr 2003 22:33:37 -0000 1.709 --- NEWS 2 Apr 2003 16:37:23 -0000 1.710 *************** *** 36,40 **** - "%c" % u"a" now returns a unicode string instead of raising a ! TypeError. See SF patch #710127. Extension modules --- 36,41 ---- - "%c" % u"a" now returns a unicode string instead of raising a ! TypeError. u"%c" % 0xffffffff now raises a OverflowError instead ! of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Extension modules From doerwalter@users.sourceforge.net Wed Apr 2 16:37:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:37:26 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.184,2.185 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv13323/Objects Modified Files: unicodeobject.c Log Message: Change formatchar(), so that u"%c" % 0xffffffff now raises an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -d -r2.184 -r2.185 *** unicodeobject.c 9 Mar 2003 07:30:43 -0000 2.184 --- unicodeobject.c 2 Apr 2003 16:37:23 -0000 2.185 *************** *** 6158,6162 **** #ifdef Py_UNICODE_WIDE if (x < 0 || x > 0x10ffff) { ! PyErr_SetString(PyExc_ValueError, "%c arg not in range(0x110000) " "(wide Python build)"); --- 6158,6162 ---- #ifdef Py_UNICODE_WIDE if (x < 0 || x > 0x10ffff) { ! PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000) " "(wide Python build)"); *************** *** 6165,6169 **** #else if (x < 0 || x > 0xffff) { ! PyErr_SetString(PyExc_ValueError, "%c arg not in range(0x10000) " "(narrow Python build)"); --- 6165,6169 ---- #else if (x < 0 || x > 0xffff) { ! PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x10000) " "(narrow Python build)"); From doerwalter@users.sourceforge.net Wed Apr 2 16:37:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:37:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13323/Lib/test Modified Files: test_unicode.py Log Message: Change formatchar(), so that u"%c" % 0xffffffff now raises an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** test_unicode.py 31 Mar 2003 18:18:41 -0000 1.81 --- test_unicode.py 2 Apr 2003 16:37:24 -0000 1.82 *************** *** 361,365 **** self.assertEqual(u'%c' % 0x1234, u'\u1234') ! self.assertRaises(ValueError, u"%c".__mod__, (sys.maxunicode+1,)) # formatting jobs delegated from the string implementation: --- 361,365 ---- self.assertEqual(u'%c' % 0x1234, u'\u1234') ! self.assertRaises(OverflowError, u"%c".__mod__, (sys.maxunicode+1,)) # formatting jobs delegated from the string implementation: From doerwalter@users.sourceforge.net Wed Apr 2 16:58:07 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:58:07 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.710,1.711 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26974/Misc Modified Files: NEWS Log Message: Fix description: u"%c" % 0xffffffff returned a ValueError not a TypeError. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.710 retrieving revision 1.711 diff -C2 -d -r1.710 -r1.711 *** NEWS 2 Apr 2003 16:37:23 -0000 1.710 --- NEWS 2 Apr 2003 16:57:59 -0000 1.711 *************** *** 37,41 **** - "%c" % u"a" now returns a unicode string instead of raising a TypeError. u"%c" % 0xffffffff now raises a OverflowError instead ! of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Extension modules --- 37,41 ---- - "%c" % u"a" now returns a unicode string instead of raising a TypeError. u"%c" % 0xffffffff now raises a OverflowError instead ! of a ValueError to be consistent with "%c" % 256. See SF patch #710127. Extension modules From nnorwitz@users.sourceforge.net Thu Apr 3 00:49:04 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 02 Apr 2003 16:49:04 -0800 Subject: [Python-checkins] python/dist/src/Python asdl.c,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv23887/Python Modified Files: Tag: ast-branch asdl.c Log Message: Rename variable l to len Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/asdl.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** asdl.c 3 Sep 2002 22:51:43 -0000 1.1.2.3 --- asdl.c 3 Apr 2003 00:49:02 -0000 1.1.2.4 *************** *** 71,80 **** marshal_write_string(PyObject **buf, int *offset, string s) { ! int l = PyString_GET_SIZE(s); ! marshal_write_int(buf, offset, l); ! CHECKSIZE(buf, offset, l); memcpy(PyString_AS_STRING(*buf) + *offset, ! PyString_AS_STRING(s), l); ! *offset += l; return 1; } --- 71,80 ---- marshal_write_string(PyObject **buf, int *offset, string s) { ! int len = PyString_GET_SIZE(s); ! marshal_write_int(buf, offset, len); ! CHECKSIZE(buf, offset, len); memcpy(PyString_AS_STRING(*buf) + *offset, ! PyString_AS_STRING(s), len); ! *offset += len; return 1; } From nnorwitz@users.sourceforge.net Thu Apr 3 00:51:47 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 02 Apr 2003 16:51:47 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.25,1.1.2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24790/Python Modified Files: Tag: ast-branch ast.c Log Message: Add lots of error checking on malloc failure Remove unnecessary breaks/return which follow a return Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.25 retrieving revision 1.1.2.26 diff -C2 -d -r1.1.2.25 -r1.1.2.26 *** ast.c 2 Apr 2003 04:22:16 -0000 1.1.2.25 --- ast.c 3 Apr 2003 00:51:45 -0000 1.1.2.26 *************** *** 104,107 **** --- 104,109 ---- fprintf(stderr, "file_input containing %d statements\n", total); stmts = asdl_seq_new(total); + if (!stmts) + return NULL; for (i = 0; i < NCH(n) - 1; i++) { ch = CHILD(n, i); *************** *** 129,133 **** case eval_input: return Expression(ast_for_testlist(CHILD(n, 0))); - break; case single_input: if (TYPE(CHILD(n, 0)) == NEWLINE) { --- 131,134 ---- *************** *** 337,342 **** seq = asdl_seq_new((NCH(n) + 1) / 2); ! for (i = 0; i < NCH(n); i += 2) { ! asdl_seq_SET(seq, i / 2, ast_for_expr(CHILD(n, i))); } return seq; --- 338,345 ---- seq = asdl_seq_new((NCH(n) + 1) / 2); ! if (seq) { ! for (i = 0; i < NCH(n); i += 2) { ! asdl_seq_SET(seq, i / 2, ast_for_expr(CHILD(n, i))); ! } } return seq; *************** *** 377,381 **** --- 380,390 ---- } args = n_args ? asdl_seq_new(n_args) : NULL; + if (!args && n_args) + return NULL; defaults = n_defaults? asdl_seq_new(n_defaults) : NULL; + if (!defaults && n_defaults) { + if (args) asdl_seq_free(args); + return NULL; + } /* fpdef: NAME | '(' fplist ')' *************** *** 389,392 **** --- 398,405 ---- if (NCH(ch) == 3) { /* XXX don't handle fplist yet */ + if (args) + asdl_seq_free(args); + if (defaults) + asdl_seq_free(defaults); return NULL; } *************** *** 508,511 **** --- 521,528 ---- n_fors = count_list_fors(n); listcomps = asdl_seq_new(n_fors); + if (!listcomps) { + /* XXX free elt? */ + return NULL; + } ch = CHILD(n, 1); for (i = 0; i < n_fors; i++) { *************** *** 526,529 **** --- 543,551 ---- n_ifs = count_list_ifs(ch); ifs = asdl_seq_new(n_ifs); + if (!ifs) { + /* XXX free elt? */ + asdl_seq_free(listcomps); + return NULL; + } for (j = 0; j < n_ifs; j++) { REQ(ch, list_iter); *************** *** 557,571 **** /* All names start in Load context, but may later be changed. */ return Name(NEW_IDENTIFIER(ch), Load); - break; case STRING: /* XXX parsestrplus can return NULL. */ return Str(parsestrplus(n)); - break; case NUMBER: return Num(parsenumber(STR(ch))); - break; case LPAR: /* some parenthesized expressions */ return ast_for_testlist(CHILD(n, 1)); - break; case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); --- 579,589 ---- *************** *** 587,591 **** --- 605,615 ---- size = (NCH(ch) + 1) / 4; /* plus one in case no trailing comma */ keys = asdl_seq_new(size); + if (!keys) + return NULL; values = asdl_seq_new(size); + if (!values) { + asdl_seq_free(keys); + return NULL; + } for (i = 0; i < NCH(ch); i += 4) { asdl_seq_SET(keys, i / 4, ast_for_expr(CHILD(ch, i))); *************** *** 593,601 **** } return Dict(keys, values); - break; } case BACKQUOTE: /* repr */ return Repr(ast_for_testlist(CHILD(n, 1))); - break; default: fprintf(stderr, "unhandled atom %d\n", TYPE(ch)); --- 617,623 ---- *************** *** 710,713 **** --- 732,737 ---- } seq = asdl_seq_new((NCH(n) + 1) / 2); + if (!seq) + return NULL; for (i = 0; i < NCH(n); i += 2) { expr_ty e = ast_for_expr(CHILD(n, i)); *************** *** 737,741 **** --- 761,771 ---- asdl_seq *ops, *cmps; ops = asdl_seq_new(NCH(n) / 2); + if (!ops) + return NULL; cmps = asdl_seq_new(NCH(n) / 2); + if (!cmps) { + asdl_seq_free(ops); + return NULL; + } for (i = 1; i < NCH(n); i += 2) { /* XXX cmpop_ty is just an enum */ *************** *** 805,808 **** --- 835,840 ---- int j; asdl_seq *slices = asdl_seq_new(NCH(ch) / 2); + if (!slices) + return NULL; for (j = 0; j < NCH(ch); j += 2) asdl_seq_SET(slices, j / 2, *************** *** 848,851 **** --- 880,885 ---- args = asdl_seq_new(nargs); + if (!args) + return NULL; for (i = 0; i < NCH(n); i++) { node *ch = CHILD(n, i); *************** *** 905,913 **** REQ(CHILD(n, 1), EQUAL); targets = asdl_seq_new(NCH(n) / 2); for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e = ast_for_testlist(CHILD(n, i)); /* set context to assign */ ! if (!e) ! return NULL; set_context(e, Store); asdl_seq_SET(targets, i / 2, e); --- 939,951 ---- REQ(CHILD(n, 1), EQUAL); targets = asdl_seq_new(NCH(n) / 2); + if (!targets) + return NULL; for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e = ast_for_testlist(CHILD(n, i)); /* set context to assign */ ! if (!e) { ! asdl_seq_free(targets); ! return NULL; ! } set_context(e, Store); asdl_seq_SET(targets, i / 2, e); *************** *** 936,939 **** --- 974,979 ---- } seq = asdl_seq_new((NCH(n) + 1 - start) / 2); + if (!seq) + return NULL; for (i = start; i < NCH(n); i += 2) { asdl_seq_APPEND(seq, ast_for_expr(CHILD(n, i))); *************** *** 954,961 **** seq = asdl_seq_new((NCH(n) + 1) / 2); for (i = 0; i < NCH(n); i += 2) { e = ast_for_expr(CHILD(n, i)); ! if (!e) ! return NULL; if (context) set_context(e, context); --- 994,1005 ---- seq = asdl_seq_new((NCH(n) + 1) / 2); + if (!seq) + return NULL; for (i = 0; i < NCH(n); i += 2) { e = ast_for_expr(CHILD(n, i)); ! if (!e) { ! asdl_seq_free(seq); ! return NULL; ! } if (context) set_context(e, context); *************** *** 1100,1110 **** if (STR(CHILD(n, 0))[0] == 'i') { /* import */ aliases = asdl_seq_new(NCH(n) / 2); for (i = 1; i < NCH(n); i += 2) asdl_seq_SET(aliases, i / 2, alias_for_import_name(CHILD(n, i))); return Import(aliases, LINENO(n)); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ - alias_ty mod = alias_for_import_name(CHILD(n, 1)); stmt_ty import; aliases = asdl_seq_new((NCH(n) - 2) / 2); for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); --- 1144,1162 ---- if (STR(CHILD(n, 0))[0] == 'i') { /* import */ aliases = asdl_seq_new(NCH(n) / 2); + if (!aliases) + return NULL; for (i = 1; i < NCH(n); i += 2) asdl_seq_SET(aliases, i / 2, alias_for_import_name(CHILD(n, i))); return Import(aliases, LINENO(n)); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ stmt_ty import; + alias_ty mod = alias_for_import_name(CHILD(n, 1)); + if (!mod) + return NULL; aliases = asdl_seq_new((NCH(n) - 2) / 2); + if (!aliases) { + free(mod); + return NULL; + } for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); *************** *** 1126,1133 **** REQ(n, global_stmt); s = asdl_seq_new(NCH(n) / 2); for (i = 1; i < NCH(n); i += 2) { name = NEW_IDENTIFIER(CHILD(n, i)); ! if (!name) return NULL; asdl_seq_SET(s, i / 2, name); } --- 1178,1189 ---- REQ(n, global_stmt); s = asdl_seq_new(NCH(n) / 2); + if (!s) + return NULL; for (i = 1; i < NCH(n); i += 2) { name = NEW_IDENTIFIER(CHILD(n, i)); ! if (!name) { ! asdl_seq_free(s); return NULL; + } asdl_seq_SET(s, i / 2, name); } *************** *** 1179,1182 **** --- 1235,1240 ---- total = num_stmts(n); seq = asdl_seq_new(total); + if (!seq) + return NULL; if (TYPE(CHILD(n, 0)) == simple_stmt) { n = CHILD(n, 0); *************** *** 1257,1260 **** --- 1315,1320 ---- if (has_else) { orelse = asdl_seq_new(1); + if (!orelse) + return NULL; asdl_seq_SET(orelse, 0, If(ast_for_expr(CHILD(n, NCH(n) - 6)), *************** *** 1270,1273 **** --- 1330,1335 ---- int off = 5 + (n_elif - i - 1) * 4; asdl_seq *new = asdl_seq_new(1); + if (!new) + return NULL; asdl_seq_SET(new, 0, If(ast_for_expr(CHILD(n, off)), *************** *** 1369,1372 **** --- 1431,1436 ---- n_except /= 3; handlers = asdl_seq_new(n_except); + if (!handlers) + return NULL; for (i = 0; i < n_except; i++) asdl_seq_SET(handlers, i, *************** *** 1396,1404 **** else { bases = asdl_seq_new(1); asdl_seq_SET(bases, 0, _bases); } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, ast_for_suite(CHILD(n, 6)), LINENO(n)); - return NULL; } --- 1460,1469 ---- else { bases = asdl_seq_new(1); + if (!bases) + return NULL; asdl_seq_SET(bases, 0, _bases); } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, ast_for_suite(CHILD(n, 6)), LINENO(n)); } From nnorwitz@users.sourceforge.net Thu Apr 3 00:55:03 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 02 Apr 2003 16:55:03 -0800 Subject: [Python-checkins] python/dist/src/Python asdl.c,1.1.2.4,1.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv26182/Python Modified Files: Tag: ast-branch asdl.c Log Message: Need to set PyExc_MemoryError after PyObject_Malloc fails Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/asdl.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** asdl.c 3 Apr 2003 00:49:02 -0000 1.1.2.4 --- asdl.c 3 Apr 2003 00:55:00 -0000 1.1.2.5 *************** *** 7,12 **** asdl_seq *seq = (asdl_seq *)PyObject_Malloc(sizeof(asdl_seq) + sizeof(void *) * (size - 1)); ! if (!seq) return NULL; seq->size = size; seq->offset = 0; --- 7,14 ---- asdl_seq *seq = (asdl_seq *)PyObject_Malloc(sizeof(asdl_seq) + sizeof(void *) * (size - 1)); ! if (!seq) { ! PyErr_SetString(PyExc_MemoryError, "no memory"); return NULL; + } seq->size = size; seq->offset = 0; From loewis@users.sourceforge.net Thu Apr 3 04:49:14 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:14 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.711,1.712 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Misc Modified Files: NEWS Log Message: Revert Patch #670715: iconv support. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.711 retrieving revision 1.712 diff -C2 -d -r1.711 -r1.712 *** NEWS 2 Apr 2003 16:57:59 -0000 1.711 --- NEWS 3 Apr 2003 04:49:11 -0000 1.712 *************** *** 42,45 **** --- 42,47 ---- ----------------- + - The iconv module has been removed from this release. + - The platform-independent routines for packing floats in IEEE formats (struct.pack's f, d codes; pickle and cPickle's protocol 1 *************** *** 106,111 **** ----- - - Fix build problems when _iconv_codec failed. (SF bug #690012.) - - Fix problem building on OSF1 because the compiler only accepted preprocessor directives that start in column 1. (SF bug #691793.) --- 108,111 ---- *************** *** 276,282 **** - The SSL module now handles sockets with a timeout set correctly (SF patch #675750, fixing SF bug #675552). - - - A new module _iconv_codec has been added, to expose the iconv(3) - library. - os/posixmodule has grown the sysexits.h constants (EX_OK and friends). --- 276,279 ---- From loewis@users.sourceforge.net Thu Apr 3 04:49:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.136,1.137 test_iconv_codecs.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Lib/test Modified Files: regrtest.py Removed Files: test_iconv_codecs.py Log Message: Revert Patch #670715: iconv support. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** regrtest.py 29 Mar 2003 22:01:17 -0000 1.136 --- regrtest.py 3 Apr 2003 04:49:11 -0000 1.137 *************** *** 570,574 **** test_gl test_grp - test_iconv_codecs test_imgfile test_ioctl --- 570,573 ---- *************** *** 627,631 **** test_gl test_grp - test_iconv_codecs test_ioctl test_imgfile --- 626,629 ---- *************** *** 775,779 **** test_gdbm test_gl - test_iconv_codecs test_imgfile test_largefile --- 773,776 ---- *************** *** 891,895 **** test_email_codecs test_gl - test_iconv_codecs test_imgfile test_largefile --- 888,891 ---- --- test_iconv_codecs.py DELETED --- From loewis@users.sourceforge.net Thu Apr 3 04:49:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:13 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv24599 Modified Files: setup.py Log Message: Revert Patch #670715: iconv support. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** setup.py 31 Mar 2003 15:53:29 -0000 1.158 --- setup.py 3 Apr 2003 04:49:11 -0000 1.159 *************** *** 623,644 **** libraries = libs) ) - # Hye-Shik Chang's iconv_codec C interface - iconv_incs = find_file('iconv.h', inc_dirs, - ['/usr/local/include', '/usr/pkg/include']) - iconv_libs = find_library_file(self.compiler, 'iconv', lib_dirs, - ['/usr/local/lib', '/usr/pkg/lib']) - - if platform not in ['darwin'] and iconv_incs is not None: - if iconv_libs is not None: - iconv_libraries = ['iconv'] - else: - iconv_libraries = [] # in libc - - exts.append( Extension('_iconv_codec', - ['_iconv_codec.c'], - include_dirs = iconv_incs, - library_dirs = iconv_libs, - libraries = iconv_libraries), ) - # Curses support, requring the System V version of curses, often # provided by the ncurses library. --- 623,626 ---- From loewis@users.sourceforge.net Thu Apr 3 04:49:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:15 -0800 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.38,1.39 _iconv_codec.c,1.14,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Modules Modified Files: Setup.dist Removed Files: _iconv_codec.c Log Message: Revert Patch #670715: iconv support. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Setup.dist 20 Mar 2003 23:37:24 -0000 1.38 --- Setup.dist 3 Apr 2003 04:49:12 -0000 1.39 *************** *** 479,486 **** #pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat - # Wrapper for iconv(3). This requires either GNU iconv, or a native - # iconv implementation (only Linux, Solaris, and BSD are known to work) - #_iconv_codec _iconv_codec -I$(prefix)/include -L$(exec_prefix)/lib -liconv - # Example -- included for reference only: # xx xxmodule.c --- 479,482 ---- --- _iconv_codec.c DELETED --- From loewis@users.sourceforge.net Thu Apr 3 04:49:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.16,1.17 iconv_codec.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Lib/encodings Modified Files: __init__.py Removed Files: iconv_codec.py Log Message: Revert Patch #670715: iconv support. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** __init__.py 28 Feb 2003 20:00:42 -0000 1.16 --- __init__.py 3 Apr 2003 04:49:11 -0000 1.17 *************** *** 122,128 **** codecs.register(search_function) - # Register iconv_codec lookup function if available - try: - import iconv_codec - except (ImportError, RuntimeError): - pass --- 122,123 ---- --- iconv_codec.py DELETED --- From jhylton@users.sourceforge.net Thu Apr 3 13:50:40 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 05:50:40 -0800 Subject: [Python-checkins] python/dist/src/Include compile.h,2.37.2.5,2.37.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv5307 Modified Files: Tag: ast-branch compile.h Log Message: Add i_lineno to struct instr. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37.2.5 retrieving revision 2.37.2.6 diff -C2 -d -r2.37.2.5 -r2.37.2.6 *** compile.h 24 Mar 2003 23:44:18 -0000 2.37.2.5 --- compile.h 3 Apr 2003 13:50:37 -0000 2.37.2.6 *************** *** 26,30 **** DL_IMPORT(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); ! #define DEFAULT_BLOCK_SIZE 32 #define DEFAULT_BLOCKS 8 #define DEFAULT_CODE_SIZE 128 --- 26,30 ---- DL_IMPORT(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); ! #define DEFAULT_BLOCK_SIZE 16 #define DEFAULT_BLOCKS 8 #define DEFAULT_CODE_SIZE 128 *************** *** 36,39 **** --- 36,40 ---- unsigned char i_opcode; int i_oparg; + int i_lineno; }; From jhylton@users.sourceforge.net Thu Apr 3 13:52:27 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 05:52:27 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.50,1.1.2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5957 Modified Files: Tag: ast-branch newcompile.c Log Message: Add some infrastructure for creating lnotab. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.50 retrieving revision 1.1.2.51 diff -C2 -d -r1.1.2.50 -r1.1.2.51 *** newcompile.c 1 Apr 2003 22:17:00 -0000 1.1.2.50 --- newcompile.c 3 Apr 2003 13:52:24 -0000 1.1.2.51 *************** *** 44,48 **** int u_curblock; /* index of current block in u_blocks */ int u_tmpname; /* temporary variables for list comps */ ! identifier u_tmp; /* name for u_tmpname */ struct basicblock u_exit; struct basicblock **u_blocks; --- 44,48 ---- int u_curblock; /* index of current block in u_blocks */ int u_tmpname; /* temporary variables for list comps */ ! identifier u_tmp; /* name for u_tmpname */ struct basicblock u_exit; struct basicblock **u_blocks; *************** *** 51,55 **** struct fblockinfo u_fblock[CO_MAXBLOCKS]; ! int u_lineno; }; --- 51,57 ---- struct fblockinfo u_fblock[CO_MAXBLOCKS]; ! int u_lineno; /* the lineno for the current stmt */ ! bool u_lineno_set; /* boolean to indicate whether instr ! has been generated with current lineno */ }; *************** *** 68,71 **** --- 70,74 ---- struct assembler { PyObject *a_bytecode; /* string containing bytecode */ + PyObject *a_lnotab; /* string containing lnotab */ int a_offset; /* offset into bytecode */ int a_nblocks; /* number of reachable blocks */ *************** *** 285,288 **** --- 288,293 ---- u->u_tmpname = 0; u->u_nfblocks = 0; + u->u_lineno = 0; + u->u_lineno_set = true; memset(u->u_blocks, 0, sizeof(struct basicblock *) * DEFAULT_BLOCKS); u->u_consts = PyDict_New(); *************** *** 483,486 **** --- 488,502 ---- */ + static void + compiler_set_lineno(struct compiler *c, int off) + { + struct basicblock *b; + if (c->u->u_lineno_set) + return; + c->u->u_lineno_set = true; + b = c->u->u_blocks[c->u->u_curblock]; + b->b_instr[off].i_lineno = c->u->u_lineno; + } + static int compiler_addop(struct compiler *c, int opcode) *************** *** 492,495 **** --- 508,512 ---- if (off < 0) return 0; + compiler_set_lineno(c, off); b = c->u->u_blocks[c->u->u_curblock]; i = &b->b_instr[off]; *************** *** 537,540 **** --- 554,558 ---- if (off < 0) return 0; + compiler_set_lineno(c, off); i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off]; i->i_opcode = opcode; *************** *** 549,555 **** --- 567,576 ---- struct instr *i; int off; + + assert(block >= 0); off = compiler_next_instr(c, c->u->u_curblock); if (off < 0) return 0; + compiler_set_lineno(c, off); i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off]; i->i_opcode = opcode; *************** *** 1192,1196 **** fprintf(stderr, "compile stmt %d lineno %d\n", s->kind, s->lineno); ! c->u->u_lineno = s->lineno; /* XXX this isn't right */ switch (s->kind) { case FunctionDef_kind: --- 1213,1218 ---- fprintf(stderr, "compile stmt %d lineno %d\n", s->kind, s->lineno); ! c->u->u_lineno = s->lineno; ! c->u->u_lineno_set = false; switch (s->kind) { case FunctionDef_kind: *************** *** 1563,1567 **** compiler_compare(struct compiler *c, expr_ty e) { ! int i, n, cleanup; VISIT(c, expr, e->v.Compare.left); --- 1585,1589 ---- compiler_compare(struct compiler *c, expr_ty e) { ! int i, n, cleanup = -1; VISIT(c, expr, e->v.Compare.left); *************** *** 2026,2029 **** --- 2048,2101 ---- } + /* All about c_lnotab. + + c_lnotab is an array of unsigned bytes disguised as a Python string. In -O + mode, SET_LINENO opcodes aren't generated, and bytecode offsets are mapped + to source code line #s (when needed for tracebacks) via c_lnotab instead. + The array is conceptually a list of + (bytecode offset increment, line number increment) + pairs. The details are important and delicate, best illustrated by example: + + byte code offset source code line number + 0 1 + 6 2 + 50 7 + 350 307 + 361 308 + + The first trick is that these numbers aren't stored, only the increments + from one row to the next (this doesn't really work, but it's a start): + + 0, 1, 6, 1, 44, 5, 300, 300, 11, 1 + + The second trick is that an unsigned byte can't hold negative values, or + values larger than 255, so (a) there's a deep assumption that byte code + offsets and their corresponding line #s both increase monotonically, and (b) + if at least one column jumps by more than 255 from one row to the next, more + than one pair is written to the table. In case #b, there's no way to know + from looking at the table later how many were written. That's the delicate + part. A user of c_lnotab desiring to find the source line number + corresponding to a bytecode address A should do something like this + + lineno = addr = 0 + for addr_incr, line_incr in c_lnotab: + addr += addr_incr + if addr > A: + return lineno + lineno += line_incr + + In order for this to work, when the addr field increments by more than 255, + the line # increment in each pair generated must be 0 until the remaining addr + increment is < 256. So, in the example above, com_set_lineno should not (as + was actually done until 2.2) expand 300, 300 to 255, 255, 45, 45, but to + 255, 0, 45, 255, 0, 45. + */ + + static int + assemble_lnotab(struct assembler *a) + { + return 1; + } + /* Return the size of a basic block in bytes. */ *************** *** 2251,2254 **** --- 2323,2328 ---- /* Can't modify the bytecode after computing jump offsets. */ if (!assemble_jump_offsets(&a, c)) + goto error; + if (!assemble_lnotab(&a)) goto error; From jhylton@users.sourceforge.net Thu Apr 3 16:28:44 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 08:28:44 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25214/Modules Modified Files: gcmodule.c Log Message: Add get_referrents() helper function. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** gcmodule.c 9 Nov 2002 19:54:06 -0000 2.56 --- gcmodule.c 3 Apr 2003 16:28:38 -0000 2.57 *************** *** 829,832 **** --- 829,860 ---- } + static int + referrentsvisit(PyObject *obj, PyObject *list) + { + if (PyList_Append(list, obj) < 0) + return 1; + return 0; + } + + PyDoc_STRVAR(gc_get_referrents__doc__, + "get_referrents(*objs) -> list\n\ + Return the list of objects that directly refer to any of objs."); + + static PyObject * + gc_get_referrents(PyObject *self, PyObject *args) + { + int i; + PyObject *result = PyList_New(0); + for (i = 0; i < PyTuple_GET_SIZE(args); i++) { + PyObject *obj = PyTuple_GET_ITEM(args, i); + traverseproc traverse = obj->ob_type->tp_traverse; + if (!traverse) + continue; + if (traverse(obj, (visitproc)referrentsvisit, result)) + return NULL; + } + return result; + } + PyDoc_STRVAR(gc_get_objects__doc__, "get_objects() -> [...]\n" *************** *** 885,889 **** "get_threshold() -- Return the current the collection thresholds.\n" "get_objects() -- Return a list of all objects tracked by the collector.\n" ! "get_referrers() -- Return the list of objects that refer to an object.\n"); static PyMethodDef GcMethods[] = { --- 913,918 ---- "get_threshold() -- Return the current the collection thresholds.\n" "get_objects() -- Return a list of all objects tracked by the collector.\n" ! "get_referrers() -- Return the list of objects that refer to an object.\n" ! "get_referrents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { *************** *** 899,902 **** --- 928,933 ---- {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, + {"get_referrents", gc_get_referrents, METH_VARARGS, + gc_get_referrents__doc__}, {NULL, NULL} /* Sentinel */ }; From jhylton@users.sourceforge.net Thu Apr 3 16:29:16 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 08:29:16 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25530/Modules Modified Files: gcmodule.c Log Message: Add get_referrents() helper function. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** gcmodule.c 3 Apr 2003 16:28:38 -0000 2.57 --- gcmodule.c 3 Apr 2003 16:29:13 -0000 2.58 *************** *** 839,843 **** PyDoc_STRVAR(gc_get_referrents__doc__, "get_referrents(*objs) -> list\n\ ! Return the list of objects that directly refer to any of objs."); static PyObject * --- 839,843 ---- PyDoc_STRVAR(gc_get_referrents__doc__, "get_referrents(*objs) -> list\n\ ! Return the list of objects that are directly referred to by objs."); static PyObject * From jhylton@users.sourceforge.net Thu Apr 3 23:02:34 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 15:02:34 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.5,2.33.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26899 Modified Files: Tag: release22-maint gcmodule.c Log Message: Fix memory corruption in garbage collection. The move_finalizers() routine checks each object in the unreachable list to see if it has a finalizer. If it does, it is moved to the finalizers list. The collector checks by calling, effectively, hasattr(obj, "__del__"). The hasattr() call can result in an arbitrary amount of Python code being run, because it will invoke getattr hooks on obj. If a getattr() hook is run from move_finalizers(), it may end up resurrecting or deallocating objects in the unreachable list. In fact, it's possible that the hook causes the next object in the list to be deallocated. That is, the object pointed to by gc->gc.gc_next may be freed before has_finalizer() returns. The problem with the previous revision is that it followed gc->gc.gc_next before calling has_finalizer(). If has_finalizer() gc->happened to deallocate the object FROM_GC(gc->gc.gc_next), then the next time through the loop gc would point to freed memory. The fix is to always follow the next pointer after calling has_finalizer(). Note that Python 2.3 does not have this problem, because has_finalizer() checks the tp_del slot and never runs Python code. Tim, Barry, and I peed away the better part of two days tracking this down. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.5 retrieving revision 2.33.6.6 diff -C2 -d -r2.33.6.5 -r2.33.6.6 *** gcmodule.c 30 Jun 2002 18:48:53 -0000 2.33.6.5 --- gcmodule.c 3 Apr 2003 23:02:29 -0000 2.33.6.6 *************** *** 277,286 **** for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! next = gc->gc.gc_next; if (has_finalizer(op)) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } } } --- 277,290 ---- for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* has_finalizer() may result in arbitrary Python ! code being run. */ if (has_finalizer(op)) { + next = gc->gc.gc_next; gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } + else + next = gc->gc.gc_next; } } From gward@users.sourceforge.net Fri Apr 4 01:47:45 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 03 Apr 2003 17:47:45 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13667/Modules Modified Files: ossaudiodev.c Log Message: Use fcntl() to put the audio device *back* into blocking mode after opening it in non-blocking mode. Both Guido and David Hammerton have reported that this fixes their problems with ossaudiodev -- hooray! Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ossaudiodev.c 11 Mar 2003 16:53:13 -0000 1.25 --- ossaudiodev.c 4 Apr 2003 01:47:42 -0000 1.26 *************** *** 140,143 **** --- 140,152 ---- return NULL; } + + /* And (try to) put it back in blocking mode so we get the + expected write() semantics. */ + if (fcntl(fd, F_SETFL, 0) == -1) { + close(fd); + PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); + return NULL; + } + if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); From bwarsaw@users.sourceforge.net Fri Apr 4 02:46:41 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:46:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.13.2.3,1.13.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv597 Modified Files: Tag: release22-maint Header.py Log Message: Backporting: revision 1.27 date: 2003/03/30 20:46:47; author: bwarsaw; state: Exp; lines: +3 -3 __unicode__(): Fix the logic for calculating whether to add a separating space or not between encoded chunks. Closes SF bug #710498. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.13.2.3 retrieving revision 1.13.2.4 diff -C2 -d -r1.13.2.3 -r1.13.2.4 *** Header.py 21 Mar 2003 21:09:31 -0000 1.13.2.3 --- Header.py 4 Apr 2003 02:46:38 -0000 1.13.2.4 *************** *** 216,224 **** nextcs = charset if uchunks: ! if lastcs is not None: ! if nextcs is None or nextcs == 'us-ascii': uchunks.append(USPACE) nextcs = None ! elif nextcs is not None and nextcs <> 'us-ascii': uchunks.append(USPACE) lastcs = nextcs --- 216,224 ---- nextcs = charset if uchunks: ! if lastcs not in (None, 'us-ascii'): ! if nextcs in (None, 'us-ascii'): uchunks.append(USPACE) nextcs = None ! elif nextcs not in (None, 'us-ascii'): uchunks.append(USPACE) lastcs = nextcs From bwarsaw@users.sourceforge.net Fri Apr 4 02:47:09 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:47:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.4.10.5,1.4.10.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv790 Modified Files: Tag: release22-maint __init__.py Log Message: Backporting email 2.5.1 patches. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.4.10.5 retrieving revision 1.4.10.6 diff -C2 -d -r1.4.10.5 -r1.4.10.6 *** __init__.py 21 Mar 2003 21:09:31 -0000 1.4.10.5 --- __init__.py 4 Apr 2003 02:47:07 -0000 1.4.10.6 *************** *** 5,9 **** """ ! __version__ = '2.5' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.1' __all__ = [ From bwarsaw@users.sourceforge.net Fri Apr 4 02:47:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:47:56 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py,1.4.2.2,1.4.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1057 Modified Files: Tag: release22-maint _compat21.py Log Message: Backporting: typed_subpart_iterator(): Fix these to use non-deprecated APIs, i.e. get_content_maintype() and get_content_subtype(). Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** _compat21.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 --- _compat21.py 4 Apr 2003 02:47:54 -0000 1.4.2.3 *************** *** 64,69 **** parts = [] for subpart in msg.walk(): ! if subpart.get_main_type('text') == maintype: ! if subtype is None or subpart.get_subtype('plain') == subtype: parts.append(subpart) return parts --- 64,69 ---- parts = [] for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: parts.append(subpart) return parts From bwarsaw@users.sourceforge.net Fri Apr 4 02:48:20 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:48:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.4.2.2,1.4.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1257 Modified Files: Tag: release22-maint _compat22.py Log Message: Backporting: typed_subpart_iterator(): Fix these to use non-deprecated APIs, i.e. get_content_maintype() and get_content_subtype(). Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** _compat22.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 --- _compat22.py 4 Apr 2003 02:48:18 -0000 1.4.2.3 *************** *** 2,6 **** # Author: barry@zope.com ! """Module containing compatibility functions for Python 2.1. """ --- 2,6 ---- # Author: barry@zope.com ! """Module containing compatibility functions for Python 2.2. """ *************** *** 10,13 **** --- 10,20 ---- from types import StringTypes + # Python 2.2.x where x < 1 lacks True/False + try: + True, False + except NameError: + True = 1 + False = 0 + *************** *** 59,63 **** """ for subpart in msg.walk(): ! if subpart.get_main_type('text') == maintype: ! if subtype is None or subpart.get_subtype('plain') == subtype: yield subpart --- 66,70 ---- """ for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: yield subpart From jhylton@users.sourceforge.net Fri Apr 4 19:59:10 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 04 Apr 2003 11:59:10 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv829 Modified Files: gcmodule.c Log Message: Fix Tim's boom example. move_finalizers() moves every object from unreachable to collectable or finalizers, unless the object is deallocated first. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** gcmodule.c 3 Apr 2003 16:29:13 -0000 2.58 --- gcmodule.c 4 Apr 2003 19:59:06 -0000 2.59 *************** *** 60,63 **** --- 60,66 ---- static PyObject *gc_str; + /* Python string used to looked for __del__ attribute. */ + static PyObject *delstr; + /* set for debugging information */ #define DEBUG_STATS (1<<0) /* print collection statistics */ *************** *** 341,350 **** has_finalizer(PyObject *op) { - static PyObject *delstr = NULL; - if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); - if (delstr == NULL) - Py_FatalError("PyGC: can't initialize __del__ string"); - } return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) : PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ? --- 344,347 ---- *************** *** 352,369 **** } ! /* Move all objects with finalizers (instances with __del__) */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { ! PyGC_Head *next; ! PyGC_Head *gc = unreachable->gc.gc_next; ! for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! next = gc->gc.gc_next; ! if (has_finalizer(op)) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_REACHABLE; } } } --- 349,393 ---- } ! /* Move all objects out of unreachable and into collectable or finalizers. ! */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *collectable, ! PyGC_Head *finalizers) { ! while (!gc_list_is_empty(unreachable)) { ! PyGC_Head *gc = unreachable->gc.gc_next; PyObject *op = FROM_GC(gc); ! int finalizer; ! ! if (PyInstance_Check(op)) { ! /* The HasAttr() check may run enough Python ! code to deallocate the object or make it ! reachable again. INCREF the object before ! calling HasAttr() to guard against the client ! code deallocating the object. ! */ ! Py_INCREF(op); ! finalizer = PyObject_HasAttr(op, delstr); ! if (op->ob_refcnt == 1) { ! /* The object will be deallocated. ! Nothing left to do. ! */ ! Py_DECREF(op); ! continue; ! } ! Py_DECREF(op); ! } ! else ! finalizer = has_finalizer(op); ! if (finalizer) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_REACHABLE; } + else { + gc_list_remove(gc); + gc_list_append(gc, collectable); + /* XXX change gc_refs? */ + } } } *************** *** 438,441 **** --- 462,466 ---- gc = finalizers->gc.gc_next) { PyObject *op = FROM_GC(gc); + /* XXX has_finalizer() is not safe here. */ if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { /* If SAVEALL is not set then just append objects with *************** *** 458,467 **** */ static void ! delete_garbage(PyGC_Head *unreachable, PyGC_Head *old) { inquiry clear; ! while (!gc_list_is_empty(unreachable)) { ! PyGC_Head *gc = unreachable->gc.gc_next; PyObject *op = FROM_GC(gc); --- 483,492 ---- */ static void ! delete_garbage(PyGC_Head *collectable, PyGC_Head *old) { inquiry clear; ! while (!gc_list_is_empty(collectable)) { ! PyGC_Head *gc = collectable->gc.gc_next; PyObject *op = FROM_GC(gc); *************** *** 477,481 **** } } ! if (unreachable->gc.gc_next == gc) { /* object is still alive, move it, it may die later */ gc_list_remove(gc); --- 502,506 ---- } } ! if (collectable->gc.gc_next == gc) { /* object is still alive, move it, it may die later */ gc_list_remove(gc); *************** *** 497,500 **** --- 522,526 ---- PyGC_Head *old; /* next older generation */ PyGC_Head unreachable; + PyGC_Head collectable; PyGC_Head finalizers; PyGC_Head *gc; *************** *** 553,564 **** * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. */ gc_list_init(&finalizers); ! move_finalizers(&unreachable, &finalizers); move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; --- 579,595 ---- * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. + * + * Move each object into the collectable set or the finalizers set. + * It's possible that a classic class with a getattr() hook will + * be revived or deallocated in this step. */ + gc_list_init(&collectable); gc_list_init(&finalizers); ! move_finalizers(&unreachable, &collectable, &finalizers); move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = collectable.gc.gc_next; gc != &collectable; gc = gc->gc.gc_next) { m++; *************** *** 570,574 **** * the reference cycles to be broken. It may also cause some objects in * finalizers to be freed */ ! delete_garbage(&unreachable, old); /* Collect statistics on uncollectable objects found and print --- 601,605 ---- * the reference cycles to be broken. It may also cause some objects in * finalizers to be freed */ ! delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print *************** *** 939,942 **** --- 970,976 ---- PyObject *d; + delstr = PyString_InternFromString("__del__"); + if (!delstr) + return; m = Py_InitModule4("gc", GcMethods, From jhylton@users.sourceforge.net Fri Apr 4 20:00:12 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 04 Apr 2003 12:00:12 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1131 Modified Files: test_gc.py Log Message: Add Tim's gc boom test to the test suite. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_gc.py 11 Aug 2002 04:15:09 -0000 1.23 --- test_gc.py 4 Apr 2003 20:00:04 -0000 1.24 *************** *** 254,257 **** --- 254,275 ---- gc.disable() + class C: + def __getattr__(self, attr): + del self.attr + raise AttributeError + + def test_boom(): + a = C() + b = C() + a.attr = b + b.attr = a + + gc.collect() + del a, b + # the collection will invoke the getattr and decref one of the + # object. so they are deallocated without being reported as + # part of a cycle. + expect(gc.collect(), 0, "boom") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 272,275 **** --- 290,294 ---- run_test("saveall", test_saveall) run_test("trashcan", test_trashcan) + run_test("boom", test_boom) def test(): From goodger@users.sourceforge.net Fri Apr 4 21:20:03 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 04 Apr 2003 13:20:03 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv747 Modified Files: pep-0313.txt Log Message: update from Mike Meyer Index: pep-0313.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0313.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0313.txt 1 Apr 2003 17:41:34 -0000 1.2 --- pep-0313.txt 4 Apr 2003 21:19:59 -0000 1.3 *************** *** 14,21 **** Abstract ! This PEP proposes adding Roman numerals as a literal type. It ! also proposes the new built-in function "roman", which converts an ! object to an integer, then converts the integer to a string that ! is the Roman numeral literal equivalent to the integer. --- 14,22 ---- Abstract ! This PEP (also known as PEP CCCXIII) proposes adding Roman ! numerals as a literal type. It also proposes the new built-in ! function "roman", which converts an object to an integer, then ! converts the integer to a string that is the Roman numeral literal ! equivalent to the integer. *************** *** 39,48 **** 1. Except as noted below, they must appear in the order M, D, C, ! L, X, V then I. Each occurence of each character adds 1000, 500, 100, 50, 10, 5 and 1 to the value of the literal, respectively. 2. Only one D, V or L may appear in any given literal. ! 3. At most three Is, Xs and Cs may appear in any given literal. 4. A single I may appear immediately to the left of the single V, --- 40,50 ---- 1. Except as noted below, they must appear in the order M, D, C, ! L, X, V then I. Each occurrence of each character adds 1000, 500, 100, 50, 10, 5 and 1 to the value of the literal, respectively. 2. Only one D, V or L may appear in any given literal. ! 3. At most three each of Is, Xs and Cs may appear consecutively ! in any given literal. 4. A single I may appear immediately to the left of the single V, *************** *** 63,74 **** ! Builtin "roman" Function ! The new builtin function "roman" will aide the translation from integers to Roman numeral literals. It will accept a single object as an argument, and return a string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239 [1]) it will passed through the existing ! builtin "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal --- 65,76 ---- ! Built-In "roman" Function ! The new built-in function "roman" will aide the translation from integers to Roman numeral literals. It will accept a single object as an argument, and return a string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239 [1]) it will passed through the existing ! built-in "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal *************** *** 77,81 **** ! Compatability Issues No new keywords are introduced by this proposal. Programs that --- 79,83 ---- ! Compatibility Issues No new keywords are introduced by this proposal. Programs that From goodger@users.sourceforge.net Fri Apr 4 21:21:42 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 04 Apr 2003 13:21:42 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv1644 Modified Files: pep-0313.txt Log Message: real ^L Index: pep-0313.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0313.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0313.txt 4 Apr 2003 21:19:59 -0000 1.3 --- pep-0313.txt 4 Apr 2003 21:21:38 -0000 1.4 *************** *** 109,113 **** ! ^L Local Variables: mode: indented-text --- 109,113 ---- ! Local Variables: mode: indented-text From rhettinger@users.sourceforge.net Fri Apr 4 22:56:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 04 Apr 2003 14:56:44 -0800 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18890/Lib Modified Files: unittest.py Log Message: SF bug #715145: unittest.py still uses != in failUnlessEqual Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** unittest.py 27 Feb 2003 20:14:43 -0000 1.22 --- unittest.py 4 Apr 2003 22:56:41 -0000 1.23 *************** *** 286,293 **** def failUnlessEqual(self, first, second, msg=None): ! """Fail if the two objects are unequal as determined by the '!=' operator. """ ! if first != second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) --- 286,293 ---- def failUnlessEqual(self, first, second, msg=None): ! """Fail if the two objects are unequal as determined by the '==' operator. """ ! if not first == second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) From rhettinger@users.sourceforge.net Fri Apr 4 22:56:45 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 04 Apr 2003 14:56:45 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.712,1.713 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18890/Misc Modified Files: NEWS Log Message: SF bug #715145: unittest.py still uses != in failUnlessEqual Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.712 retrieving revision 1.713 diff -C2 -d -r1.712 -r1.713 *** NEWS 3 Apr 2003 04:49:11 -0000 1.712 --- NEWS 4 Apr 2003 22:56:42 -0000 1.713 *************** *** 74,77 **** --- 74,81 ---- ------- + - unittest.failUnlessEqual and its equivalent unittest.assertEqual now + return 'not a == b' rather than 'a != b'. This gives the desired + result for classes that define __eq__ without defining __ne__. + - sgmllib now supports SGML marked sections, in particular the MS Office extensions. From tim_one@users.sourceforge.net Sat Apr 5 17:15:47 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 09:15:47 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv1289/Modules Modified Files: gcmodule.c Log Message: Fixed new seemingly random segfaults, by moving the initialization of delstr from initgc() into collect(). initgc() isn't called unless the user explicitly imports gc, so can be used only for initialization of user-visible module features; delstr needs to be initialized for proper internal operation, whether or not gc is explicitly imported. Bugfix candidate? I don't know whether the new bug was backported to 2.2 already. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** gcmodule.c 4 Apr 2003 19:59:06 -0000 2.59 --- gcmodule.c 5 Apr 2003 17:15:44 -0000 2.60 *************** *** 60,65 **** static PyObject *gc_str; ! /* Python string used to looked for __del__ attribute. */ ! static PyObject *delstr; /* set for debugging information */ --- 60,65 ---- static PyObject *gc_str; ! /* Python string used to look for __del__ attribute. */ ! static PyObject *delstr = NULL; /* set for debugging information */ *************** *** 370,374 **** finalizer = PyObject_HasAttr(op, delstr); if (op->ob_refcnt == 1) { ! /* The object will be deallocated. Nothing left to do. */ --- 370,374 ---- finalizer = PyObject_HasAttr(op, delstr); if (op->ob_refcnt == 1) { ! /* The object will be deallocated. Nothing left to do. */ *************** *** 526,529 **** --- 526,535 ---- PyGC_Head *gc; + if (delstr == NULL) { + delstr = PyString_InternFromString("__del__"); + if (delstr == NULL) + Py_FatalError("gc couldn't allocate \"__del__\""); + } + if (debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", *************** *** 579,583 **** * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. ! * * Move each object into the collectable set or the finalizers set. * It's possible that a classic class with a getattr() hook will --- 585,589 ---- * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. ! * * Move each object into the collectable set or the finalizers set. * It's possible that a classic class with a getattr() hook will *************** *** 878,882 **** PyObject *result = PyList_New(0); for (i = 0; i < PyTuple_GET_SIZE(args); i++) { ! PyObject *obj = PyTuple_GET_ITEM(args, i); traverseproc traverse = obj->ob_type->tp_traverse; if (!traverse) --- 884,888 ---- PyObject *result = PyList_New(0); for (i = 0; i < PyTuple_GET_SIZE(args); i++) { ! PyObject *obj = PyTuple_GET_ITEM(args, i); traverseproc traverse = obj->ob_type->tp_traverse; if (!traverse) *************** *** 970,976 **** PyObject *d; - delstr = PyString_InternFromString("__del__"); - if (!delstr) - return; m = Py_InitModule4("gc", GcMethods, --- 976,979 ---- From tim_one@users.sourceforge.net Sat Apr 5 17:35:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 09:35:56 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv8673/python/Modules Modified Files: gcmodule.c Log Message: New comments. Rewrote has_finalizer() as a sequence of ifs instead of squashed-together conditional operators; makes it much easier to step thru in the debugger, and to set a breakpoint on the only dangerous path. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** gcmodule.c 5 Apr 2003 17:15:44 -0000 2.60 --- gcmodule.c 5 Apr 2003 17:35:54 -0000 2.61 *************** *** 340,350 **** } ! /* return true if object has a finalization method */ static int has_finalizer(PyObject *op) { ! return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) : ! PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ? ! op->ob_type->tp_del != NULL : 0; } --- 340,363 ---- } ! /* Return true if object has a finalization method. ! * CAUTION: An instance of an old-style class has to be checked for a ! *__del__ method, and that can cause arbitrary Python code to get executed ! * via the class's __getattr__ hook (if any). This function can therefore ! * mutate the object graph, and that's been the source of subtle bugs. ! */ static int has_finalizer(PyObject *op) { ! if (PyInstance_Check(op)) { ! /* This is the dangerous path: hasattr can invoke ! * the class __getattr__(), and that can do anything. ! */ ! assert(delstr != NULL); ! return PyObject_HasAttr(op, delstr); ! } ! else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! return op->ob_type->tp_del != NULL; ! else ! return 0; } *************** *** 587,592 **** * * Move each object into the collectable set or the finalizers set. ! * It's possible that a classic class with a getattr() hook will ! * be revived or deallocated in this step. */ gc_list_init(&collectable); --- 600,607 ---- * * Move each object into the collectable set or the finalizers set. ! * Because we need to check for __del__ methods on instances of ! * classic classes, arbitrary Python code may get executed by ! * getattr hooks: that may resurrect or deallocate (via refcount ! * falling to 0) unreachable objects, so this is very delicate. */ gc_list_init(&collectable); From tim_one@users.sourceforge.net Sat Apr 5 17:46:07 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 09:46:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12012/Lib/test Modified Files: test_gc.py Log Message: test_boom: More comments. Also check that len(gc.garbage) doesn't change (it would be another kind of bug if the trash cycle weren't reclaimed). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_gc.py 4 Apr 2003 20:00:04 -0000 1.24 --- test_gc.py 5 Apr 2003 17:46:04 -0000 1.25 *************** *** 255,259 **** class C: ! def __getattr__(self, attr): del self.attr raise AttributeError --- 255,259 ---- class C: ! def __getattr__(self, someattribute): del self.attr raise AttributeError *************** *** 266,274 **** gc.collect() del a, b ! # the collection will invoke the getattr and decref one of the ! # object. so they are deallocated without being reported as ! # part of a cycle. expect(gc.collect(), 0, "boom") def test_all(): --- 266,279 ---- gc.collect() + garbagelen = len(gc.garbage) del a, b ! # a<->b are in a trash cycle now. Collection will invoke C.__getattr__ ! # (to see whether a and b have __del__ methods), and __getattr__ deletes ! # the internal "attr" attributes as a side effect. That causes the ! # trash cycle to get reclaimed via refcounts falling to 0, thus mutating ! # the trash graph as a side effect of merely asking whether __del__ ! # exists. This used to (before 2.3b1) crash Python. expect(gc.collect(), 0, "boom") + expect(len(gc.garbage), garbagelen, "boom") def test_all(): From tim_one@users.sourceforge.net Sat Apr 5 18:40:53 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 10:40:53 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29089/Modules Modified Files: gcmodule.c Log Message: move_finalizers(): Rewrote. It's not necessary for this routine to special-case classic classes, or to worry about refcounts; has_finalizer() deleted the current object iff the first entry in the unreachable list has changed. I don't believe it was correct to check for ob_refcnt == 1, either: the dealloc routine would get called by Py_DECREF then, but there's nothing to stop the dealloc routine from ressurecting the object, and then gc would remain at the head of the unreachable list despite that its refcount temporarily fell to 0 (and that would lead to an infinite loop in move_finalizers()). I'm still worried about has_finalizer() resurrecting other objects in the unreachable list: what's to stop them from getting collected? Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** gcmodule.c 5 Apr 2003 17:35:54 -0000 2.61 --- gcmodule.c 5 Apr 2003 18:40:50 -0000 2.62 *************** *** 362,366 **** } ! /* Move all objects out of unreachable and into collectable or finalizers. */ static void --- 362,374 ---- } ! /* Move all objects out of unreachable, into collectable or finalizers. ! * It's possible that some objects will get collected (via refcount falling ! * to 0), or resurrected, as a side effect of checking for __del__ methods. ! * After, finalizers contains all the objects from unreachable that haven't ! * been collected by magic, and that have a finalizer. gc_refs is ! * GC_REACHABLE for all of those. collectable contains all the remaining ! * objects from unreachable, and gc_refs remains GC_TENTATIVELY_UNREACHABLE ! * for those (we're still not sure they're reclaimable after this! Some ! * may yet by reachable *from* the objects in finalizers). */ static void *************** *** 373,406 **** int finalizer; ! if (PyInstance_Check(op)) { ! /* The HasAttr() check may run enough Python ! code to deallocate the object or make it ! reachable again. INCREF the object before ! calling HasAttr() to guard against the client ! code deallocating the object. ! */ ! Py_INCREF(op); ! finalizer = PyObject_HasAttr(op, delstr); ! if (op->ob_refcnt == 1) { ! /* The object will be deallocated. ! Nothing left to do. ! */ ! Py_DECREF(op); ! continue; ! } ! Py_DECREF(op); ! } ! else ! finalizer = has_finalizer(op); ! if (finalizer) { ! gc_list_remove(gc); ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! else { gc_list_remove(gc); ! gc_list_append(gc, collectable); ! /* XXX change gc_refs? */ } } } --- 381,397 ---- int finalizer; ! assert(IS_TENTATIVELY_UNREACHABLE(op)); ! ! finalizer = has_finalizer(op); ! if (unreachable->gc.gc_next == gc) { gc_list_remove(gc); ! if (finalizer) { ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! else ! gc_list_append(gc, collectable); } + /* else has_finalizer() deleted op via side effect */ } } From tim_one@users.sourceforge.net Sun Apr 6 00:11:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 16:11:41 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11222/python/Modules Modified Files: gcmodule.c Log Message: Reworked move_finalizer_reachable() to create two distinct lists: externally unreachable objects with finalizers, and externally unreachable objects without finalizers reachable from such objects. This allows us to call has_finalizer() at most once per object, and so limit the pain of nasty getattr hooks. This fixes the failing "boom 2" example Jeremy posted (a non-printing variant of which is now part of test_gc), via never triggering the nasty part of its __getattr__ method. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** gcmodule.c 5 Apr 2003 18:40:50 -0000 2.62 --- gcmodule.c 6 Apr 2003 00:11:39 -0000 2.63 *************** *** 52,62 **** /* true if we are currently running the collector */ ! static int collecting; /* list of uncollectable objects */ ! static PyObject *garbage; /* Python string to use if unhandled exception occurs */ ! static PyObject *gc_str; /* Python string used to look for __del__ attribute. */ --- 52,62 ---- /* true if we are currently running the collector */ ! static int collecting = 0; /* list of uncollectable objects */ ! static PyObject *garbage = NULL; /* Python string to use if unhandled exception occurs */ ! static PyObject *gc_str = NULL; /* Python string used to look for __del__ attribute. */ *************** *** 413,429 **** /* Move objects that are reachable from finalizers, from the unreachable set ! * into the finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers) { traverseproc traverse; PyGC_Head *gc = finalizers->gc.gc_next; ! for (; gc != finalizers; gc=gc->gc.gc_next) { ! /* careful, finalizers list is growing here */ traverse = FROM_GC(gc)->ob_type->tp_traverse; (void) traverse(FROM_GC(gc), ! (visitproc)visit_move, ! (void *)finalizers); } } --- 413,430 ---- /* Move objects that are reachable from finalizers, from the unreachable set ! * into the reachable_from_finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers, ! PyGC_Head *reachable_from_finalizers) { traverseproc traverse; PyGC_Head *gc = finalizers->gc.gc_next; ! for (; gc != finalizers; gc = gc->gc.gc_next) { ! /* Note that the finalizers list may grow during this. */ traverse = FROM_GC(gc)->ob_type->tp_traverse; (void) traverse(FROM_GC(gc), ! (visitproc)visit_move, ! (void *)reachable_from_finalizers); } } *************** *** 455,471 **** } ! /* Handle uncollectable garbage (cycles with finalizers). */ static void ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { PyGC_Head *gc; if (garbage == NULL) { garbage = PyList_New(0); } ! for (gc = finalizers->gc.gc_next; gc != finalizers; ! gc = finalizers->gc.gc_next) { PyObject *op = FROM_GC(gc); ! /* XXX has_finalizer() is not safe here. */ ! if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { /* If SAVEALL is not set then just append objects with * finalizers to the list of garbage. All objects in --- 456,478 ---- } ! /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable ! * only from such cycles). ! */ static void ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { PyGC_Head *gc; if (garbage == NULL) { garbage = PyList_New(0); + if (garbage == NULL) + Py_FatalError("gc couldn't create gc.garbage list"); } ! for (gc = finalizers->gc.gc_next; ! gc != finalizers; ! gc = finalizers->gc.gc_next) { PyObject *op = FROM_GC(gc); ! ! assert(IS_REACHABLE(op)); ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { /* If SAVEALL is not set then just append objects with * finalizers to the list of garbage. All objects in *************** *** 475,480 **** PyList_Append(garbage, op); } - /* object is now reachable again */ - assert(IS_REACHABLE(op)); gc_list_remove(gc); gc_list_append(gc, old); --- 482,485 ---- *************** *** 528,531 **** --- 533,537 ---- PyGC_Head collectable; PyGC_Head finalizers; + PyGC_Head reachable_from_finalizers; PyGC_Head *gc; *************** *** 590,603 **** * instance objects with __del__ methods. * ! * Move each object into the collectable set or the finalizers set. ! * Because we need to check for __del__ methods on instances of ! * classic classes, arbitrary Python code may get executed by ! * getattr hooks: that may resurrect or deallocate (via refcount ! * falling to 0) unreachable objects, so this is very delicate. */ gc_list_init(&collectable); gc_list_init(&finalizers); move_finalizers(&unreachable, &collectable, &finalizers); ! move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print --- 596,620 ---- * instance objects with __del__ methods. * ! * Move each unreachable object into the collectable set or the ! * finalizers set. Because we need to check for __del__ methods on ! * instances of classic classes, arbitrary Python code may get ! * executed by getattr hooks: that may resurrect or deallocate (via ! * refcount falling to 0) unreachable objects, so this is very ! * delicate. */ gc_list_init(&collectable); gc_list_init(&finalizers); move_finalizers(&unreachable, &collectable, &finalizers); ! /* finalizers contains the unreachable objects with a finalizer; ! * unreachable objects reachable only *from* those are also ! * uncollectable; we move those into a separate list ! * (reachable_from_finalizers) so we don't have to do the dangerous ! * has_finalizer() test again later. ! */ ! gc_list_init(&reachable_from_finalizers); ! move_finalizer_reachable(&finalizers, &reachable_from_finalizers); ! /* And move everything only reachable from the reachable stuff. */ ! move_finalizer_reachable(&reachable_from_finalizers, ! &reachable_from_finalizers); /* Collect statistics on collectable objects found and print *************** *** 611,626 **** } /* Call tp_clear on objects in the collectable set. This will cause ! * the reference cycles to be broken. It may also cause some objects in ! * finalizers to be freed */ delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; gc != &finalizers; ! gc = gc->gc.gc_next) { n++; ! if (debug & DEBUG_UNCOLLECTABLE) { debug_cycle("uncollectable", FROM_GC(gc)); - } } if (debug & DEBUG_STATS) { --- 628,650 ---- } /* Call tp_clear on objects in the collectable set. This will cause ! * the reference cycles to be broken. It may also cause some objects ! * in finalizers and/or reachable_from_finalizers to be freed */ delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; ! gc != &finalizers; ! gc = gc->gc.gc_next) { n++; ! if (debug & DEBUG_UNCOLLECTABLE) ! debug_cycle("uncollectable", FROM_GC(gc)); ! } ! for (gc = reachable_from_finalizers.gc.gc_next; ! gc != &reachable_from_finalizers; ! gc = gc->gc.gc_next) { ! n++; ! if (debug & DEBUG_UNCOLLECTABLE) debug_cycle("uncollectable", FROM_GC(gc)); } if (debug & DEBUG_STATS) { *************** *** 637,642 **** /* Append instances in the uncollectable set to a Python * reachable list of garbage. The programmer has to deal with ! * this if they insist on creating this type of structure. */ ! handle_finalizers(&finalizers, old); if (PyErr_Occurred()) { --- 661,668 ---- /* Append instances in the uncollectable set to a Python * reachable list of garbage. The programmer has to deal with ! * this if they insist on creating this type of structure. ! */ ! handle_finalizers(&finalizers, old, 1); ! handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { From tim_one@users.sourceforge.net Sun Apr 6 00:11:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 16:11:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11222/python/Lib/test Modified Files: test_gc.py Log Message: Reworked move_finalizer_reachable() to create two distinct lists: externally unreachable objects with finalizers, and externally unreachable objects without finalizers reachable from such objects. This allows us to call has_finalizer() at most once per object, and so limit the pain of nasty getattr hooks. This fixes the failing "boom 2" example Jeremy posted (a non-printing variant of which is now part of test_gc), via never triggering the nasty part of its __getattr__ method. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_gc.py 5 Apr 2003 17:46:04 -0000 1.25 --- test_gc.py 6 Apr 2003 00:11:38 -0000 1.26 *************** *** 254,258 **** gc.disable() ! class C: def __getattr__(self, someattribute): del self.attr --- 254,258 ---- gc.disable() ! class Boom: def __getattr__(self, someattribute): del self.attr *************** *** 260,265 **** def test_boom(): ! a = C() ! b = C() a.attr = b b.attr = a --- 260,265 ---- def test_boom(): ! a = Boom() ! b = Boom() a.attr = b b.attr = a *************** *** 268,272 **** garbagelen = len(gc.garbage) del a, b ! # a<->b are in a trash cycle now. Collection will invoke C.__getattr__ # (to see whether a and b have __del__ methods), and __getattr__ deletes # the internal "attr" attributes as a side effect. That causes the --- 268,272 ---- garbagelen = len(gc.garbage) del a, b ! # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ # (to see whether a and b have __del__ methods), and __getattr__ deletes # the internal "attr" attributes as a side effect. That causes the *************** *** 277,280 **** --- 277,307 ---- expect(len(gc.garbage), garbagelen, "boom") + class Boom2: + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2(): + a = Boom2() + b = Boom2() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # Much like test_boom(), except that __getattr__ doesn't break the + # cycle until the second time gc checks for __del__. As of 2.3b1, + # there isn't a second time, so this simply cleans up the trash cycle. + # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed + # this way. + expect(gc.collect(), 4, "boom2") + expect(len(gc.garbage), garbagelen, "boom2") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 296,299 **** --- 323,327 ---- run_test("trashcan", test_trashcan) run_test("boom", test_boom) + run_test("boom2", test_boom2) def test(): From tim_one@users.sourceforge.net Sun Apr 6 01:50:52 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 17:50:52 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv4669/Modules Modified Files: gcmodule.c Log Message: Switched from METH_VARARGS to METH_NOARGS for the 7 module functions that take no arguments; cuts generated code size. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** gcmodule.c 6 Apr 2003 00:11:39 -0000 2.63 --- gcmodule.c 6 Apr 2003 01:50:50 -0000 2.64 *************** *** 634,638 **** /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; gc != &finalizers; gc = gc->gc.gc_next) { --- 634,638 ---- /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; gc != &finalizers; gc = gc->gc.gc_next) { *************** *** 700,711 **** static PyObject * ! gc_enable(PyObject *self, PyObject *args) { - - if (!PyArg_ParseTuple(args, ":enable")) /* check no args */ - return NULL; - enabled = 1; - Py_INCREF(Py_None); return Py_None; --- 700,706 ---- static PyObject * ! gc_enable(PyObject *self, PyObject *noargs) { enabled = 1; Py_INCREF(Py_None); return Py_None; *************** *** 718,729 **** static PyObject * ! gc_disable(PyObject *self, PyObject *args) { - - if (!PyArg_ParseTuple(args, ":disable")) /* check no args */ - return NULL; - enabled = 0; - Py_INCREF(Py_None); return Py_None; --- 713,719 ---- static PyObject * ! gc_disable(PyObject *self, PyObject *noargs) { enabled = 0; Py_INCREF(Py_None); return Py_None; *************** *** 736,745 **** static PyObject * ! gc_isenabled(PyObject *self, PyObject *args) { - - if (!PyArg_ParseTuple(args, ":isenabled")) /* check no args */ - return NULL; - return Py_BuildValue("i", enabled); } --- 726,731 ---- static PyObject * ! gc_isenabled(PyObject *self, PyObject *noargs) { return Py_BuildValue("i", enabled); } *************** *** 751,764 **** static PyObject * ! gc_collect(PyObject *self, PyObject *args) { long n; ! if (!PyArg_ParseTuple(args, ":collect")) /* check no args */ ! return NULL; ! ! if (collecting) { n = 0; /* already collecting, don't do anything */ - } else { collecting = 1; --- 737,746 ---- static PyObject * ! gc_collect(PyObject *self, PyObject *noargs) { long n; ! if (collecting) n = 0; /* already collecting, don't do anything */ else { collecting = 1; *************** *** 802,810 **** static PyObject * ! gc_get_debug(PyObject *self, PyObject *args) { - if (!PyArg_ParseTuple(args, ":get_debug")) /* no args */ - return NULL; - return Py_BuildValue("i", debug); } --- 784,789 ---- static PyObject * ! gc_get_debug(PyObject *self, PyObject *noargs) { return Py_BuildValue("i", debug); } *************** *** 840,848 **** static PyObject * ! gc_get_thresh(PyObject *self, PyObject *args) { - if (!PyArg_ParseTuple(args, ":get_threshold")) /* no args */ - return NULL; - return Py_BuildValue("(iii)", generations[0].threshold, --- 819,824 ---- static PyObject * ! gc_get_thresh(PyObject *self, PyObject *noargs) { return Py_BuildValue("(iii)", generations[0].threshold, *************** *** 949,963 **** static PyObject * ! gc_get_objects(PyObject *self, PyObject *args) { int i; PyObject* result; - if (!PyArg_ParseTuple(args, ":get_objects")) /* check no args */ - return NULL; result = PyList_New(0); ! if (result == NULL) { return NULL; - } for (i = 0; i < NUM_GENERATIONS; i++) { if (append_objects(result, GEN_HEAD(i))) { --- 925,936 ---- static PyObject * ! gc_get_objects(PyObject *self, PyObject *noargs) { int i; PyObject* result; result = PyList_New(0); ! if (result == NULL) return NULL; for (i = 0; i < NUM_GENERATIONS; i++) { if (append_objects(result, GEN_HEAD(i))) { *************** *** 986,998 **** static PyMethodDef GcMethods[] = { ! {"enable", gc_enable, METH_VARARGS, gc_enable__doc__}, ! {"disable", gc_disable, METH_VARARGS, gc_disable__doc__}, ! {"isenabled", gc_isenabled, METH_VARARGS, gc_isenabled__doc__}, {"set_debug", gc_set_debug, METH_VARARGS, gc_set_debug__doc__}, ! {"get_debug", gc_get_debug, METH_VARARGS, gc_get_debug__doc__}, {"set_threshold", gc_set_thresh, METH_VARARGS, gc_set_thresh__doc__}, ! {"get_threshold", gc_get_thresh, METH_VARARGS, gc_get_thresh__doc__}, ! {"collect", gc_collect, METH_VARARGS, gc_collect__doc__}, ! {"get_objects", gc_get_objects,METH_VARARGS, gc_get_objects__doc__}, {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, --- 959,971 ---- static PyMethodDef GcMethods[] = { ! {"enable", gc_enable, METH_NOARGS, gc_enable__doc__}, ! {"disable", gc_disable, METH_NOARGS, gc_disable__doc__}, ! {"isenabled", gc_isenabled, METH_NOARGS, gc_isenabled__doc__}, {"set_debug", gc_set_debug, METH_VARARGS, gc_set_debug__doc__}, ! {"get_debug", gc_get_debug, METH_NOARGS, gc_get_debug__doc__}, {"set_threshold", gc_set_thresh, METH_VARARGS, gc_set_thresh__doc__}, ! {"get_threshold", gc_get_thresh, METH_NOARGS, gc_get_thresh__doc__}, ! {"collect", gc_collect, METH_NOARGS, gc_collect__doc__}, ! {"get_objects", gc_get_objects,METH_NOARGS, gc_get_objects__doc__}, {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, From rhettinger@users.sourceforge.net Sun Apr 6 10:01:18 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:18 -0800 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.283,2.284 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Python Modified Files: bltinmodule.c Log Message: SF patch #701494: more apply removals Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.283 retrieving revision 2.284 diff -C2 -d -r2.283 -r2.284 *** bltinmodule.c 23 Mar 2003 17:52:28 -0000 2.283 --- bltinmodule.c 6 Apr 2003 09:01:11 -0000 2.284 *************** *** 113,117 **** Call a callable object with positional arguments taken from the tuple args,\n\ and keyword arguments taken from the optional dictionary kwargs.\n\ ! Note that classes are callable, as are instances with a __call__() method."); --- 113,120 ---- Call a callable object with positional arguments taken from the tuple args,\n\ and keyword arguments taken from the optional dictionary kwargs.\n\ ! Note that classes are callable, as are instances with a __call__() method.\n\ ! \n\ ! Deprecated since release 2.3. Instead, use the extended call syntax:\n\ ! function(*args, **keywords)."); From rhettinger@users.sourceforge.net Sun Apr 6 10:01:21 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/compiler transformer.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/compiler Modified Files: transformer.py Log Message: SF patch #701494: more apply removals Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** transformer.py 7 Mar 2003 17:30:47 -0000 1.37 --- transformer.py 6 Apr 2003 09:00:45 -0000 1.38 *************** *** 73,77 **** if nodes.has_key(kind): try: ! return apply(nodes[kind], args[1:]) except TypeError: print nodes[kind], len(args), args --- 73,77 ---- if nodes.has_key(kind): try: ! return nodes[kind](*args[1:]) except TypeError: print nodes[kind], len(args), args From rhettinger@users.sourceforge.net Sun Apr 6 10:01:23 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/curses wrapper.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/curses In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/curses Modified Files: wrapper.py Log Message: SF patch #701494: more apply removals Index: wrapper.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/curses/wrapper.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wrapper.py 29 Sep 2002 00:25:51 -0000 1.6 --- wrapper.py 6 Apr 2003 09:00:47 -0000 1.7 *************** *** 42,46 **** pass ! res = apply(func, (stdscr,) + rest) except: # In the event of an error, restore the terminal --- 42,46 ---- pass ! res = func(stdscr, *rest) except: # In the event of an error, restore the terminal From rhettinger@users.sourceforge.net Sun Apr 6 10:01:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon MediaDescr.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/plat-mac/Carbon Modified Files: MediaDescr.py Log Message: SF patch #701494: more apply removals Index: MediaDescr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/MediaDescr.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MediaDescr.py 30 Dec 2002 22:04:21 -0000 1.1 --- MediaDescr.py 6 Apr 2003 09:01:02 -0000 1.2 *************** *** 5,96 **** class _MediaDescriptionCodec: ! def __init__(self, trunc, size, names, fmt): ! self.trunc = trunc ! self.size = size ! self.names = names ! self.fmt = fmt ! ! def decode(self, data): ! if self.trunc: ! data = data[:self.size] ! values = struct.unpack(self.fmt, data) ! if len(values) != len(self.names): ! raise Error, ('Format length does not match number of names', descr) ! rv = {} ! for i in range(len(values)): ! name = self.names[i] ! value = values[i] ! if type(name) == type(()): ! name, cod, dec = name ! value = dec(value) ! rv[name] = value ! return rv ! ! def encode(dict): ! list = [self.fmt] ! for name in self.names: ! if type(name) == type(()): ! name, cod, dec = name ! else: ! cod = dec = None ! value = dict[name] ! if cod: ! value = cod(value) ! list.append(value) ! rv = apply(struct.pack, tuple(list)) ! return rv ! # Helper functions def _tofixed(float): ! hi = int(float) ! lo = int(float*0x10000) & 0xffff ! return (hi<<16)|lo ! def _fromfixed(fixed): ! hi = (fixed >> 16) & 0xffff ! lo = (fixed & 0xffff) ! return hi + (lo / float(0x10000)) ! def _tostr31(str): ! return chr(len(str)) + str + '\0'*(31-len(str)) ! def _fromstr31(str31): ! return str31[1:1+ord(str31[0])] SampleDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 16, # size ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex'), # Attributes ! "l4slhh" # Format ) SoundDescription = _MediaDescriptionCodec( ! 1, ! 36, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed)), ! "l4slhhhh4shhhhl" # Format ) SoundDescriptionV1 = _MediaDescriptionCodec( ! 1, ! 52, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed), 'samplesPerPacket', ! 'bytesPerPacket', 'bytesPerFrame', 'bytesPerSample'), ! "l4slhhhh4shhhhlllll" # Format ) ImageDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 86, # size ! ('idSize', 'cType', 'resvd1', 'resvd2', 'dataRefIndex', 'version', ! 'revisionLevel', 'vendor', 'temporalQuality', 'spatialQuality', ! 'width', 'height', ('hRes', _tofixed, _fromfixed), ('vRes', _tofixed, _fromfixed), ! 'dataSize', 'frameCount', ('name', _tostr31, _fromstr31), ! 'depth', 'clutID'), ! 'l4slhhhh4sllhhlllh32shh', ) --- 5,96 ---- class _MediaDescriptionCodec: ! def __init__(self, trunc, size, names, fmt): ! self.trunc = trunc ! self.size = size ! self.names = names ! self.fmt = fmt ! ! def decode(self, data): ! if self.trunc: ! data = data[:self.size] ! values = struct.unpack(self.fmt, data) ! if len(values) != len(self.names): ! raise Error, ('Format length does not match number of names', descr) ! rv = {} ! for i in range(len(values)): ! name = self.names[i] ! value = values[i] ! if type(name) == type(()): ! name, cod, dec = name ! value = dec(value) ! rv[name] = value ! return rv ! ! def encode(dict): ! list = [self.fmt] ! for name in self.names: ! if type(name) == type(()): ! name, cod, dec = name ! else: ! cod = dec = None ! value = dict[name] ! if cod: ! value = cod(value) ! list.append(value) ! rv = struct.pack(*list) ! return rv ! # Helper functions def _tofixed(float): ! hi = int(float) ! lo = int(float*0x10000) & 0xffff ! return (hi<<16)|lo ! def _fromfixed(fixed): ! hi = (fixed >> 16) & 0xffff ! lo = (fixed & 0xffff) ! return hi + (lo / float(0x10000)) ! def _tostr31(str): ! return chr(len(str)) + str + '\0'*(31-len(str)) ! def _fromstr31(str31): ! return str31[1:1+ord(str31[0])] SampleDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 16, # size ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex'), # Attributes ! "l4slhh" # Format ) SoundDescription = _MediaDescriptionCodec( ! 1, ! 36, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed)), ! "l4slhhhh4shhhhl" # Format ) SoundDescriptionV1 = _MediaDescriptionCodec( ! 1, ! 52, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed), 'samplesPerPacket', ! 'bytesPerPacket', 'bytesPerFrame', 'bytesPerSample'), ! "l4slhhhh4shhhhlllll" # Format ) ImageDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 86, # size ! ('idSize', 'cType', 'resvd1', 'resvd2', 'dataRefIndex', 'version', ! 'revisionLevel', 'vendor', 'temporalQuality', 'spatialQuality', ! 'width', 'height', ('hRes', _tofixed, _fromfixed), ('vRes', _tofixed, _fromfixed), ! 'dataSize', 'frameCount', ('name', _tostr31, _fromstr31), ! 'depth', 'clutID'), ! 'l4slhhhh4sllhhlllh32shh', ) From rhettinger@users.sourceforge.net Sun Apr 6 10:01:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Canvas.py,1.18,1.19 Dialog.py,1.5,1.6 ScrolledText.py,1.12,1.13 Tix.py,1.15,1.16 Tkinter.py,1.170,1.171 tkColorChooser.py,1.5,1.6 tkCommonDialog.py,1.6,1.7 tkFont.py,1.3,1.4 tkMessageBox.py,1.1,1.2 tkSimpleDialog.py,1.8,1.9 turtle.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/lib-tk Modified Files: Canvas.py Dialog.py ScrolledText.py Tix.py Tkinter.py tkColorChooser.py tkCommonDialog.py tkFont.py tkMessageBox.py tkSimpleDialog.py turtle.py Log Message: SF patch #701494: more apply removals Index: Canvas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Canvas.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Canvas.py 30 Jan 2003 00:56:32 -0000 1.18 --- Canvas.py 6 Apr 2003 09:00:48 -0000 1.19 *************** *** 56,60 **** flat = () for x, y in pts: flat = flat + (x, y) ! return apply(self.canvas.coords, (self.id,) + flat) def dchars(self, first, last=None): self.canvas.dchars(self.id, first, last) --- 56,60 ---- flat = () for x, y in pts: flat = flat + (x, y) ! return self.canvas.coords(self.id, *flat) def dchars(self, first, last=None): self.canvas.dchars(self.id, first, last) *************** *** 85,122 **** class Arc(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'arc') + args, kw) class Bitmap(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'bitmap') + args, kw) class ImageItem(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'image') + args, kw) class Line(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'line') + args, kw) class Oval(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'oval') + args, kw) class Polygon(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'polygon') + args,kw) class Rectangle(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'rectangle')+args,kw) # XXX "Text" is taken by the Text widget... class CanvasText(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'text') + args, kw) class Window(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'window') + args, kw) class Group: --- 85,122 ---- class Arc(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'arc', *args, **kw) class Bitmap(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'bitmap', *args, **kw) class ImageItem(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'image', *args, **kw) class Line(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'line', *args, **kw) class Oval(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'oval', *args, **kw) class Polygon(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'polygon', *args, **kw) class Rectangle(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'rectangle', *args, **kw) # XXX "Text" is taken by the Text widget... class CanvasText(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'text', *args, **kw) class Window(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'window', *args, **kw) class Group: Index: Dialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Dialog.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Dialog.py 23 Oct 2000 18:31:14 -0000 1.5 --- Dialog.py 6 Apr 2003 09:00:49 -0000 1.6 *************** *** 16,24 **** Widget._setup(self, master, cnf) self.num = self.tk.getint( ! apply(self.tk.call, ! ('tk_dialog', self._w, ! cnf['title'], cnf['text'], ! cnf['bitmap'], cnf['default']) ! + cnf['strings'])) try: Widget.destroy(self) except TclError: pass --- 16,24 ---- Widget._setup(self, master, cnf) self.num = self.tk.getint( ! self.tk.call( ! 'tk_dialog', self._w, ! cnf['title'], cnf['text'], ! cnf['bitmap'], cnf['default'], ! *cnf['strings'])) try: Widget.destroy(self) except TclError: pass Index: ScrolledText.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/ScrolledText.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ScrolledText.py 12 Dec 2001 12:47:57 -0000 1.12 --- ScrolledText.py 6 Apr 2003 09:00:49 -0000 1.13 *************** *** 25,33 **** fcnf[k] = cnf[k] del cnf[k] ! self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' ! apply(Text.__init__, (self, self.frame), cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set --- 25,33 ---- fcnf[k] = cnf[k] del cnf[k] ! self.frame = Frame(master, **fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' ! Text.__init__(self, self.frame, **cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set Index: Tix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tix.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Tix.py 30 Dec 2002 23:52:00 -0000 1.15 --- Tix.py 6 Apr 2003 09:00:50 -0000 1.16 *************** *** 223,227 **** def config(self, cnf={}, **kw): ! apply(self.tk.call, ('tixForm', self._w) + self._options(cnf, kw)) form = config --- 223,227 ---- def config(self, cnf={}, **kw): ! self.tk.call('tixForm', self._w, *self._options(cnf, kw)) form = config *************** *** 293,297 **** else: static_options = ['options'] ! for k,v in cnf.items()[:]: if k in static_options: --- 293,297 ---- else: static_options = ['options'] ! for k,v in cnf.items()[:]: if k in static_options: *************** *** 305,309 **** # corresponding Tk widget has already been created by Tix if widgetName: ! apply(self.tk.call, (widgetName, self._w) + extra) # Non-static options - to be done via a 'config' command --- 305,309 ---- # corresponding Tk widget has already been created by Tix if widgetName: ! self.tk.call(widgetName, self._w, *extra) # Non-static options - to be done via a 'config' command *************** *** 475,480 **** elif not master: raise RuntimeError, "Too early to create display style: no root window" self.tk = master.tk ! self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) + ! self._options(cnf,kw) ) def __str__(self): --- 475,480 ---- elif not master: raise RuntimeError, "Too early to create display style: no root window" self.tk = master.tk ! self.stylename = self.tk.call('tixDisplayStyle', itemtype, ! *self._options(cnf,kw) ) def __str__(self): *************** *** 500,505 **** return _lst2dict( self.tk.split( ! apply(self.tk.call, ! (self.stylename, 'configure') + self._options(cnf,kw)))) def __getitem__(self,key): --- 500,505 ---- return _lst2dict( self.tk.split( ! self.tk.call( ! self.stylename, 'configure', *self._options(cnf,kw)))) def __getitem__(self,key): *************** *** 533,538 **** """Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time""" ! apply(self.tk.call, ! (self._w, 'bind', widget._w) + self._options(cnf, kw)) def unbind_widget(self, widget): --- 533,537 ---- """Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time""" ! self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw)) def unbind_widget(self, widget): *************** *** 550,555 **** """Add a button with given name to box.""" ! btn = apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn --- 549,553 ---- """Add a button with given name to box.""" ! btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn *************** *** 590,594 **** # align ! def add_history(self, str): self.tk.call(self._w, 'addhistory', str) --- 588,592 ---- # align ! def add_history(self, str): self.tk.call(self._w, 'addhistory', str) *************** *** 863,874 **** def add(self, entry, cnf={}, **kw): ! return apply(self.tk.call, ! (self._w, 'add', entry) + self._options(cnf, kw)) def add_child(self, parent=None, cnf={}, **kw): if not parent: parent = '' ! return apply(self.tk.call, ! (self._w, 'addchild', parent) + self._options(cnf, kw)) def anchor_set(self, entry): --- 861,871 ---- def add(self, entry, cnf={}, **kw): ! return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) def add_child(self, parent=None, cnf={}, **kw): if not parent: parent = '' ! return self.tk.call( ! self._w, 'addchild', parent, *self._options(cnf, kw)) def anchor_set(self, entry): *************** *** 910,915 **** def header_create(self, col, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'header', 'create', col) + self._options(cnf, kw)) def header_configure(self, col, cnf={}, **kw): --- 907,911 ---- def header_create(self, col, cnf={}, **kw): ! self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw)) def header_configure(self, col, cnf={}, **kw): *************** *** 918,923 **** self.tk.split( self.tk.call(self._w, 'header', 'configure', col))) ! apply(self.tk.call, (self._w, 'header', 'configure', col) ! + self._options(cnf, kw)) def header_cget(self, col, opt): --- 914,919 ---- self.tk.split( self.tk.call(self._w, 'header', 'configure', col))) ! self.tk.call(self._w, 'header', 'configure', col, ! *self._options(cnf, kw)) def header_cget(self, col, opt): *************** *** 937,942 **** def indicator_create(self, entry, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'indicator', 'create', entry) + self._options(cnf, kw)) def indicator_configure(self, entry, cnf={}, **kw): --- 933,938 ---- def indicator_create(self, entry, cnf={}, **kw): ! self.tk.call( ! self._w, 'indicator', 'create', entry, *self._options(cnf, kw)) def indicator_configure(self, entry, cnf={}, **kw): *************** *** 945,950 **** self.tk.split( self.tk.call(self._w, 'indicator', 'configure', entry))) ! apply(self.tk.call, ! (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw)) def indicator_cget(self, entry, opt): --- 941,946 ---- self.tk.split( self.tk.call(self._w, 'indicator', 'configure', entry))) ! self.tk.call( ! self._w, 'indicator', 'configure', entry, *self._options(cnf, kw)) def indicator_cget(self, entry, opt): *************** *** 997,1006 **** self.tk.split( self.tk.call(self._w, 'item', 'configure', entry, col))) ! apply(self.tk.call, (self._w, 'item', 'configure', entry, col) + ! self._options(cnf, kw)) def item_create(self, entry, col, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'item', 'create', entry, col) + self._options(cnf, kw)) def item_exists(self, entry, col): --- 993,1002 ---- self.tk.split( self.tk.call(self._w, 'item', 'configure', entry, col))) ! self.tk.call(self._w, 'item', 'configure', entry, col, ! *self._options(cnf, kw)) def item_create(self, entry, col, cnf={}, **kw): ! self.tk.call( ! self._w, 'item', 'create', entry, col, *self._options(cnf, kw)) def item_exists(self, entry, col): *************** *** 1017,1022 **** def selection_clear(self, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'selection', 'clear') + self._options(cnf, kw)) def selection_includes(self, entry): --- 1013,1017 ---- def selection_clear(self, cnf={}, **kw): ! self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) def selection_includes(self, entry): *************** *** 1030,1037 **** def xview(self, *args): ! apply(self.tk.call, (self._w, 'xview') + args) def yview(self, *args): ! apply(self.tk.call, (self._w, 'yview') + args) class InputOnly(TixWidget): --- 1025,1032 ---- def xview(self, *args): ! self.tk.call(self._w, 'xview', *args) def yview(self, *args): ! self.tk.call(self._w, 'yview', *args) class InputOnly(TixWidget): *************** *** 1094,1099 **** def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] --- 1089,1093 ---- def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] *************** *** 1136,1141 **** def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] --- 1130,1134 ---- def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] *************** *** 1181,1190 **** def add_command(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', 'command', name) + self._options(cnf, kw)) def add_separator(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', 'separator', name) + self._options(cnf, kw)) def delete(self, name): --- 1174,1181 ---- def add_command(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw)) def add_separator(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw)) def delete(self, name): *************** *** 1213,1218 **** # add delete forget panecget paneconfigure panes setsize def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name, check_intermediate=0) --- 1204,1208 ---- # add delete forget panecget paneconfigure panes setsize def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name, check_intermediate=0) *************** *** 1235,1240 **** self.tk.split( self.tk.call(self._w, 'paneconfigure', entry))) ! apply(self.tk.call, ! (self._w, 'paneconfigure', entry) + self._options(cnf, kw)) def panes(self): --- 1225,1229 ---- self.tk.split( self.tk.call(self._w, 'paneconfigure', entry))) ! self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw)) def panes(self): *************** *** 1362,1367 **** def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return self.subwidget_list[name] --- 1351,1355 ---- def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return self.subwidget_list[name] *************** *** 1459,1464 **** def insert(self, index, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'insert', index) + self._options(cnf, kw)) def info_active(self): --- 1447,1451 ---- def insert(self, index, cnf={}, **kw): ! self.tk.call(self._w, 'insert', index, *self._options(cnf, kw)) def info_active(self): *************** *** 1494,1499 **** def selection_clear(self, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'selection', 'clear') + self._options(cnf, kw)) def selection_includes(self, index): --- 1481,1485 ---- def selection_clear(self, cnf={}, **kw): ! self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) def selection_includes(self, index): *************** *** 1504,1511 **** def xview(self, *args): ! apply(self.tk.call, (self._w, 'xview') + args) def yview(self, *args): ! apply(self.tk.call, (self._w, 'yview') + args) class Tree(TixWidget): --- 1490,1497 ---- def xview(self, *args): ! self.tk.call(self._w, 'xview', *args) def yview(self, *args): ! self.tk.call(self._w, 'yview', *args) class Tree(TixWidget): *************** *** 1808,1812 **** # def xview # def yview ! class ScrolledGrid(TixWidget): '''Scrolled Grid widgets''' --- 1794,1798 ---- # def xview # def yview ! class ScrolledGrid(TixWidget): '''Scrolled Grid widgets''' Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** Tkinter.py 29 Mar 2003 09:47:21 -0000 1.170 --- Tkinter.py 6 Apr 2003 09:00:51 -0000 1.171 *************** *** 5,12 **** widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox ! LabelFrame and PanedWindow. ! Properties of the widgets are specified with keyword arguments. ! Keyword arguments have the same name as the corresponding resource under Tk. --- 5,12 ---- widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, [...1265 lines suppressed...] ! Style is a string that contains zero or more of the ! characters n, s, e or w. The string can optionally ! contains spaces or commas, but they are ignored. Each ! letter refers to a side (north, south, east, or west) ! that the window will "stick" to. If both n and s ! (or e and w) are specified, the window will be ! stretched to fill the entire height (or width) of its cavity. width size ! Specify a width for the window. The width will be ! the outer dimension of the window including its ! border, if any. If size is an empty string, or if -width is not specified, then the width requested ! internally by the window will be used initially; the ! width may later be adjusted by the movement of sashes ! in the panedwindow. Size may be any value accepted by Tk_GetPixels. ! """ if cnf is None and not kw: Index: tkColorChooser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkColorChooser.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tkColorChooser.py 16 Jul 2000 12:04:31 -0000 1.5 --- tkColorChooser.py 6 Apr 2003 09:00:52 -0000 1.6 *************** *** 64,68 **** options["initialcolor"] = color ! return apply(Chooser, (), options).show() --- 64,68 ---- options["initialcolor"] = color ! return Chooser(**options).show() Index: tkCommonDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkCommonDialog.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tkCommonDialog.py 16 Feb 2002 23:16:53 -0000 1.6 --- tkCommonDialog.py 6 Apr 2003 09:00:53 -0000 1.7 *************** *** 50,54 **** try: ! s = apply(w.tk.call, (self.command,) + w._options(self.options)) s = self._fixresult(w, s) --- 50,54 ---- try: ! s = w.tk.call(self.command, *w._options(self.options)) s = self._fixresult(w, s) Index: tkFont.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFont.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tkFont.py 9 Feb 2001 11:17:58 -0000 1.3 --- tkFont.py 6 Apr 2003 09:00:53 -0000 1.4 *************** *** 74,78 **** name = "font" + str(id(self)) self.name = name ! apply(root.tk.call, ("font", "create", name) + font) # backlinks! self._root = root --- 74,78 ---- name = "font" + str(id(self)) self.name = name ! root.tk.call("font", "create", name, *font) # backlinks! self._root = root *************** *** 91,95 **** def copy(self): "Return a distinct copy of the current font" ! return apply(Font, (self._root,), self.actual()) def actual(self, option=None): --- 91,95 ---- def copy(self): "Return a distinct copy of the current font" ! return Font(self._root, **self.actual()) def actual(self, option=None): *************** *** 109,114 **** "Modify font attributes" if options: ! apply(self._call, ("font", "config", self.name) + ! self._set(options)) else: return self._mkdict( --- 109,114 ---- "Modify font attributes" if options: ! self._call("font", "config", self.name, ! *self._set(options)) else: return self._mkdict( Index: tkMessageBox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkMessageBox.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tkMessageBox.py 19 Jul 1997 20:02:36 -0000 1.1 --- tkMessageBox.py 6 Apr 2003 09:00:54 -0000 1.2 *************** *** 73,107 **** if title: options["title"] = title if message: options["message"] = message ! return apply(Message, (), options).show() def showinfo(title=None, message=None, **options): "Show an info message" ! return apply(_show, (title, message, INFO, OK), options) def showwarning(title=None, message=None, **options): "Show a warning message" ! return apply(_show, (title, message, WARNING, OK), options) def showerror(title=None, message=None, **options): "Show an error message" ! return apply(_show, (title, message, ERROR, OK), options) def askquestion(title=None, message=None, **options): "Ask a question" ! return apply(_show, (title, message, QUESTION, YESNO), options) def askokcancel(title=None, message=None, **options): "Ask if operation should proceed; return true if the answer is ok" ! s = apply(_show, (title, message, QUESTION, OKCANCEL), options) return s == OK def askyesno(title=None, message=None, **options): "Ask a question; return true if the answer is yes" ! s = apply(_show, (title, message, QUESTION, YESNO), options) return s == YES def askretrycancel(title=None, message=None, **options): "Ask if operation should be retried; return true if the answer is yes" ! s = apply(_show, (title, message, WARNING, RETRYCANCEL), options) return s == RETRY --- 73,107 ---- if title: options["title"] = title if message: options["message"] = message ! return Message(**options).show() def showinfo(title=None, message=None, **options): "Show an info message" ! return _show(title, message, INFO, OK, **options) def showwarning(title=None, message=None, **options): "Show a warning message" ! return _show(title, message, WARNING, OK, **options) def showerror(title=None, message=None, **options): "Show an error message" ! return _show(title, message, ERROR, OK, **options) def askquestion(title=None, message=None, **options): "Ask a question" ! return _show(title, message, QUESTION, YESNO, **options) def askokcancel(title=None, message=None, **options): "Ask if operation should proceed; return true if the answer is ok" ! s = _show(title, message, QUESTION, OKCANCEL, **options) return s == OK def askyesno(title=None, message=None, **options): "Ask a question; return true if the answer is yes" ! s = _show(title, message, QUESTION, YESNO, **options) return s == YES def askretrycancel(title=None, message=None, **options): "Ask if operation should be retried; return true if the answer is yes" ! s = _show(title, message, WARNING, RETRYCANCEL, **options) return s == RETRY Index: tkSimpleDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkSimpleDialog.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tkSimpleDialog.py 6 Dec 2001 16:51:41 -0000 1.8 --- tkSimpleDialog.py 6 Apr 2003 09:00:54 -0000 1.9 *************** *** 250,254 **** Return value is an integer ''' ! d = apply(_QueryInteger, (title, prompt), kw) return d.result --- 250,254 ---- Return value is an integer ''' ! d = _QueryInteger(title, prompt, **kw) return d.result *************** *** 269,273 **** Return value is a float ''' ! d = apply(_QueryFloat, (title, prompt), kw) return d.result --- 269,273 ---- Return value is a float ''' ! d = _QueryFloat(title, prompt, **kw) return d.result *************** *** 301,305 **** Return value is a string ''' ! d = apply(_QueryString, (title, prompt), kw) return d.result --- 301,305 ---- Return value is a string ''' ! d = _QueryString(title, prompt, **kw) return d.result Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** turtle.py 29 Sep 2002 00:25:51 -0000 1.9 --- turtle.py 6 Apr 2003 09:00:58 -0000 1.10 *************** *** 355,363 **** def down(): _getpen().down() def width(width): _getpen().width(width) ! def color(*args): apply(_getpen().color, args) def write(arg, move=0): _getpen().write(arg, move) def fill(flag): _getpen().fill(flag) def circle(radius, extent=None): _getpen().circle(radius, extent) ! def goto(*args): apply(_getpen().goto, args) def heading(): return _getpen().heading() def setheading(angle): _getpen().setheading(angle) --- 355,363 ---- def down(): _getpen().down() def width(width): _getpen().width(width) ! def color(*args): _getpen().color(*args) def write(arg, move=0): _getpen().write(arg, move) def fill(flag): _getpen().fill(flag) def circle(radius, extent=None): _getpen().circle(radius, extent) ! def goto(*args): _getpen().goto(*args) def heading(): return _getpen().heading() def setheading(angle): _getpen().setheading(angle) From rhettinger@users.sourceforge.net Sun Apr 6 10:01:36 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.11,1.12 FrameWork.py,1.3,1.4 MiniAEFrame.py,1.1,1.2 argvemulator.py,1.2,1.3 icopen.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/plat-mac Modified Files: EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py icopen.py Log Message: SF patch #701494: more apply removals Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/EasyDialogs.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** EasyDialogs.py 24 Mar 2003 12:12:24 -0000 1.11 --- EasyDialogs.py 6 Apr 2003 09:00:59 -0000 1.12 *************** *** 6,10 **** AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons. GetArgv(optionlist, commandlist) -- fill a sys.argv-like list using a dialog ! AskFileForOpen(...) -- Ask the user for an existing file AskFileForSave(...) -- Ask the user for an output file AskFolder(...) -- Ask the user to select a folder --- 6,10 ---- AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons. GetArgv(optionlist, commandlist) -- fill a sys.argv-like list using a dialog ! AskFileForOpen(...) -- Ask the user for an existing file AskFileForSave(...) -- Ask the user for an output file [...1587 lines suppressed...] ! time.sleep(0.05) ! bar.set(0,100) ! for i in xrange(100): ! bar.set(i) ! time.sleep(0.05) ! if i % 10 == 0: ! bar.label(text[(i/10) % 4]) ! bar.label("Done.") ! time.sleep(1.0) # give'em a chance to see "Done." ! finally: ! del bar ! if hasattr(MacOS, 'SchedParams'): ! MacOS.SchedParams(*appsw) if __name__ == '__main__': ! try: ! test() ! except KeyboardInterrupt: ! Message("Operation Canceled.") Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/FrameWork.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FrameWork.py 9 Jan 2003 23:18:39 -0000 1.3 --- FrameWork.py 6 Apr 2003 09:00:59 -0000 1.4 *************** *** 30,39 **** try: ! MyFrontWindow = FrontNonFloatingWindow except NameError: ! MyFrontWindow = FrontWindow ! kHighLevelEvent = 23 # Don't know what header file this should come from ! SCROLLBARWIDTH = 16 # Again, not a clue... # Trick to forestall a set of SIOUX menus being added to our menubar [...2106 lines suppressed...] ! def enablehelp(self, *args): ! hm = self.gethelpmenu() ! self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp) ! ! def nohelp(self, *args): ! print "I told you there isn't any!" ! ! def debug(self, *args): ! import pdb ! pdb.set_trace() def test(): ! "Test program" ! app = TestApp() ! app.mainloop() if __name__ == '__main__': ! test() Index: MiniAEFrame.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/MiniAEFrame.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MiniAEFrame.py 30 Dec 2002 22:04:20 -0000 1.1 --- MiniAEFrame.py 6 Apr 2003 09:01:00 -0000 1.2 *************** *** 2,8 **** There are two classes: ! AEServer -- a mixin class offering nice AE handling. ! MiniApplication -- a very minimal alternative to FrameWork.py, ! only suitable for the simplest of AppleEvent servers. """ --- 2,8 ---- There are two classes: ! AEServer -- a mixin class offering nice AE handling. ! MiniApplication -- a very minimal alternative to FrameWork.py, ! only suitable for the simplest of AppleEvent servers. """ *************** *** 22,199 **** import EasyDialogs ! kHighLevelEvent = 23 # Not defined anywhere for Python yet? class MiniApplication: ! ! """A minimal FrameWork.Application-like class""" ! ! def __init__(self): ! self.quitting = 0 ! # Initialize menu ! self.appleid = 1 ! self.quitid = 2 ! Menu.ClearMenuBar() ! self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") ! applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) ! if MacOS.runtimemodel == 'ppc': ! applemenu.AppendResMenu('DRVR') ! applemenu.InsertMenu(0) ! self.quitmenu = Menu.NewMenu(self.quitid, "File") ! self.quitmenu.AppendMenu("Quit") ! self.quitmenu.SetItemCmd(1, ord("Q")) ! self.quitmenu.InsertMenu(0) ! Menu.DrawMenuBar() ! ! def __del__(self): ! self.close() ! ! def close(self): ! pass ! ! def mainloop(self, mask = everyEvent, timeout = 60*60): ! while not self.quitting: ! self.dooneevent(mask, timeout) ! ! def _quit(self): ! self.quitting = 1 ! ! def dooneevent(self, mask = everyEvent, timeout = 60*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! msg = "High Level Event: %s %s" % \ ! (`code(message)`, `code(h | (v<<16))`) ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! elif what == keyDown: ! c = chr(message & charCodeMask) ! if modifiers & cmdKey: ! if c == '.': ! raise KeyboardInterrupt, "Command-period" ! if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! return ! elif what == mouseDown: ! partcode, window = Win.FindWindow(where) ! if partcode == inMenuBar: ! result = Menu.MenuSelect(where) ! id = (result>>16) & 0xffff # Hi word ! item = result & 0xffff # Lo word ! if id == self.appleid: ! if item == 1: ! EasyDialogs.Message(self.getabouttext()) ! elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): ! name = self.applemenu.GetMenuItemText(item) ! Menu.OpenDeskAcc(name) ! elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! Menu.HiliteMenu(0) ! return ! # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event ! ! def getabouttext(self): ! return self.__class__.__name__ ! ! def getaboutmenutext(self): ! return "About %s\311" % self.__class__.__name__ class AEServer: ! ! def __init__(self): ! self.ae_handlers = {} ! ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = apply(_function, (_object,), _parameters) ! else: ! #Same try/except comment as above ! rv = apply(_function, (), _parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) def code(x): ! "Convert a long int to the 4-character code it really is" ! s = '' ! for i in range(4): ! x, c = divmod(x, 256) ! s = chr(c) + s ! return s class _Test(AEServer, MiniApplication): ! """Mini test application, handles required events""" ! ! def __init__(self): ! MiniApplication.__init__(self) ! AEServer.__init__(self) ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'quit', self.quit) ! self.installaehandler('****', '****', self.other) ! self.mainloop() - def quit(self, **args): - self._quit() - - def open_app(self, **args): - pass - - def other(self, _object=None, _class=None, _type=None, **args): - print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args - if __name__ == '__main__': ! _Test() --- 22,199 ---- import EasyDialogs ! kHighLevelEvent = 23 # Not defined anywhere for Python yet? class MiniApplication: ! ! """A minimal FrameWork.Application-like class""" ! ! def __init__(self): ! self.quitting = 0 ! # Initialize menu ! self.appleid = 1 ! self.quitid = 2 ! Menu.ClearMenuBar() ! self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") ! applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) ! if MacOS.runtimemodel == 'ppc': ! applemenu.AppendResMenu('DRVR') ! applemenu.InsertMenu(0) ! self.quitmenu = Menu.NewMenu(self.quitid, "File") ! self.quitmenu.AppendMenu("Quit") ! self.quitmenu.SetItemCmd(1, ord("Q")) ! self.quitmenu.InsertMenu(0) ! Menu.DrawMenuBar() ! ! def __del__(self): ! self.close() ! ! def close(self): ! pass ! ! def mainloop(self, mask = everyEvent, timeout = 60*60): ! while not self.quitting: ! self.dooneevent(mask, timeout) ! ! def _quit(self): ! self.quitting = 1 ! ! def dooneevent(self, mask = everyEvent, timeout = 60*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! msg = "High Level Event: %s %s" % \ ! (`code(message)`, `code(h | (v<<16))`) ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! elif what == keyDown: ! c = chr(message & charCodeMask) ! if modifiers & cmdKey: ! if c == '.': ! raise KeyboardInterrupt, "Command-period" ! if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! return ! elif what == mouseDown: ! partcode, window = Win.FindWindow(where) ! if partcode == inMenuBar: ! result = Menu.MenuSelect(where) ! id = (result>>16) & 0xffff # Hi word ! item = result & 0xffff # Lo word ! if id == self.appleid: ! if item == 1: ! EasyDialogs.Message(self.getabouttext()) ! elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): ! name = self.applemenu.GetMenuItemText(item) ! Menu.OpenDeskAcc(name) ! elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! Menu.HiliteMenu(0) ! return ! # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event ! ! def getabouttext(self): ! return self.__class__.__name__ ! ! def getaboutmenutext(self): ! return "About %s\311" % self.__class__.__name__ class AEServer: ! ! def __init__(self): ! self.ae_handlers = {} ! ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) def code(x): ! "Convert a long int to the 4-character code it really is" ! s = '' ! for i in range(4): ! x, c = divmod(x, 256) ! s = chr(c) + s ! return s class _Test(AEServer, MiniApplication): ! """Mini test application, handles required events""" ! ! def __init__(self): ! MiniApplication.__init__(self) ! AEServer.__init__(self) ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'quit', self.quit) ! self.installaehandler('****', '****', self.other) ! self.mainloop() ! ! def quit(self, **args): ! self._quit() ! ! def open_app(self, **args): ! pass ! ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! _Test() Index: argvemulator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/argvemulator.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** argvemulator.py 18 Feb 2003 23:28:05 -0000 1.2 --- argvemulator.py 6 Apr 2003 09:01:01 -0000 1.3 *************** *** 12,114 **** class ArgvCollector: - - """A minimal FrameWork.Application-like class""" - - def __init__(self): - self.quitting = 0 - self.ae_handlers = {} - # Remove the funny -psn_xxx_xxx argument - if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': - del sys.argv[1] - self.installaehandler('aevt', 'oapp', self.open_app) - self.installaehandler('aevt', 'odoc', self.open_file) - - def installaehandler(self, classe, type, callback): - AE.AEInstallEventHandler(classe, type, self.callback_wrapper) - self.ae_handlers[(classe, type)] = callback - - def close(self): - for classe, type in self.ae_handlers.keys(): - AE.AERemoveEventHandler(classe, type) - - def mainloop(self, mask = highLevelEventMask, timeout = 1*60): - stoptime = Evt.TickCount() + timeout - while not self.quitting and Evt.TickCount() < stoptime: - self.dooneevent(mask, timeout) - self.close() - - def _quit(self): - self.quitting = 1 - - def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): - got, event = Evt.WaitNextEvent(mask, timeout) - if got: - self.lowlevelhandler(event) - - def lowlevelhandler(self, event): - what, message, when, where, modifiers = event - h, v = where - if what == kHighLevelEvent: - try: - AE.AEProcessAppleEvent(event) - except AE.Error, err: - msg = "High Level Event: %s %s" % \ - (`hex(message)`, `hex(h | (v<<16))`) - print 'AE error: ', err - print 'in', msg - traceback.print_exc() - return - else: - print "Unhandled event:", event ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = apply(_function, (_object,), _parameters) ! else: ! #Same try/except comment as above ! rv = apply(_function, (), _parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) ! def open_app(self, **args): ! self._quit() ! ! def open_file(self, _object=None, **args): ! for alias in _object: ! fsr = alias.FSResolveAlias(None)[0] ! pathname = fsr.as_pathname() ! sys.argv.append(pathname) ! self._quit() ! ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! ArgvCollector().mainloop() ! print "sys.argv=", sys.argv --- 12,114 ---- class ArgvCollector: ! """A minimal FrameWork.Application-like class""" ! def __init__(self): ! self.quitting = 0 ! self.ae_handlers = {} ! # Remove the funny -psn_xxx_xxx argument ! if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': ! del sys.argv[1] ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'odoc', self.open_file) ! ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! ! def mainloop(self, mask = highLevelEventMask, timeout = 1*60): ! stoptime = Evt.TickCount() + timeout ! while not self.quitting and Evt.TickCount() < stoptime: ! self.dooneevent(mask, timeout) ! self.close() ! ! def _quit(self): ! self.quitting = 1 ! ! def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! msg = "High Level Event: %s %s" % \ ! (`hex(message)`, `hex(h | (v<<16))`) ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! else: ! print "Unhandled event:", event ! ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) ! ! def open_app(self, **args): ! self._quit() ! ! def open_file(self, _object=None, **args): ! for alias in _object: ! fsr = alias.FSResolveAlias(None)[0] ! pathname = fsr.as_pathname() ! sys.argv.append(pathname) ! self._quit() ! ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! ArgvCollector().mainloop() ! print "sys.argv=", sys.argv Index: icopen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/icopen.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** icopen.py 30 Dec 2002 22:04:20 -0000 1.1 --- icopen.py 6 Apr 2003 09:01:02 -0000 1.2 *************** *** 30,34 **** Put this file in your Python path, and create a file named {Python}:sitecustomize.py that contains: ! import icopen (If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.) --- 30,34 ---- Put this file in your Python path, and create a file named {Python}:sitecustomize.py that contains: ! import icopen (If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.) *************** *** 43,58 **** def _open_with_typer(*args): ! file = apply(_builtin_open, args) ! filename = args[0] ! mode = 'r' ! if args[1:]: ! mode = args[1] ! if mode[0] == 'w': ! from ic import error, settypecreator ! try: ! settypecreator(filename) ! except error: ! pass ! return file __builtin__.open = _open_with_typer --- 43,58 ---- def _open_with_typer(*args): ! file = _builtin_open(*args) ! filename = args[0] ! mode = 'r' ! if args[1:]: ! mode = args[1] ! if mode[0] == 'w': ! from ic import error, settypecreator ! try: ! settypecreator(filename) ! except error: ! pass ! return file __builtin__.open = _open_with_typer *************** *** 64,66 **** _open_with_typer('test.html', 'w') _open_with_typer('test.foo', 'w') ! """ \ No newline at end of file --- 64,66 ---- _open_with_typer('test.html', 'w') _open_with_typer('test.foo', 'w') ! """ From rhettinger@users.sourceforge.net Sun Apr 6 10:01:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:40 -0800 Subject: [Python-checkins] python/dist/src/Lib/test reperf.py,1.1,1.2 test_curses.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/test Modified Files: reperf.py test_curses.py Log Message: SF patch #701494: more apply removals Index: reperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/reperf.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** reperf.py 17 Jul 1998 21:10:42 -0000 1.1 --- reperf.py 6 Apr 2003 09:01:03 -0000 1.2 *************** *** 13,17 **** try: for i in range(n): ! result = apply(func, args, kw) return result finally: --- 13,17 ---- try: for i in range(n): ! result = func(*args, **kw) return result finally: Index: test_curses.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_curses.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_curses.py 23 Jul 2002 19:03:47 -0000 1.2 --- test_curses.py 6 Apr 2003 09:01:05 -0000 1.3 *************** *** 27,31 **** for args in [('a'), ('a', curses.A_BOLD), (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]: ! apply(meth, args) for meth in [stdscr.box, stdscr.clear, stdscr.clrtobot, --- 27,31 ---- for args in [('a'), ('a', curses.A_BOLD), (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]: ! meth(*args) for meth in [stdscr.box, stdscr.clear, stdscr.clrtobot, From rhettinger@users.sourceforge.net Sun Apr 6 10:01:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/xml/dom minidom.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/xml/dom Modified Files: minidom.py Log Message: SF patch #701494: more apply removals Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** minidom.py 26 Jan 2003 08:59:32 -0000 1.50 --- minidom.py 6 Apr 2003 09:01:07 -0000 1.51 *************** *** 1903,1907 **** def _do_pulldom_parse(func, args, kwargs): ! events = apply(func, args, kwargs) toktype, rootNode = events.getEvent() events.expandNode(rootNode) --- 1903,1907 ---- def _do_pulldom_parse(func, args, kwargs): ! events = func(*args, **kwargs) toktype, rootNode = events.getEvent() events.expandNode(rootNode) *************** *** 1916,1920 **** else: from xml.dom import pulldom ! return _do_pulldom_parse(pulldom.parse, (file,), {'parser': parser, 'bufsize': bufsize}) --- 1916,1920 ---- else: from xml.dom import pulldom ! return _do_pulldom_parse(pulldom.parse, (file,), {'parser': parser, 'bufsize': bufsize}) From just@letterror.com Sun Apr 6 11:44:33 2003 From: just@letterror.com (Just van Rossum) Date: Sun, 6 Apr 2003 12:44:33 +0200 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.11,1.12 FrameWork.py,1.3,1.4 MiniAEFrame.py,1.1,1.2 argvemulator.py,1.2,1.3 icopen.py,1.1,1.2 In-Reply-To: Message-ID: rhettinger@users.sourceforge.net wrote: > Modified Files: > EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py > icopen.py > Log Message: > SF patch #701494: more apply removals Ouch, this checkin also detabbed these files! This obscures the real change. Also: whether they need to be detabbed is up to Jack. I assume it was a simple oversight, please back this change out. Just From python@rcn.com Sun Apr 6 19:03:17 2003 From: python@rcn.com (Raymond Hettinger) Date: Sun, 6 Apr 2003 14:03:17 -0400 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6 References: Message-ID: <011301c2fc66$cd8b08e0$3311a044@oemcomputer> ----- Original Message ----- From: To: Sent: Tuesday, April 01, 2003 6:27 PM Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6 > Update of /cvsroot/python/python/dist/src/Lib/plat-mac > In directory sc8-pr-cvs1:/tmp/cvs-serv31003 > > Modified Files: > aetools.py > Log Message: > Sigh... The get() and set() commands are not declared in the aete for > the Standard_Suite, but various other suites do expect it (the Finder > implements get() without declaring it itself). It is probably another > case of OSA magic. Adding them to the global base class. > > > Index: aetools.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -C2 -d -r1.5 -r1.6 > *** aetools.py 31 Mar 2003 13:29:32 -0000 1.5 > --- aetools.py 1 Apr 2003 22:27:18 -0000 1.6 > *************** > *** 255,278 **** > item.__class__ = as > return item > > ! def _set(self, _object, _arguments = {}, _attributes = {}): > ! """ _set: set data for an object > ! Required argument: the object > ! Keyword argument _parameters: Parameter dictionary for the set operation > Keyword argument _attributes: AppleEvent attribute dictionary > - Returns: the data > """ > _code = 'core' > _subcode = 'setd' > ! > _arguments['----'] = _object > > _reply, _arguments, _attributes = self.send(_code, _subcode, > _arguments, _attributes) > ! if _arguments.has_key('errn'): > raise Error, decodeerror(_arguments) > ! > if _arguments.has_key('----'): > return _arguments['----'] > > # Tiny Finder class, for local use only > --- 255,287 ---- > item.__class__ = as > return item > + > + get = _get > + > + _argmap_set = { > + 'to' : 'data', > + } > > ! def _set(self, _object, _attributes={}, **_arguments): > ! """set: Set an object's data. > ! Required argument: the object for the command > ! Keyword argument to: The new value. > Keyword argument _attributes: AppleEvent attribute dictionary > """ > _code = 'core' > _subcode = 'setd' > ! > ! keysubst(_arguments, self._argmap_set) > _arguments['----'] = _object > > + > _reply, _arguments, _attributes = self.send(_code, _subcode, > _arguments, _attributes) > ! if _arguments.get('errn', 0): > raise Error, decodeerror(_arguments) > ! # XXXX Optionally decode result > if _arguments.has_key('----'): > return _arguments['----'] > + > + set = _set > > # Tiny Finder class, for local use only > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins From rhettinger@users.sourceforge.net Sun Apr 6 20:13:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 12:13:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.187,1.188 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14878/Lib/test Modified Files: test_descr.py Log Message: SF bug #699934: Obscure error message mwh pointed out that the error message did not make sense if obtained by rearranging the bases. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** test_descr.py 12 Mar 2003 04:25:42 -0000 1.187 --- test_descr.py 6 Apr 2003 19:13:40 -0000 1.188 *************** *** 1063,1069 **** Pane, ScrollingMixin, EditingMixin, object)) ! mro_err_msg = """Cannot create class.The superclasses have conflicting ! inheritance trees which leave the method resolution order (MRO) ! undefined for bases """ def mro_disagreement(): --- 1063,1068 ---- Pane, ScrollingMixin, EditingMixin, object)) ! mro_err_msg = """Cannot create a consistent method resolution ! order (MRO) for bases """ def mro_disagreement(): From rhettinger@users.sourceforge.net Sun Apr 6 20:13:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 12:13:44 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.220,2.221 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14878/Objects Modified Files: typeobject.c Log Message: SF bug #699934: Obscure error message mwh pointed out that the error message did not make sense if obtained by rearranging the bases. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.220 retrieving revision 2.221 diff -C2 -d -r2.220 -r2.221 *** typeobject.c 24 Mar 2003 23:49:49 -0000 2.220 --- typeobject.c 6 Apr 2003 19:13:41 -0000 2.221 *************** *** 1083,1090 **** n = PyDict_Size(set); ! off = PyOS_snprintf(buf, sizeof(buf), "Cannot create class.\ ! The superclasses have conflicting\n\ ! inheritance trees which leave the method resolution order (MRO)\n\ ! undefined for bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { --- 1083,1088 ---- n = PyDict_Size(set); ! off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \ ! consistent method resolution\norder (MRO) for bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { From tim_one@users.sourceforge.net Sun Apr 6 20:41:48 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 06 Apr 2003 12:41:48 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.64,2.65 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26159/Modules Modified Files: gcmodule.c Log Message: handle_finalizers(): Rewrote to call append_objects() and gc_list_merge() instead of looping. Smaller and clearer. Faster, too, when we're not appending to gc.garbage: gc_list_merge() takes constant time, regardless of the lists' sizes. append_objects(): Moved up to live with the other list manipulation utilities. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -d -r2.64 -r2.65 *** gcmodule.c 6 Apr 2003 01:50:50 -0000 2.64 --- gcmodule.c 6 Apr 2003 19:41:39 -0000 2.65 *************** *** 183,186 **** --- 183,204 ---- } + /* Append objects in a GC list to a Python list. + * Return 0 if all OK, < 0 if error (out of memory for list). + */ + static int + append_objects(PyObject *py_list, PyGC_Head *gc_list) + { + PyGC_Head *gc; + for (gc = gc_list->gc.gc_next; gc != gc_list; gc = gc->gc.gc_next) { + PyObject *op = FROM_GC(gc); + if (op != py_list) { + if (PyList_Append(py_list, op)) { + return -1; /* exception */ + } + } + } + return 0; + } + /*** end of list stuff ***/ *************** *** 458,466 **** /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). */ ! static void handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { - PyGC_Head *gc; if (garbage == NULL) { garbage = PyList_New(0); --- 476,488 ---- /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). + * If DEBUG_SAVEALL or hasfinalizer, the objects in finalizers are appended + * to the module garbage list (a Python list). The objects in finalizers + * are merged into the old list regardless. + * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). + * The finalizers list is made empty on a successful return. */ ! static int handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { if (garbage == NULL) { garbage = PyList_New(0); *************** *** 468,488 **** Py_FatalError("gc couldn't create gc.garbage list"); } ! for (gc = finalizers->gc.gc_next; ! gc != finalizers; ! gc = finalizers->gc.gc_next) { ! PyObject *op = FROM_GC(gc); ! ! assert(IS_REACHABLE(op)); ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { ! /* If SAVEALL is not set then just append objects with ! * finalizers to the list of garbage. All objects in ! * the finalizers list are reachable from those ! * objects. ! */ ! PyList_Append(garbage, op); ! } ! gc_list_remove(gc); ! gc_list_append(gc, old); } } --- 490,499 ---- Py_FatalError("gc couldn't create gc.garbage list"); } ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { ! if (append_objects(garbage, finalizers) < 0) ! return -1; } + gc_list_merge(finalizers, old); + return 0; } *************** *** 663,668 **** * this if they insist on creating this type of structure. */ ! handle_finalizers(&finalizers, old, 1); ! handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { --- 674,679 ---- * this if they insist on creating this type of structure. */ ! if (handle_finalizers(&finalizers, old, 1) == 0) ! (void)handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { *************** *** 907,926 **** "Return a list of objects tracked by the collector (excluding the list\n" "returned).\n"); - - /* appending objects in a GC list to a Python list */ - static int - append_objects(PyObject *py_list, PyGC_Head *gc_list) - { - PyGC_Head *gc; - for (gc = gc_list->gc.gc_next; gc != gc_list; gc = gc->gc.gc_next) { - PyObject *op = FROM_GC(gc); - if (op != py_list) { - if (PyList_Append(py_list, op)) { - return -1; /* exception */ - } - } - } - return 0; - } static PyObject * --- 918,921 ---- From tim_one@users.sourceforge.net Mon Apr 7 00:30:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 06 Apr 2003 16:30:56 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.65,2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29154/Modules Modified Files: gcmodule.c Log Message: initgc(): Rewrote to use the PyModule_AddXYZ API; cuts code size. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** gcmodule.c 6 Apr 2003 19:41:39 -0000 2.65 --- gcmodule.c 6 Apr 2003 23:30:52 -0000 2.66 *************** *** 974,978 **** { PyObject *m; - PyObject *d; m = Py_InitModule4("gc", --- 974,977 ---- *************** *** 981,1003 **** NULL, PYTHON_API_VERSION); ! d = PyModule_GetDict(m); if (garbage == NULL) { garbage = PyList_New(0); } ! PyDict_SetItemString(d, "garbage", garbage); ! PyDict_SetItemString(d, "DEBUG_STATS", ! PyInt_FromLong(DEBUG_STATS)); ! PyDict_SetItemString(d, "DEBUG_COLLECTABLE", ! PyInt_FromLong(DEBUG_COLLECTABLE)); ! PyDict_SetItemString(d, "DEBUG_UNCOLLECTABLE", ! PyInt_FromLong(DEBUG_UNCOLLECTABLE)); ! PyDict_SetItemString(d, "DEBUG_INSTANCES", ! PyInt_FromLong(DEBUG_INSTANCES)); ! PyDict_SetItemString(d, "DEBUG_OBJECTS", ! PyInt_FromLong(DEBUG_OBJECTS)); ! PyDict_SetItemString(d, "DEBUG_SAVEALL", ! PyInt_FromLong(DEBUG_SAVEALL)); ! PyDict_SetItemString(d, "DEBUG_LEAK", ! PyInt_FromLong(DEBUG_LEAK)); } --- 980,1000 ---- NULL, PYTHON_API_VERSION); ! if (garbage == NULL) { garbage = PyList_New(0); + if (garbage == NULL) + return; } ! if (PyModule_AddObject(m, "garbage", garbage) < 0) ! return; ! #define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) return ! ADD_INT(DEBUG_STATS); ! ADD_INT(DEBUG_COLLECTABLE); ! ADD_INT(DEBUG_UNCOLLECTABLE); ! ADD_INT(DEBUG_INSTANCES); ! ADD_INT(DEBUG_OBJECTS); ! ADD_INT(DEBUG_SAVEALL); ! ADD_INT(DEBUG_LEAK); ! #undef ADD_INT } From anthonybaxter@users.sourceforge.net Mon Apr 7 13:19:17 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 07 Apr 2003 05:19:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,NONE,1.1 lib.tex,1.216,1.217 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19214 Modified Files: lib.tex Added Files: libhotshot.tex Log Message: patch [ 698505 ] docs for hotshot module --- NEW FILE: libhotshot.tex --- \section{\module{hotshot} --- High performance logging profiler} \declaremodule{standard}{hotshot} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} \versionadded{2.2} \modulesynopsis{High performance logging profiler, mostly written in C.} This module provides a nicer interface to the \code{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's written mostly in C, it should result in a much smaller performance impact than the existing profile module. \begin{classdesc}{Profile}{logfile, \optional{, lineevents=0, linetimings=1}} The profiler object. The argument \var{logfile} is the name of a log file to use for logged profile data. The argument \var{lineevents} specifies whether to generate events for every source line, or just on function call/return. It defaults to 0 (only log function call/return). The argument \var{linetimings} specifies whether to record timing information. It defaults to 1 (store timing information). \end{classdesc} \subsection{Profile Objects \label{hotshot-objects}} Profile objects have the following methods: \begin{methoddesc}{addinfo}{key, value} Add an arbitrary labelled value to the profile output. \end{methoddesc} \begin{methoddesc}{close}{} Close the logfile and terminate the profiler. \end{methoddesc} % \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. \end{methoddesc} \begin{methoddesc}{run}{cmd} Profile an exec-compatible string in the script environment. The globals from the \module{__main__} module are used as both the globals and locals for the script. \end{methoddesc} \begin{methoddesc}{runcall}{func, *args, **keywords} Profile a single call of a callable. Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are allowed to propogate cleanly, while ensuring that profiling is disabled on the way out. \end{methoddesc} \begin{methoddesc}{runctx}{cmd, globals, locals} Evaluate an exec-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} \begin{methoddesc}{start}{} Start the profiler. \end{methoddesc} \begin{methoddesc}{stop}{} Stop the profiler. \end{methoddesc} \subsection{Using hotshot data} \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} \seemodule{profile}{The profile module's \class{Stats} class. } \end{seealso} \subsection{Example Usage \label{hotshot-example}} \begin{verbatim} >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") >>> benchtime, stones = prof.runcall(test.pystone.pystones) >>> prof.close() >>> stats = hotshot.stats.load("stones.prof") >>> stats.strip_dirs() >>> stats.sort_stats('time', 'calls') >>> stats.print_stats(20) 850004 function calls in 10.090 CPU seconds Ordered by: internal time, call count ncalls tottime percall cumtime percall filename:lineno(function) 1 3.295 3.295 10.090 10.090 pystone.py:79(Proc0) 150000 1.315 0.000 1.315 0.000 pystone.py:203(Proc7) 50000 1.313 0.000 1.463 0.000 pystone.py:229(Func2) . . . \end{verbatim} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** lib.tex 20 Mar 2003 23:35:00 -0000 1.216 --- lib.tex 7 Apr 2003 12:19:14 -0000 1.217 *************** *** 206,209 **** --- 206,210 ---- \input{libprofile} % The Python Profiler + \input{libhotshot} % New profiler \input{internet} % Internet Protocols From anthonybaxter@users.sourceforge.net Mon Apr 7 13:22:00 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 07 Apr 2003 05:22:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20202 Modified Files: libhotshot.tex Log Message: add note suggested by rhettinger about example. Index: libhotshot.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhotshot.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libhotshot.tex 7 Apr 2003 12:19:15 -0000 1.1 --- libhotshot.tex 7 Apr 2003 12:21:56 -0000 1.2 *************** *** 97,100 **** --- 97,103 ---- \subsection{Example Usage \label{hotshot-example}} + Note that this example runs the python "benchmark" pystones. It can + take some time to run, and will produce large output files. + \begin{verbatim} From tim_one@users.sourceforge.net Mon Apr 7 18:52:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 10:52:01 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv9658/Include Modified Files: classobject.h Log Message: New private API function _PyInstance_Lookup. gc will use this to figure out whether __del__ exists, without executing any Python-level code. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** classobject.h 12 Aug 2002 07:21:56 -0000 2.41 --- classobject.h 7 Apr 2003 17:51:58 -0000 2.42 *************** *** 52,55 **** --- 52,67 ---- PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); + /* Look up attribute with name (a string) on instance object pinst, using + * only the instance and base class dicts. If a descriptor is found in + * a class dict, the descriptor is returned without calling it. + * Returns NULL if nothing found, else a borrowed reference to the + * value associated with name in the dict in which name was found. + * The point of this routine is that it never calls arbitrary Python + * code, so is always "safe": all it does is dict lookups. The function + * can't fail, never sets an exceptionm, and NULL is not an error (it just + * means "not found"). + */ + PyAPI_FUNC(PyObject *)_PyInstance_Lookup(PyObject *pinst, PyObject *name); + /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ From tim_one@users.sourceforge.net Mon Apr 7 18:52:03 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 10:52:03 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.168,2.169 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv9658/Objects Modified Files: classobject.c Log Message: New private API function _PyInstance_Lookup. gc will use this to figure out whether __del__ exists, without executing any Python-level code. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** classobject.c 11 Feb 2003 18:43:00 -0000 2.168 --- classobject.c 7 Apr 2003 17:51:59 -0000 2.169 *************** *** 760,763 **** --- 760,784 ---- } + /* See classobject.h comments: this only does dict lookups, and is always + * safe to call. + */ + PyObject * + _PyInstance_Lookup(PyObject *pinst, PyObject *name) + { + PyObject *v; + PyClassObject *class; + PyInstanceObject *inst; /* pinst cast to the right type */ + + assert(PyInstance_Check(pinst)); + inst = (PyInstanceObject *)pinst; + + assert(PyString_Check(name)); + + v = PyDict_GetItem(inst->in_dict, name); + if (v == NULL) + v = class_lookup(inst->in_class, name, &class); + return v; + } + static int instance_setattr1(PyInstanceObject *inst, PyObject *name, PyObject *v) From tim_one@users.sourceforge.net Mon Apr 7 20:21:21 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 12:21:21 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25392/python/Modules Modified Files: gcmodule.c Log Message: Reworked has_finalizer() to use the new _PyObject_Lookup() instead of PyObject_HasAttr(); the former promises never to execute arbitrary Python code. Undid many of the changes recently made to worm around the worst consequences of that PyObject_HasAttr() could execute arbitrary Python code. Compatibility is hard to discuss, because the dangerous cases are so perverse, and much of this appears to rely on implementation accidents. To start with, using hasattr() to check for __del__ wasn't only dangerous, in some cases it was wrong: if an instance of an old- style class didn't have "__del__" in its instance dict or in any base class dict, but a getattr hook said __del__ existed, then hasattr() said "yes, this object has a __del__". But instance_dealloc() ignores the possibility of getattr hooks when looking for a __del__, so while object.__del__ succeeds, no __del__ method is called when the object is deleted. gc was therefore incorrect in believing that the object had a finalizer. The new method doesn't suffer that problem (like instance_dealloc(), _PyObject_Lookup() doesn't believe __del__ exists in that case), but does suffer a somewhat opposite-- and even more obscure --oddity: if an instance of an old-style class doesn't have "__del__" in its instance dict, and a base class does have "__del__" in its dict, and the first base class with a "__del__" associates it with a descriptor (an object with a __get__ method), *and* if that descriptor raises an exception when __get__ is called, then (a) the current method believes the instance does have a __del__, but (b) hasattr() does not believe the instance has a __del__. While these disagree, I believe the new method is "more correct": because the descriptor *will* be called when the object is destructed, it can execute arbitrary Python code at the time the object is destructed, and that's really what gc means by "has a finalizer": not specifically a __del__ method, but more generally the possibility of executing arbitrary Python code at object destruction time. Code in a descriptor's __get__() executed at destruction time can be just as problematic as code in a __del__() executed then. So I believe the new method is better on all counts. Bugfix candidate, but it's unclear to me how all this differs in the 2.2 branch (e.g., new-style and old-style classes already took different gc paths in 2.3 before this last round of patches, but don't in the 2.2 branch). Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** gcmodule.c 6 Apr 2003 23:30:52 -0000 2.66 --- gcmodule.c 7 Apr 2003 19:21:15 -0000 2.67 *************** *** 360,366 **** /* Return true if object has a finalization method. * CAUTION: An instance of an old-style class has to be checked for a ! *__del__ method, and that can cause arbitrary Python code to get executed ! * via the class's __getattr__ hook (if any). This function can therefore ! * mutate the object graph, and that's been the source of subtle bugs. */ static int --- 360,367 ---- /* Return true if object has a finalization method. * CAUTION: An instance of an old-style class has to be checked for a ! *__del__ method, and earlier versions of this used to call PyObject_HasAttr, ! * which in turn could call the class's __getattr__ hook (if any). That ! * could invoke arbitrary Python code, mutating the object graph in arbitrary ! * ways, and that was the source of some excruciatingly subtle bugs. */ static int *************** *** 368,376 **** { if (PyInstance_Check(op)) { - /* This is the dangerous path: hasattr can invoke - * the class __getattr__(), and that can do anything. - */ assert(delstr != NULL); ! return PyObject_HasAttr(op, delstr); } else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) --- 369,374 ---- { if (PyInstance_Check(op)) { assert(delstr != NULL); ! return _PyInstance_Lookup(op, delstr) != NULL; } else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) *************** *** 380,415 **** } ! /* Move all objects out of unreachable, into collectable or finalizers. ! * It's possible that some objects will get collected (via refcount falling ! * to 0), or resurrected, as a side effect of checking for __del__ methods. ! * After, finalizers contains all the objects from unreachable that haven't ! * been collected by magic, and that have a finalizer. gc_refs is ! * GC_REACHABLE for all of those. collectable contains all the remaining ! * objects from unreachable, and gc_refs remains GC_TENTATIVELY_UNREACHABLE ! * for those (we're still not sure they're reclaimable after this! Some ! * may yet by reachable *from* the objects in finalizers). */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *collectable, ! PyGC_Head *finalizers) { ! while (!gc_list_is_empty(unreachable)) { ! PyGC_Head *gc = unreachable->gc.gc_next; PyObject *op = FROM_GC(gc); ! int finalizer; assert(IS_TENTATIVELY_UNREACHABLE(op)); ! finalizer = has_finalizer(op); ! if (unreachable->gc.gc_next == gc) { gc_list_remove(gc); ! if (finalizer) { ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! else ! gc_list_append(gc, collectable); } ! /* else has_finalizer() deleted op via side effect */ } } --- 378,403 ---- } ! /* Move the objects in unreachable with __del__ methods into finalizers. ! * The objects remaining in unreachable do not have __del__ methods, and ! * gc_refs remains GC_TENTATIVELY_UNREACHABLE for them. The objects ! * moved into finalizers have gc_refs changed to GC_REACHABLE. */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { ! PyGC_Head *gc = unreachable->gc.gc_next; ! ! while (gc != unreachable) { PyObject *op = FROM_GC(gc); ! PyGC_Head *next = gc->gc.gc_next; assert(IS_TENTATIVELY_UNREACHABLE(op)); ! if (has_finalizer(op)) { gc_list_remove(gc); ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; } ! gc = next; } } *************** *** 431,439 **** /* Move objects that are reachable from finalizers, from the unreachable set ! * into the reachable_from_finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers, ! PyGC_Head *reachable_from_finalizers) { traverseproc traverse; --- 419,426 ---- /* Move objects that are reachable from finalizers, from the unreachable set ! * into finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers) { traverseproc traverse; *************** *** 444,448 **** (void) traverse(FROM_GC(gc), (visitproc)visit_move, ! (void *)reachable_from_finalizers); } } --- 431,435 ---- (void) traverse(FROM_GC(gc), (visitproc)visit_move, ! (void *)finalizers); } } *************** *** 476,488 **** /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). ! * If DEBUG_SAVEALL or hasfinalizer, the objects in finalizers are appended ! * to the module garbage list (a Python list). The objects in finalizers ! * are merged into the old list regardless. * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). * The finalizers list is made empty on a successful return. */ static int ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { if (garbage == NULL) { garbage = PyList_New(0); --- 463,478 ---- /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). ! * If DEBUG_SAVEALL, all objects in finalizers are appended to the module ! * garbage list (a Python list), else only the objects in finalizers with ! * __del__ methods are appended to garbage. All objects in finalizers are ! * merged into the old list regardless. * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). * The finalizers list is made empty on a successful return. */ static int ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { + PyGC_Head *gc = finalizers->gc.gc_next; + if (garbage == NULL) { garbage = PyList_New(0); *************** *** 490,497 **** Py_FatalError("gc couldn't create gc.garbage list"); } ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { ! if (append_objects(garbage, finalizers) < 0) ! return -1; } gc_list_merge(finalizers, old); return 0; --- 480,492 ---- Py_FatalError("gc couldn't create gc.garbage list"); } ! for (; gc != finalizers; gc = gc->gc.gc_next) { ! PyObject *op = FROM_GC(gc); ! ! if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { ! if (PyList_Append(garbage, op) < 0) ! return -1; ! } } + gc_list_merge(finalizers, old); return 0; *************** *** 542,548 **** PyGC_Head *old; /* next older generation */ PyGC_Head unreachable; - PyGC_Head collectable; PyGC_Head finalizers; - PyGC_Head reachable_from_finalizers; PyGC_Head *gc; --- 537,541 ---- *************** *** 607,635 **** * instance objects with __del__ methods. * ! * Move each unreachable object into the collectable set or the ! * finalizers set. Because we need to check for __del__ methods on ! * instances of classic classes, arbitrary Python code may get ! * executed by getattr hooks: that may resurrect or deallocate (via ! * refcount falling to 0) unreachable objects, so this is very ! * delicate. ! */ ! gc_list_init(&collectable); gc_list_init(&finalizers); ! move_finalizers(&unreachable, &collectable, &finalizers); /* finalizers contains the unreachable objects with a finalizer; * unreachable objects reachable only *from* those are also ! * uncollectable; we move those into a separate list ! * (reachable_from_finalizers) so we don't have to do the dangerous ! * has_finalizer() test again later. */ ! gc_list_init(&reachable_from_finalizers); ! move_finalizer_reachable(&finalizers, &reachable_from_finalizers); ! /* And move everything only reachable from the reachable stuff. */ ! move_finalizer_reachable(&reachable_from_finalizers, ! &reachable_from_finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = collectable.gc.gc_next; gc != &collectable; gc = gc->gc.gc_next) { m++; --- 600,616 ---- * instance objects with __del__ methods. * ! * Move unreachable objects with finalizers into a different list. ! */ gc_list_init(&finalizers); ! move_finalizers(&unreachable, &finalizers); /* finalizers contains the unreachable objects with a finalizer; * unreachable objects reachable only *from* those are also ! * uncollectable, and we move those into the finalizers list too. */ ! move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; *************** *** 641,645 **** * the reference cycles to be broken. It may also cause some objects * in finalizers and/or reachable_from_finalizers to be freed */ ! delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print --- 622,626 ---- * the reference cycles to be broken. It may also cause some objects * in finalizers and/or reachable_from_finalizers to be freed */ ! delete_garbage(&unreachable, old); /* Collect statistics on uncollectable objects found and print *************** *** 652,662 **** debug_cycle("uncollectable", FROM_GC(gc)); } - for (gc = reachable_from_finalizers.gc.gc_next; - gc != &reachable_from_finalizers; - gc = gc->gc.gc_next) { - n++; - if (debug & DEBUG_UNCOLLECTABLE) - debug_cycle("uncollectable", FROM_GC(gc)); - } if (debug & DEBUG_STATS) { if (m == 0 && n == 0) { --- 633,636 ---- *************** *** 674,684 **** * this if they insist on creating this type of structure. */ ! if (handle_finalizers(&finalizers, old, 1) == 0) ! (void)handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { ! if (gc_str == NULL) { gc_str = PyString_FromString("garbage collection"); - } PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); --- 648,656 ---- * this if they insist on creating this type of structure. */ ! (void)handle_finalizers(&finalizers, old); if (PyErr_Occurred()) { ! if (gc_str == NULL) gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); From tim_one@users.sourceforge.net Mon Apr 7 20:21:45 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 12:21:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25392/python/Lib/test Modified Files: test_gc.py Log Message: Reworked has_finalizer() to use the new _PyObject_Lookup() instead of PyObject_HasAttr(); the former promises never to execute arbitrary Python code. Undid many of the changes recently made to worm around the worst consequences of that PyObject_HasAttr() could execute arbitrary Python code. Compatibility is hard to discuss, because the dangerous cases are so perverse, and much of this appears to rely on implementation accidents. To start with, using hasattr() to check for __del__ wasn't only dangerous, in some cases it was wrong: if an instance of an old- style class didn't have "__del__" in its instance dict or in any base class dict, but a getattr hook said __del__ existed, then hasattr() said "yes, this object has a __del__". But instance_dealloc() ignores the possibility of getattr hooks when looking for a __del__, so while object.__del__ succeeds, no __del__ method is called when the object is deleted. gc was therefore incorrect in believing that the object had a finalizer. The new method doesn't suffer that problem (like instance_dealloc(), _PyObject_Lookup() doesn't believe __del__ exists in that case), but does suffer a somewhat opposite-- and even more obscure --oddity: if an instance of an old-style class doesn't have "__del__" in its instance dict, and a base class does have "__del__" in its dict, and the first base class with a "__del__" associates it with a descriptor (an object with a __get__ method), *and* if that descriptor raises an exception when __get__ is called, then (a) the current method believes the instance does have a __del__, but (b) hasattr() does not believe the instance has a __del__. While these disagree, I believe the new method is "more correct": because the descriptor *will* be called when the object is destructed, it can execute arbitrary Python code at the time the object is destructed, and that's really what gc means by "has a finalizer": not specifically a __del__ method, but more generally the possibility of executing arbitrary Python code at object destruction time. Code in a descriptor's __get__() executed at destruction time can be just as problematic as code in a __del__() executed then. So I believe the new method is better on all counts. Bugfix candidate, but it's unclear to me how all this differs in the 2.2 branch (e.g., new-style and old-style classes already took different gc paths in 2.3 before this last round of patches, but don't in the 2.2 branch). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_gc.py 6 Apr 2003 00:11:38 -0000 1.26 --- test_gc.py 7 Apr 2003 19:21:11 -0000 1.27 *************** *** 273,278 **** # trash cycle to get reclaimed via refcounts falling to 0, thus mutating # the trash graph as a side effect of merely asking whether __del__ ! # exists. This used to (before 2.3b1) crash Python. ! expect(gc.collect(), 0, "boom") expect(len(gc.garbage), garbagelen, "boom") --- 273,279 ---- # trash cycle to get reclaimed via refcounts falling to 0, thus mutating # the trash graph as a side effect of merely asking whether __del__ ! # exists. This used to (before 2.3b1) crash Python. Now __getattr__ ! # isn't called. ! expect(gc.collect(), 4, "boom") expect(len(gc.garbage), garbagelen, "boom") From tim_one@users.sourceforge.net Mon Apr 7 20:21:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 12:21:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.713,1.714 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25392/python/Misc Modified Files: NEWS Log Message: Reworked has_finalizer() to use the new _PyObject_Lookup() instead of PyObject_HasAttr(); the former promises never to execute arbitrary Python code. Undid many of the changes recently made to worm around the worst consequences of that PyObject_HasAttr() could execute arbitrary Python code. Compatibility is hard to discuss, because the dangerous cases are so perverse, and much of this appears to rely on implementation accidents. To start with, using hasattr() to check for __del__ wasn't only dangerous, in some cases it was wrong: if an instance of an old- style class didn't have "__del__" in its instance dict or in any base class dict, but a getattr hook said __del__ existed, then hasattr() said "yes, this object has a __del__". But instance_dealloc() ignores the possibility of getattr hooks when looking for a __del__, so while object.__del__ succeeds, no __del__ method is called when the object is deleted. gc was therefore incorrect in believing that the object had a finalizer. The new method doesn't suffer that problem (like instance_dealloc(), _PyObject_Lookup() doesn't believe __del__ exists in that case), but does suffer a somewhat opposite-- and even more obscure --oddity: if an instance of an old-style class doesn't have "__del__" in its instance dict, and a base class does have "__del__" in its dict, and the first base class with a "__del__" associates it with a descriptor (an object with a __get__ method), *and* if that descriptor raises an exception when __get__ is called, then (a) the current method believes the instance does have a __del__, but (b) hasattr() does not believe the instance has a __del__. While these disagree, I believe the new method is "more correct": because the descriptor *will* be called when the object is destructed, it can execute arbitrary Python code at the time the object is destructed, and that's really what gc means by "has a finalizer": not specifically a __del__ method, but more generally the possibility of executing arbitrary Python code at object destruction time. Code in a descriptor's __get__() executed at destruction time can be just as problematic as code in a __del__() executed then. So I believe the new method is better on all counts. Bugfix candidate, but it's unclear to me how all this differs in the 2.2 branch (e.g., new-style and old-style classes already took different gc paths in 2.3 before this last round of patches, but don't in the 2.2 branch). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.713 retrieving revision 1.714 diff -C2 -d -r1.713 -r1.714 *** NEWS 4 Apr 2003 22:56:42 -0000 1.713 --- NEWS 7 Apr 2003 19:21:12 -0000 1.714 *************** *** 13,16 **** --- 13,24 ---- ----------------- + - Some horridly obscure problems were fixed involving interaction + between garbage collection and old-style classes with "ambitious" + getattr hooks. If an old-style instance didn't have a __del__ method, + but did have a __getattr__ hook, and the instance became reachable + only from an unreachable cycle, and the hook resurrected or deleted + unreachable objects when asked to resolve "__del__", anything up to + a segfault could happen. That's been repaired. + - dict.pop now takes an optional argument specifying a default value to return if the key is not in the dict. If a default is not *************** *** 78,82 **** result for classes that define __eq__ without defining __ne__. ! - sgmllib now supports SGML marked sections, in particular the MS Office extensions. --- 86,90 ---- result for classes that define __eq__ without defining __ne__. ! - sgmllib now supports SGML marked sections, in particular the MS Office extensions. *************** *** 155,162 **** currently in the background they will ask to be moved to the foreground before displaying. ! - OSA Scripting support has improved a lot, and gensuitemodule.py can now be used by mere mortals. ! - The IDE (in a framework build) now includes introductory documentation in Apple Help Viewer format. --- 163,170 ---- currently in the background they will ask to be moved to the foreground before displaying. ! - OSA Scripting support has improved a lot, and gensuitemodule.py can now be used by mere mortals. ! - The IDE (in a framework build) now includes introductory documentation in Apple Help Viewer format. From tim_one@users.sourceforge.net Mon Apr 7 23:41:29 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 15:41:29 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.67,2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24916/python/Modules Modified Files: gcmodule.c Log Message: Comment repair; no semantic changes. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** gcmodule.c 7 Apr 2003 19:21:15 -0000 2.67 --- gcmodule.c 7 Apr 2003 22:41:24 -0000 2.68 *************** *** 619,625 **** } } ! /* Call tp_clear on objects in the collectable set. This will cause ! * the reference cycles to be broken. It may also cause some objects ! * in finalizers and/or reachable_from_finalizers to be freed */ delete_garbage(&unreachable, old); --- 619,626 ---- } } ! /* Call tp_clear on objects in the unreachable set. This will cause ! * the reference cycles to be broken. It may also cause some objects ! * in finalizers to be freed. ! */ delete_garbage(&unreachable, old); *************** *** 652,656 **** if (PyErr_Occurred()) { if (gc_str == NULL) ! gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); --- 653,657 ---- if (PyErr_Occurred()) { if (gc_str == NULL) ! gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); From tim_one@users.sourceforge.net Tue Apr 8 17:39:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:39:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.714,1.715 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Misc Modified Files: NEWS Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.714 retrieving revision 1.715 diff -C2 -d -r1.714 -r1.715 *** NEWS 7 Apr 2003 19:21:12 -0000 1.714 --- NEWS 8 Apr 2003 16:39:41 -0000 1.715 *************** *** 50,53 **** --- 50,58 ---- ----------------- + - New function gc.get_referrents(obj) returns a list of objects + directly referenced by obj. In effect, it exposes what the object's + tp_traverse slot does, and can be helpful when debugging memory + leaks. + - The iconv module has been removed from this release. From tim_one@users.sourceforge.net Tue Apr 8 17:39:52 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:39:52 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.68,2.69 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Modules Modified Files: gcmodule.c Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** gcmodule.c 7 Apr 2003 22:41:24 -0000 2.68 --- gcmodule.c 8 Apr 2003 16:39:48 -0000 2.69 *************** *** 858,867 **** } static int referrentsvisit(PyObject *obj, PyObject *list) { ! if (PyList_Append(list, obj) < 0) ! return 1; ! return 0; } --- 858,866 ---- } + /* Append obj to list; return true if error (out of memory), false if OK. */ static int referrentsvisit(PyObject *obj, PyObject *list) { ! return PyList_Append(list, obj) < 0; } *************** *** 875,885 **** int i; PyObject *result = PyList_New(0); for (i = 0; i < PyTuple_GET_SIZE(args); i++) { PyObject *obj = PyTuple_GET_ITEM(args, i); ! traverseproc traverse = obj->ob_type->tp_traverse; ! if (!traverse) continue; ! if (traverse(obj, (visitproc)referrentsvisit, result)) return NULL; } return result; --- 874,894 ---- int i; PyObject *result = PyList_New(0); + + if (result == NULL) + return NULL; + for (i = 0; i < PyTuple_GET_SIZE(args); i++) { + traverseproc traverse; PyObject *obj = PyTuple_GET_ITEM(args, i); ! ! if (! PyObject_IS_GC(obj)) continue; ! traverse = obj->ob_type->tp_traverse; ! if (! traverse) ! continue; ! if (traverse(obj, (visitproc)referrentsvisit, result)) { ! Py_DECREF(result); return NULL; + } } return result; From tim_one@users.sourceforge.net Tue Apr 8 17:40:12 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:40:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Doc/lib Modified Files: libgc.tex Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libgc.tex 10 Jul 2002 19:21:07 -0000 1.11 --- libgc.tex 8 Apr 2003 16:39:38 -0000 1.12 *************** *** 100,103 **** --- 100,116 ---- \end{funcdesc} + \begin{funcdesc}{get_referrents}{*objs} + Return a list of objects directly referred to by any of the arguments. + The referrents returned are those objects visited by the arguments' + C-level \cfunction{tp_traverse} methods (if any), and may not be all + objects actually directly reachable. \cfunction{tp_traverse} methods + are supported only by objects that support garbage collection, and are + only required to visit objects that may be involved in a cycle. So, + for example, if an integer is directly reachable from an argument, that + integer object may or may not appear in the result list. + + \versionadded{2.3} + \end{funcdesc} + The following variable is provided for read-only access (you can mutate its value but should not rebind it): From tim_one@users.sourceforge.net Tue Apr 8 17:40:16 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:40:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Lib/test Modified Files: test_gc.py Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_gc.py 7 Apr 2003 19:21:11 -0000 1.27 --- test_gc.py 8 Apr 2003 16:39:39 -0000 1.28 *************** *** 5,9 **** def expect(actual, expected, name): if actual != expected: ! raise TestFailed, "test_%s: actual %d, expected %d" % ( name, actual, expected) --- 5,9 ---- def expect(actual, expected, name): if actual != expected: ! raise TestFailed, "test_%s: actual %r, expected %r" % ( name, actual, expected) *************** *** 305,308 **** --- 305,331 ---- expect(len(gc.garbage), garbagelen, "boom2") + def test_get_referrents(): + alist = [1, 3, 5] + got = gc.get_referrents(alist) + got.sort() + expect(got, alist, "get_referrents") + + atuple = tuple(alist) + got = gc.get_referrents(atuple) + got.sort() + expect(got, alist, "get_referrents") + + adict = {1: 3, 5: 7} + expected = [1, 3, 5, 7] + got = gc.get_referrents(adict) + got.sort() + expect(got, expected, "get_referrents") + + got = gc.get_referrents([1, 2], {3: 4}, (0, 0, 0)) + got.sort() + expect(got, [0, 0] + range(5), "get_referrents") + + expect(gc.get_referrents(1, 'a', 4j), [], "get_referrents") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 325,328 **** --- 348,352 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) + run_test("get_referrents", test_get_referrents) def test(): From tim_one@users.sourceforge.net Tue Apr 8 18:17:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:19 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.715,1.716 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Misc Modified Files: NEWS Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.715 retrieving revision 1.716 diff -C2 -d -r1.715 -r1.716 *** NEWS 8 Apr 2003 16:39:41 -0000 1.715 --- NEWS 8 Apr 2003 17:17:16 -0000 1.716 *************** *** 50,54 **** ----------------- ! - New function gc.get_referrents(obj) returns a list of objects directly referenced by obj. In effect, it exposes what the object's tp_traverse slot does, and can be helpful when debugging memory --- 50,54 ---- ----------------- ! - New function gc.get_referents(obj) returns a list of objects directly referenced by obj. In effect, it exposes what the object's tp_traverse slot does, and can be helpful when debugging memory From tim_one@users.sourceforge.net Tue Apr 8 18:17:21 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:21 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Modules Modified Files: gcmodule.c Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** gcmodule.c 8 Apr 2003 16:39:48 -0000 2.69 --- gcmodule.c 8 Apr 2003 17:17:17 -0000 2.70 *************** *** 860,874 **** /* Append obj to list; return true if error (out of memory), false if OK. */ static int ! referrentsvisit(PyObject *obj, PyObject *list) { return PyList_Append(list, obj) < 0; } ! PyDoc_STRVAR(gc_get_referrents__doc__, ! "get_referrents(*objs) -> list\n\ Return the list of objects that are directly referred to by objs."); static PyObject * ! gc_get_referrents(PyObject *self, PyObject *args) { int i; --- 860,874 ---- /* Append obj to list; return true if error (out of memory), false if OK. */ static int ! referentsvisit(PyObject *obj, PyObject *list) { return PyList_Append(list, obj) < 0; } ! PyDoc_STRVAR(gc_get_referents__doc__, ! "get_referents(*objs) -> list\n\ Return the list of objects that are directly referred to by objs."); static PyObject * ! gc_get_referents(PyObject *self, PyObject *args) { int i; *************** *** 887,891 **** if (! traverse) continue; ! if (traverse(obj, (visitproc)referrentsvisit, result)) { Py_DECREF(result); return NULL; --- 887,891 ---- if (! traverse) continue; ! if (traverse(obj, (visitproc)referentsvisit, result)) { Py_DECREF(result); return NULL; *************** *** 933,937 **** "get_objects() -- Return a list of all objects tracked by the collector.\n" "get_referrers() -- Return the list of objects that refer to an object.\n" ! "get_referrents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { --- 933,937 ---- "get_objects() -- Return a list of all objects tracked by the collector.\n" "get_referrers() -- Return the list of objects that refer to an object.\n" ! "get_referents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { *************** *** 947,952 **** {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, ! {"get_referrents", gc_get_referrents, METH_VARARGS, ! gc_get_referrents__doc__}, {NULL, NULL} /* Sentinel */ }; --- 947,952 ---- {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, ! {"get_referents", gc_get_referents, METH_VARARGS, ! gc_get_referents__doc__}, {NULL, NULL} /* Sentinel */ }; From tim_one@users.sourceforge.net Tue Apr 8 18:17:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Doc/lib Modified Files: libgc.tex Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libgc.tex 8 Apr 2003 16:39:38 -0000 1.12 --- libgc.tex 8 Apr 2003 17:17:14 -0000 1.13 *************** *** 100,106 **** \end{funcdesc} ! \begin{funcdesc}{get_referrents}{*objs} Return a list of objects directly referred to by any of the arguments. ! The referrents returned are those objects visited by the arguments' C-level \cfunction{tp_traverse} methods (if any), and may not be all objects actually directly reachable. \cfunction{tp_traverse} methods --- 100,106 ---- \end{funcdesc} ! \begin{funcdesc}{get_referents}{*objs} Return a list of objects directly referred to by any of the arguments. ! The referents returned are those objects visited by the arguments' C-level \cfunction{tp_traverse} methods (if any), and may not be all objects actually directly reachable. \cfunction{tp_traverse} methods From tim_one@users.sourceforge.net Tue Apr 8 18:17:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Lib/test Modified Files: test_gc.py Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_gc.py 8 Apr 2003 16:39:39 -0000 1.28 --- test_gc.py 8 Apr 2003 17:17:15 -0000 1.29 *************** *** 305,330 **** expect(len(gc.garbage), garbagelen, "boom2") ! def test_get_referrents(): alist = [1, 3, 5] ! got = gc.get_referrents(alist) got.sort() ! expect(got, alist, "get_referrents") atuple = tuple(alist) ! got = gc.get_referrents(atuple) got.sort() ! expect(got, alist, "get_referrents") adict = {1: 3, 5: 7} expected = [1, 3, 5, 7] ! got = gc.get_referrents(adict) got.sort() ! expect(got, expected, "get_referrents") ! got = gc.get_referrents([1, 2], {3: 4}, (0, 0, 0)) got.sort() ! expect(got, [0, 0] + range(5), "get_referrents") ! expect(gc.get_referrents(1, 'a', 4j), [], "get_referrents") def test_all(): --- 305,330 ---- expect(len(gc.garbage), garbagelen, "boom2") ! def test_get_referents(): alist = [1, 3, 5] ! got = gc.get_referents(alist) got.sort() ! expect(got, alist, "get_referents") atuple = tuple(alist) ! got = gc.get_referents(atuple) got.sort() ! expect(got, alist, "get_referents") adict = {1: 3, 5: 7} expected = [1, 3, 5, 7] ! got = gc.get_referents(adict) got.sort() ! expect(got, expected, "get_referents") ! got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) got.sort() ! expect(got, [0, 0] + range(5), "get_referents") ! expect(gc.get_referents(1, 'a', 4j), [], "get_referents") def test_all(): *************** *** 348,352 **** run_test("boom", test_boom) run_test("boom2", test_boom2) ! run_test("get_referrents", test_get_referrents) def test(): --- 348,352 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) ! run_test("get_referents", test_get_referents) def test(): From fdrake@users.sourceforge.net Tue Apr 8 18:37:52 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:37:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30310 Modified Files: libgc.tex Log Message: Markup fix. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libgc.tex 8 Apr 2003 17:17:14 -0000 1.13 --- libgc.tex 8 Apr 2003 17:37:47 -0000 1.14 *************** *** 103,108 **** Return a list of objects directly referred to by any of the arguments. The referents returned are those objects visited by the arguments' ! C-level \cfunction{tp_traverse} methods (if any), and may not be all ! objects actually directly reachable. \cfunction{tp_traverse} methods are supported only by objects that support garbage collection, and are only required to visit objects that may be involved in a cycle. So, --- 103,108 ---- Return a list of objects directly referred to by any of the arguments. The referents returned are those objects visited by the arguments' ! C-level \member{tp_traverse} methods (if any), and may not be all ! objects actually directly reachable. \member{tp_traverse} methods are supported only by objects that support garbage collection, and are only required to visit objects that may be involved in a cycle. So, From fdrake@users.sourceforge.net Tue Apr 8 18:46:35 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:46:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libatexit.tex,1.7,1.7.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1914 Modified Files: Tag: release22-maint libatexit.tex Log Message: Added example of using positional and keyword args with atexit.register(). Based on a suggestion from a reader. Index: libatexit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libatexit.tex,v retrieving revision 1.7 retrieving revision 1.7.24.1 diff -C2 -d -r1.7 -r1.7.24.1 *** libatexit.tex 9 Sep 2000 03:25:11 -0000 1.7 --- libatexit.tex 8 Apr 2003 17:46:33 -0000 1.7.24.1 *************** *** 73,74 **** --- 73,89 ---- atexit.register(savecounter) \end{verbatim} + + Positional and keyword arguments may also be passed to + \function{register()} to be passed along to the registered function + when it is called: + + \begin{verbatim} + def goodbye(name, adjective): + print 'Goodbye, %s, it was %s to meet you.' % (name, adjective) + + import atexit + atexit.register(goodbye, 'Donny', 'nice') + + # or: + atexit.register(goodbye, adjective='nice', name='Donny') + \end{verbatim} From fdrake@users.sourceforge.net Tue Apr 8 18:46:55 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:46:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libatexit.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2032 Modified Files: libatexit.tex Log Message: Added example of using positional and keyword args with atexit.register(). Based on a suggestion from a reader. Index: libatexit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libatexit.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libatexit.tex 9 Sep 2000 03:25:11 -0000 1.7 --- libatexit.tex 8 Apr 2003 17:46:53 -0000 1.8 *************** *** 73,74 **** --- 73,89 ---- atexit.register(savecounter) \end{verbatim} + + Positional and keyword arguments may also be passed to + \function{register()} to be passed along to the registered function + when it is called: + + \begin{verbatim} + def goodbye(name, adjective): + print 'Goodbye, %s, it was %s to meet you.' % (name, adjective) + + import atexit + atexit.register(goodbye, 'Donny', 'nice') + + # or: + atexit.register(goodbye, adjective='nice', name='Donny') + \end{verbatim} From tim_one@users.sourceforge.net Tue Apr 8 19:47:24 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 11:47:24 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv32665/Python/Include Modified Files: classobject.h Log Message: Typo repair. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** classobject.h 7 Apr 2003 17:51:58 -0000 2.42 --- classobject.h 8 Apr 2003 18:47:21 -0000 2.43 *************** *** 59,66 **** * The point of this routine is that it never calls arbitrary Python * code, so is always "safe": all it does is dict lookups. The function ! * can't fail, never sets an exceptionm, and NULL is not an error (it just * means "not found"). */ ! PyAPI_FUNC(PyObject *)_PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* --- 59,66 ---- * The point of this routine is that it never calls arbitrary Python * code, so is always "safe": all it does is dict lookups. The function ! * can't fail, never sets an exception, and NULL is not an error (it just * means "not found"). */ ! PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* From tim_one@users.sourceforge.net Tue Apr 8 20:02:37 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:02:37 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.40,2.40.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv6707/Include Modified Files: Tag: release22-maint classobject.h Log Message: Added private API function _PyInstance_Lookup(). This is part of backporting fixes so that garbage collection doesn't have to trigger execution of arbitrary Python code just to figure out whether an object has a __del__ method. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.40 retrieving revision 2.40.6.1 diff -C2 -d -r2.40 -r2.40.6.1 *** classobject.h 7 Dec 2001 21:54:33 -0000 2.40 --- classobject.h 8 Apr 2003 19:02:30 -0000 2.40.6.1 *************** *** 52,55 **** --- 52,67 ---- extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *); + /* Look up attribute with name (a string) on instance object pinst, using + * only the instance and base class dicts. If a descriptor is found in + * a class dict, the descriptor is returned without calling it. + * Returns NULL if nothing found, else a borrowed reference to the + * value associated with name in the dict in which name was found. + * The point of this routine is that it never calls arbitrary Python + * code, so is always "safe": all it does is dict lookups. The function + * can't fail, never sets an exception, and NULL is not an error (it just + * means "not found"). + */ + PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); + /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ From tim_one@users.sourceforge.net Tue Apr 8 20:02:38 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:02:38 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.154.8.3,2.154.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv6707/Objects Modified Files: Tag: release22-maint classobject.c Log Message: Added private API function _PyInstance_Lookup(). This is part of backporting fixes so that garbage collection doesn't have to trigger execution of arbitrary Python code just to figure out whether an object has a __del__ method. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.154.8.3 retrieving revision 2.154.8.4 diff -C2 -d -r2.154.8.3 -r2.154.8.4 *** classobject.c 2 Feb 2003 19:37:32 -0000 2.154.8.3 --- classobject.c 8 Apr 2003 19:02:34 -0000 2.154.8.4 *************** *** 730,733 **** --- 730,754 ---- } + /* See classobject.h comments: this only does dict lookups, and is always + * safe to call. + */ + PyObject * + _PyInstance_Lookup(PyObject *pinst, PyObject *name) + { + PyObject *v; + PyClassObject *class; + PyInstanceObject *inst; /* pinst cast to the right type */ + + assert(PyInstance_Check(pinst)); + inst = (PyInstanceObject *)pinst; + + assert(PyString_Check(name)); + + v = PyDict_GetItem(inst->in_dict, name); + if (v == NULL) + v = class_lookup(inst->in_class, name, &class); + return v; + } + static int instance_setattr1(PyInstanceObject *inst, PyObject *name, PyObject *v) *************** *** 1057,1061 **** if (!start) return NULL; ! end = PyInt_FromLong((long)j); if (!end) { --- 1078,1082 ---- if (!start) return NULL; ! end = PyInt_FromLong((long)j); if (!end) { *************** *** 1089,1095 **** return NULL; arg = Py_BuildValue("(N)", sliceobj_from_intint(i, j)); ! } else arg = Py_BuildValue("(ii)", i, j); ! if (arg == NULL) { Py_DECREF(func); --- 1110,1116 ---- return NULL; arg = Py_BuildValue("(N)", sliceobj_from_intint(i, j)); ! } else arg = Py_BuildValue("(ii)", i, j); ! if (arg == NULL) { Py_DECREF(func); *************** *** 1220,1224 **** Py_DECREF(func); Py_DECREF(arg); ! if(res == NULL) return -1; ret = PyObject_IsTrue(res); --- 1241,1245 ---- Py_DECREF(func); Py_DECREF(arg); ! if(res == NULL) return -1; ret = PyObject_IsTrue(res); *************** *** 1293,1297 **** /* Try one half of a binary operator involving a class instance. */ static PyObject * ! half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, int swapped) { --- 1314,1318 ---- /* Try one half of a binary operator involving a class instance. */ static PyObject * ! half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, int swapped) { *************** *** 1301,1305 **** PyObject *v1; PyObject *result; ! if (!PyInstance_Check(v)) { Py_INCREF(Py_NotImplemented); --- 1322,1326 ---- PyObject *v1; PyObject *result; ! if (!PyInstance_Check(v)) { Py_INCREF(Py_NotImplemented); *************** *** 1655,1659 **** static PyObject * instance_pow(PyObject *v, PyObject *w, PyObject *z) ! { if (z == Py_None) { return do_binop(v, w, "__pow__", "__rpow__", bin_power); --- 1676,1680 ---- static PyObject * instance_pow(PyObject *v, PyObject *w, PyObject *z) ! { if (z == Py_None) { return do_binop(v, w, "__pow__", "__rpow__", bin_power); *************** *** 1724,1728 **** static PyObject **name_op = NULL; ! static int init_name_op(void) { --- 1745,1749 ---- static PyObject **name_op = NULL; ! static int init_name_op(void) { From tim_one@users.sourceforge.net Tue Apr 8 20:13:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:13:17 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.40.6.1,2.40.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv10581/Include Modified Files: Tag: release22-maint classobject.h Log Message: More backporting of gc-vs-__del__ fixes. It should be fixed for instances of classic classes now. Alas, new-style classes are still a problem, and didn't need to be fixed in 2.3 (they were already immune in 2.3 due to the new-in-2.3 tp_del slot). Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.40.6.1 retrieving revision 2.40.6.2 diff -C2 -d -r2.40.6.1 -r2.40.6.2 *** classobject.h 8 Apr 2003 19:02:30 -0000 2.40.6.1 --- classobject.h 8 Apr 2003 19:13:10 -0000 2.40.6.2 *************** *** 62,66 **** * means "not found"). */ ! PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* --- 62,66 ---- * means "not found"). */ ! extern DL_IMPORT(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* From tim_one@users.sourceforge.net Tue Apr 8 20:13:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:13:20 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.6,2.33.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv10581/Modules Modified Files: Tag: release22-maint gcmodule.c Log Message: More backporting of gc-vs-__del__ fixes. It should be fixed for instances of classic classes now. Alas, new-style classes are still a problem, and didn't need to be fixed in 2.3 (they were already immune in 2.3 due to the new-in-2.3 tp_del slot). Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.6 retrieving revision 2.33.6.7 diff -C2 -d -r2.33.6.6 -r2.33.6.7 *** gcmodule.c 3 Apr 2003 23:02:29 -0000 2.33.6.6 --- gcmodule.c 8 Apr 2003 19:13:14 -0000 2.33.6.7 *************** *** 254,258 **** } ! /* return true if object has a finalization method */ static int has_finalizer(PyObject *op) --- 254,265 ---- } ! /* Return true if object has a finalization method. ! * CAUTION: class instances have to be checked for a __del__ method, and ! * earlier versions of this used to call PyObject_HasAttr, which in turn ! * could call the class's __getattr__ hook (if any). That could invoke ! * arbitrary Python code, mutating the object graph in arbitrary ways, and ! * that was the source of some excruciatingly subtle bugs. ! * XXX This is still broken for new-style classes. ! */ static int has_finalizer(PyObject *op) *************** *** 264,270 **** Py_FatalError("PyGC: can't initialize __del__ string"); } ! return (PyInstance_Check(op) || ! PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! && PyObject_HasAttr(op, delstr); } --- 271,282 ---- Py_FatalError("PyGC: can't initialize __del__ string"); } ! ! if (PyInstance_Check(op)) ! return _PyInstance_Lookup(op, delstr) != NULL; ! else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! /* XXX This path is still Evil. */ ! return PyObject_HasAttr(op, delstr); ! else ! return 0; } *************** *** 277,281 **** for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* has_finalizer() may result in arbitrary Python code being run. */ if (has_finalizer(op)) { --- 289,293 ---- for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* XXX has_finalizer() may result in arbitrary Python code being run. */ if (has_finalizer(op)) { From tim_one@users.sourceforge.net Tue Apr 8 20:33:02 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:33:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.12.10.2,1.12.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21549/Lib/test Modified Files: Tag: release22-maint test_gc.py Log Message: Backporting new gc-vs-__del__ tests. These pass, but are restricted to old-style classes. New-style classes remain vulnerable in 2.2. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.12.10.2 retrieving revision 1.12.10.3 diff -C2 -d -r1.12.10.2 -r1.12.10.3 *** test_gc.py 12 Jun 2002 14:41:50 -0000 1.12.10.2 --- test_gc.py 8 Apr 2003 19:32:53 -0000 1.12.10.3 *************** *** 207,210 **** --- 207,261 ---- gc.disable() + class Boom: + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + def test_boom(): + a = Boom() + b = Boom() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ + # (to see whether a and b have __del__ methods), and __getattr__ deletes + # the internal "attr" attributes as a side effect. That causes the + # trash cycle to get reclaimed via refcounts falling to 0, thus mutating + # the trash graph as a side effect of merely asking whether __del__ + # exists. This used to (before 2.3b1) crash Python. Now __getattr__ + # isn't called. + expect(gc.collect(), 4, "boom") + expect(len(gc.garbage), garbagelen, "boom") + + class Boom2: + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2(): + a = Boom2() + b = Boom2() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # Much like test_boom(), except that __getattr__ doesn't break the + # cycle until the second time gc checks for __del__. As of 2.3b1, + # there isn't a second time, so this simply cleans up the trash cycle. + # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed + # this way. + expect(gc.collect(), 4, "boom2") + expect(len(gc.garbage), garbagelen, "boom2") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 223,226 **** --- 274,279 ---- run_test("saveall", test_saveall) run_test("trashcan", test_trashcan) + run_test("boom", test_boom) + run_test("boom2", test_boom2) def test(): From montanaro@users.sourceforge.net Tue Apr 8 20:40:22 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:40:22 -0700 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27424 Modified Files: timeit.py Log Message: correct a couple docstring nits Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** timeit.py 21 Mar 2003 14:54:19 -0000 1.9 --- timeit.py 8 Apr 2003 19:40:19 -0000 1.10 *************** *** 158,166 **** def repeat(self, repeat=default_repeat, number=default_number): ! """Call timer() a few times. ! This is a convenience function that calls the timer() repeatedly, returning a list of results. The first argument ! specifies how many times to call timer(), defaulting to 3; the second argument specifies the timer argument, defaulting to one million. --- 158,166 ---- def repeat(self, repeat=default_repeat, number=default_number): ! """Call timeit() a few times. ! This is a convenience function that calls the timeit() repeatedly, returning a list of results. The first argument ! specifies how many times to call timeit(), defaulting to 3; the second argument specifies the timer argument, defaulting to one million. From tim_one@users.sourceforge.net Tue Apr 8 20:44:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:44:17 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28869/Lib/test Modified Files: test_gc.py Log Message: New tests identical to boom and boom2, except using new-style classes. These never failed in 2.3, and the tests confirm it. They still blow up in the 2.2 branch, despite that all the gc-vs-__del__ fixes from 2.3 have been backported (and this is expected -- 2.2 needs more work than 2.3 needed). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** test_gc.py 8 Apr 2003 17:17:15 -0000 1.29 --- test_gc.py 8 Apr 2003 19:44:13 -0000 1.30 *************** *** 305,308 **** --- 305,350 ---- expect(len(gc.garbage), garbagelen, "boom2") + # boom__new and boom2_new are exactly like boom and boom2, except use + # new-style classes. + + class Boom_New(object): + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + def test_boom_new(): + a = Boom_New() + b = Boom_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom_new") + expect(len(gc.garbage), garbagelen, "boom_new") + + class Boom2_New(object): + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2_new(): + a = Boom2_New() + b = Boom2_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom2_new") + expect(len(gc.garbage), garbagelen, "boom2_new") + def test_get_referents(): alist = [1, 3, 5] *************** *** 348,351 **** --- 390,395 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) + run_test("boom_new", test_boom_new) + run_test("boom2_new", test_boom2_new) run_test("get_referents", test_get_referents) From montanaro@users.sourceforge.net Tue Apr 8 20:49:43 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:49:43 -0700 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv764 Modified Files: timeit.py Log Message: add a #! line for unix weenies Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** timeit.py 8 Apr 2003 19:40:19 -0000 1.10 --- timeit.py 8 Apr 2003 19:49:40 -0000 1.11 *************** *** 1,2 **** --- 1,4 ---- + #! /usr/bin/env python + """Tool for measuring execution time of small code snippets. From montanaro@users.sourceforge.net Tue Apr 8 20:50:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:50:08 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts setup.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv915 Modified Files: setup.py Log Message: install timeit.py as a command line script Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/setup.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.py 5 Dec 2002 21:12:34 -0000 1.2 --- setup.py 8 Apr 2003 19:50:02 -0000 1.3 *************** *** 13,16 **** --- 13,17 ---- 'logmerge.py', '../../Lib/tabnanny.py', + '../../Lib/timeit.py', 'untabify.py', ], From jvr@users.sourceforge.net Tue Apr 8 21:07:20 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:07:20 -0700 Subject: [Python-checkins] python/dist/src/Modules zipimport.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9111/Modules Modified Files: zipimport.c Log Message: tentative fix for #712322: modification time stamp checking failed when DST began. Index: zipimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** zipimport.c 23 Mar 2003 13:21:03 -0000 1.12 --- zipimport.c 8 Apr 2003 20:07:15 -0000 1.13 *************** *** 994,998 **** stm.tm_mon = ((dosdate >> 5) & 0x0f) - 1; stm.tm_year = ((dosdate >> 9) & 0x7f) + 80; ! stm.tm_isdst = 0; /* wday/yday is ignored */ return mktime(&stm); --- 994,998 ---- stm.tm_mon = ((dosdate >> 5) & 0x0f) - 1; stm.tm_year = ((dosdate >> 9) & 0x7f) + 80; ! stm.tm_isdst = -1; /* wday/yday is ignored */ return mktime(&stm); From tim_one@users.sourceforge.net Tue Apr 8 21:33:11 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:33:11 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.7,2.33.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Modules Modified Files: Tag: release22-maint gcmodule.c Log Message: Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.7 retrieving revision 2.33.6.8 diff -C2 -d -r2.33.6.7 -r2.33.6.8 *** gcmodule.c 8 Apr 2003 19:13:14 -0000 2.33.6.7 --- gcmodule.c 8 Apr 2003 20:33:05 -0000 2.33.6.8 *************** *** 260,264 **** * arbitrary Python code, mutating the object graph in arbitrary ways, and * that was the source of some excruciatingly subtle bugs. - * XXX This is still broken for new-style classes. */ static int --- 260,263 ---- *************** *** 275,280 **** return _PyInstance_Lookup(op, delstr) != NULL; else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! /* XXX This path is still Evil. */ ! return PyObject_HasAttr(op, delstr); else return 0; --- 274,278 ---- return _PyInstance_Lookup(op, delstr) != NULL; else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! return _PyType_Lookup(op->ob_type, delstr) != NULL; else return 0; *************** *** 285,302 **** move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { - PyGC_Head *next; PyGC_Head *gc = unreachable->gc.gc_next; ! for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* XXX has_finalizer() may result in arbitrary Python ! code being run. */ if (has_finalizer(op)) { - next = gc->gc.gc_next; gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } ! else ! next = gc->gc.gc_next; } } --- 283,298 ---- move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { PyGC_Head *gc = unreachable->gc.gc_next; ! ! while (gc != unreachable) { ! PyGC_Head *next = gc->gc.gc_next; PyObject *op = FROM_GC(gc); ! if (has_finalizer(op)) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } ! gc = next; } } From tim_one@users.sourceforge.net Tue Apr 8 21:33:31 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:33:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.12.10.3,1.12.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Lib/test Modified Files: Tag: release22-maint test_gc.py Log Message: Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.12.10.3 retrieving revision 1.12.10.4 diff -C2 -d -r1.12.10.3 -r1.12.10.4 *** test_gc.py 8 Apr 2003 19:32:53 -0000 1.12.10.3 --- test_gc.py 8 Apr 2003 20:32:57 -0000 1.12.10.4 *************** *** 258,261 **** --- 258,303 ---- expect(len(gc.garbage), garbagelen, "boom2") + # boom__new and boom2_new are exactly like boom and boom2, except use + # new-style classes. + + class Boom_New(object): + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + def test_boom_new(): + a = Boom_New() + b = Boom_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom_new") + expect(len(gc.garbage), garbagelen, "boom_new") + + class Boom2_New(object): + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2_new(): + a = Boom2_New() + b = Boom2_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom2_new") + expect(len(gc.garbage), garbagelen, "boom2_new") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 276,279 **** --- 318,323 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) + run_test("boom_new", test_boom_new) + run_test("boom2_new", test_boom2_new) def test(): From tim_one@users.sourceforge.net Tue Apr 8 21:33:38 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:33:38 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.71,1.337.2.4.2.72 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Misc Modified Files: Tag: release22-maint NEWS Log Message: Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.71 retrieving revision 1.337.2.4.2.72 diff -C2 -d -r1.337.2.4.2.71 -r1.337.2.4.2.72 *** NEWS 31 Mar 2003 22:12:37 -0000 1.337.2.4.2.71 --- NEWS 8 Apr 2003 20:32:58 -0000 1.337.2.4.2.72 *************** *** 3,6 **** --- 3,14 ---- ============================ + - Some horridly obscure problems were fixed involving interaction + between garbage collection and classes with "ambitious" getattr hooks. + If a class instance didn't have a __del__ method, but did have a + __getattr__ hook, and the instance became reachable only from an + unreachable cycle, and the hook resurrected or deleted unreachable + objects when asked to resolve "__del__", anything up to a segfault + could happen. That's been repaired. + - Skip locale test on Mac OS X. From jhylton@users.sourceforge.net Tue Apr 8 22:28:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 08 Apr 2003 14:28:52 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14428 Modified Files: funcobject.c Log Message: Make staticmethods and classmethods participate in GC. If a class was defined inside a function, used a static or class method, and used super() inside the method body, it would be caught in an uncollectable cycle. (Simplified version: The static/class method object would point to a function object with a closure that referred to the class.) Bugfix candidate. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** funcobject.c 18 Feb 2003 17:18:35 -0000 2.60 --- funcobject.c 8 Apr 2003 21:28:47 -0000 2.61 *************** *** 591,598 **** --- 591,617 ---- cm_dealloc(classmethod *cm) { + _PyObject_GC_UNTRACK((PyObject *)cm); Py_XDECREF(cm->cm_callable); cm->ob_type->tp_free((PyObject *)cm); } + static int + cm_traverse(classmethod *cm, visitproc visit, void *arg) + { + if (!cm->cm_callable) + return 0; + return visit(cm->cm_callable, arg); + } + + static int + cm_clear(classmethod *cm) + { + Py_XDECREF(cm->cm_callable); + cm->cm_callable = NULL; + + return 0; + } + + static PyObject * cm_descr_get(PyObject *self, PyObject *obj, PyObject *type) *************** *** 666,673 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ classmethod_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 685,692 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, classmethod_doc, /* tp_doc */ ! (traverseproc)cm_traverse, /* tp_traverse */ ! (inquiry)cm_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 685,689 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 704,708 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; *************** *** 725,732 **** --- 744,769 ---- sm_dealloc(staticmethod *sm) { + _PyObject_GC_UNTRACK((PyObject *)sm); Py_XDECREF(sm->sm_callable); sm->ob_type->tp_free((PyObject *)sm); } + static int + sm_traverse(staticmethod *sm, visitproc visit, void *arg) + { + if (!sm->sm_callable) + return 0; + return visit(sm->sm_callable, arg); + } + + static int + sm_clear(staticmethod *sm) + { + Py_XDECREF(sm->sm_callable); + sm->sm_callable = NULL; + + return 0; + } + static PyObject * sm_descr_get(PyObject *self, PyObject *obj, PyObject *type) *************** *** 795,802 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ staticmethod_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 832,839 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, staticmethod_doc, /* tp_doc */ ! (traverseproc)sm_traverse, /* tp_traverse */ ! (inquiry)sm_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 814,818 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 851,855 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From montanaro@users.sourceforge.net Wed Apr 9 02:38:55 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 18:38:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtimeit.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10108 Added Files: libtimeit.tex Log Message: doc for timeit module/script - mostly just a recast of Tim's docstring --- NEW FILE: libtimeit.tex --- \section{\module{timeit} --- Measure execution time of small code snippets} \declaremodule{standard}{timeit} \modulesynopsis{Measure the execution time of small code snippets.} \index{Benchmarking} \index{Performance} \versionadded{2.3} This module provides a simple way to time small bits of Python code. It has both command line as well as callable interfaces. It avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the Algorithms chapter in the ``Python Cookbook'', published by O'Reilly. The module interface defines the following public class: \begin{classdesc}{Timer}{\optional{stmt='pass' \optional{, setup='pass' \optional{, timer=}}}} Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to 'pass'; the timer function is platform-dependent (see the module doc string). To measure the execution time of the first statement, use the timeit() method. The repeat() method is a convenience to call timeit() multiple times and return a list of results. The statements may contain newlines, as long as they don't contain multi-line string literals. \begin{methoddesc}{print_exc}{\optional{file=None}} Helper to print a traceback from the timed code. Typical use: \begin{verbatim} t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except: t.print_exc() \end{verbatim} The advantage over the standard traceback is that source lines in the compiled template will be displayed. The optional file argument directs where the traceback is sent; it defaults to \code{sys.stderr}. \end{methoddesc} \begin{methoddesc}{repeat}{\optional{repeat=3\optional{, number=1000000}}} Call \method{timeit()} a few times. This is a convenience function that calls the \method{timeit()} repeatedly, returning a list of results. The first argument specifies how many times to call \function{timeit()}. The second argument specifies the \code{number} argument for \function{timeit()}. Note: it's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run the given code snippet; higher values in the result vector are typically not caused by variability in Python's speed, but by other processes interfering with your timing accuracy. So the \function{min()} of the result is probably the only number you should be interested in. After that, you should look at the entire vector and apply common sense rather than statistics. \end{methoddesc} \begin{methoddesc}{timeit}{\optional{number=1000000}} Time \code{number} executions of the main statement. To be precise, this executes the setup statement once, and then returns the time it takes to execute the main statement a number of times, as a float measured in seconds. The argument is the number of times through the loop, defaulting to one million. The main statement, the setup statement and the timer function to be used are passed to the constructor. \end{methoddesc} \end{classdesc} \subsection{Command Line Interface} When called as a program from the command line, the following form is used: \begin{verbatim} python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} where the following options are understood: \begin{description} \item[-n N/--number=N] how many times to execute 'statement' \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default 'pass') \item[-t/--time] use time.time() (default on all platforms but Windows) \item[-c/--clock] use time.clock() (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits precision \item[-h/--help] print a short usage message and exit \end{description} A multi-line statement may be given by specifying each line as a separate statement argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple -s options are treated similarly. If -n is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds. The default timer function is platform dependent. On Windows, clock() has microsecond granularity but time()'s granularity is 1/60th of a second; on Unix, clock() has 1/100th of a second granularity and time() is much more precise. On either platform, the default timer functions measures wall clock time, not the CPU time. This means that other processes running on the same computer may interfere with the timing. The best thing to do when accurate timing is necessary is to repeat the timing a few times and use the best time. The -r option is good for this; the default of 3 repetitions is probably enough in most cases. On Unix, you can use clock() to measure CPU time. Note: there is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should be aware of it. The baseline overhead can be measured by invoking the program without arguments. The baseline overhead differs between Python versions! Also, to fairly compare older Python versions to Python 2.3, you may want to use python -O for the older versions to avoid timing SET_LINENO instructions. \subsection{Examples} Here are two example sessions (one using the command line, one using the module interface) that compare the cost of using \function{hasattr()} vs. try/except to test for missing and present object attributes. \begin{verbatim} \% timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop \% timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop \% timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop \% timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} \begin{verbatim} >>> import timeit >>> s = """\ ... try: ... str.__nonzero__ ... except AttributeError: ... pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 17.09 usec/pass >>> s = """\ ... if hasattr(str, '__nonzero__'): pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 4.85 usec/pass >>> s = """\ ... try: ... int.__nonzero__ ... except AttributeError: ... pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 1.97 usec/pass >>> s = """\ ... if hasattr(int, '__nonzero__'): pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 3.15 usec/pass \end{verbatim} From montanaro@users.sourceforge.net Wed Apr 9 02:39:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 18:39:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex,1.217,1.218 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10190 Modified Files: lib.tex Log Message: + libtimeit Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** lib.tex 7 Apr 2003 12:19:14 -0000 1.217 --- lib.tex 9 Apr 2003 01:39:06 -0000 1.218 *************** *** 207,210 **** --- 207,211 ---- \input{libprofile} % The Python Profiler \input{libhotshot} % New profiler + \input{libtimeit} \input{internet} % Internet Protocols From tim.one@comcast.net Wed Apr 9 02:54:13 2003 From: tim.one@comcast.net (Tim Peters) Date: Tue, 08 Apr 2003 21:54:13 -0400 Subject: [Python-checkins] python/dist/src/Doc/lib libtimeit.tex,NONE,1.1 In-Reply-To: Message-ID: [Skip] > Update of /cvsroot/python/python/dist/src/Doc/lib > In directory sc8-pr-cvs1:/tmp/cvs-serv10108 > > Added Files: > libtimeit.tex > Log Message: > doc for timeit module/script - mostly just a recast of Tim's docstring Just FYI, the module is all Guido's. Jim Fulton and I just supplied motivation and nagging . From fdrake@users.sourceforge.net Wed Apr 9 03:41:38 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 19:41:38 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv27867 Modified Files: Makefile.deps Log Message: Add dependency information for the timeit module docs. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Makefile.deps 22 Mar 2003 16:19:52 -0000 1.102 --- Makefile.deps 9 Apr 2003 02:41:36 -0000 1.103 *************** *** 170,173 **** --- 170,174 ---- lib/libpdb.tex \ lib/libprofile.tex \ + lib/libtimeit.tex \ lib/libcgi.tex \ lib/libcgitb.tex \ From anthonybaxter@users.sourceforge.net Wed Apr 9 04:03:49 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 08 Apr 2003 20:03:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1739 Modified Files: libhotshot.tex Log Message: extra punctuation removed Index: libhotshot.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhotshot.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libhotshot.tex 7 Apr 2003 12:21:56 -0000 1.2 --- libhotshot.tex 9 Apr 2003 03:03:46 -0000 1.3 *************** *** 92,96 **** \begin{seealso} ! \seemodule{profile}{The profile module's \class{Stats} class. } \end{seealso} --- 92,96 ---- \begin{seealso} ! \seemodule{profile}{The profile module's \class{Stats} class } \end{seealso} From fdrake@users.sourceforge.net Wed Apr 9 04:25:09 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 20:25:09 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv8048 Modified Files: Makefile.deps Log Message: Add dependency information for the hotshot package docs. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** Makefile.deps 9 Apr 2003 02:41:36 -0000 1.103 --- Makefile.deps 9 Apr 2003 03:25:07 -0000 1.104 *************** *** 170,173 **** --- 170,174 ---- lib/libpdb.tex \ lib/libprofile.tex \ + lib/libhotshot.tex \ lib/libtimeit.tex \ lib/libcgi.tex \ From fdrake@users.sourceforge.net Wed Apr 9 05:06:39 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 21:06:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,1.3,1.4 libtimeit.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18713/lib Modified Files: libhotshot.tex libtimeit.tex Log Message: Lots of small markup adjustments. Index: libhotshot.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhotshot.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libhotshot.tex 9 Apr 2003 03:03:46 -0000 1.3 --- libhotshot.tex 9 Apr 2003 04:06:37 -0000 1.4 *************** *** 3,31 **** \declaremodule{standard}{hotshot} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} - \versionadded{2.2} - \modulesynopsis{High performance logging profiler, mostly written in C.} - ! This module provides a nicer interface to the \code{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's ! written mostly in C, it should result in a much smaller performance impact ! than the existing profile module. ! ! \begin{classdesc}{Profile}{logfile, \optional{, lineevents=0, linetimings=1}} ! The profiler object. The argument \var{logfile} is the name of a log file ! to use for logged profile data. The argument \var{lineevents} specifies whether ! to generate events for every source line, or just on function call/return. It ! defaults to 0 (only log function call/return). The argument \var{linetimings} ! specifies whether to record timing information. It defaults to 1 (store timing information). - \end{classdesc} \subsection{Profile Objects \label{hotshot-objects}} --- 3,31 ---- \declaremodule{standard}{hotshot} + \modulesynopsis{High performance logging profiler, mostly written in C.} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} \versionadded{2.2} ! This module provides a nicer interface to the \module{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's ! written mostly in C, it should result in a much smaller performance impact ! than the existing \refmodule{profile} module. ! \begin{classdesc}{Profile}{logfile\optional{, ! lineevents\code{=0}\optional{, ! linetimings\code{=1}}}} ! The profiler object. The argument \var{logfile} is the name of a log ! file to use for logged profile data. The argument \var{lineevents} ! specifies whether to generate events for every source line, or just on ! function call/return. It defaults to \code{0} (only log function ! call/return). The argument \var{linetimings} specifies whether to ! record timing information. It defaults to \code{1} (store timing information). \end{classdesc} + \subsection{Profile Objects \label{hotshot-objects}} *************** *** 39,44 **** Close the logfile and terminate the profiler. \end{methoddesc} ! ! % \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. --- 39,43 ---- Close the logfile and terminate the profiler. \end{methoddesc} ! \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. *************** *** 46,52 **** \begin{methoddesc}{run}{cmd} ! Profile an exec-compatible string in the script environment. ! ! The globals from the \module{__main__} module are used as both the globals and locals for the script. \end{methoddesc} --- 45,50 ---- \begin{methoddesc}{run}{cmd} ! Profile an \keyword{exec}-compatible string in the script environment. ! The globals from the \refmodule[main]{__main__} module are used as both the globals and locals for the script. \end{methoddesc} *************** *** 54,58 **** \begin{methoddesc}{runcall}{func, *args, **keywords} Profile a single call of a callable. - Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are --- 52,55 ---- *************** *** 63,68 **** \begin{methoddesc}{runctx}{cmd, globals, locals} ! Evaluate an exec-compatible string in a specific environment. ! The string is compiled before profiling begins. \end{methoddesc} --- 60,64 ---- \begin{methoddesc}{runctx}{cmd, globals, locals} ! Evaluate an \keyword{exec}-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} *************** *** 76,105 **** \end{methoddesc} \subsection{Using hotshot data} - \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} ! This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} ! Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} ! \seemodule{profile}{The profile module's \class{Stats} class } \end{seealso} \subsection{Example Usage \label{hotshot-example}} ! Note that this example runs the python "benchmark" pystones. It can take some time to run, and will produce large output files. \begin{verbatim} - >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") --- 72,102 ---- \end{methoddesc} + \subsection{Using hotshot data} + \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} ! This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} ! Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} ! \seemodule{profile}{The \module{profile} module's \class{Stats} class} \end{seealso} + \subsection{Example Usage \label{hotshot-example}} ! Note that this example runs the python ``benchmark'' pystones. It can take some time to run, and will produce large output files. \begin{verbatim} >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") *************** *** 121,126 **** . . - \end{verbatim} - - --- 118,120 ---- Index: libtimeit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtimeit.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libtimeit.tex 9 Apr 2003 01:38:53 -0000 1.1 --- libtimeit.tex 9 Apr 2003 04:06:37 -0000 1.2 *************** *** 5,38 **** \modulesynopsis{Measure the execution time of small code snippets.} \index{Benchmarking} \index{Performance} ! \versionadded{2.3} ! ! This module provides a simple way to time small bits of Python code. It has ! both command line as well as callable interfaces. It avoids a number of ! common traps for measuring execution times. See also Tim Peters' ! introduction to the Algorithms chapter in the ``Python Cookbook'', published ! by O'Reilly. ! The module interface defines the following public class: ! \begin{classdesc}{Timer}{\optional{stmt='pass' ! \optional{, setup='pass' ! \optional{, timer=}}}} Class for timing execution speed of small code snippets. ! The constructor takes a statement to be timed, an additional statement used ! for setup, and a timer function. Both statements default to 'pass'; the ! timer function is platform-dependent (see the module doc string). ! ! To measure the execution time of the first statement, use the timeit() ! method. The repeat() method is a convenience to call timeit() multiple ! times and return a list of results. ! The statements may contain newlines, as long as they don't contain ! multi-line string literals. ! \begin{methoddesc}{print_exc}{\optional{file=None}} Helper to print a traceback from the timed code. --- 5,38 ---- \modulesynopsis{Measure the execution time of small code snippets.} + \versionadded{2.3} \index{Benchmarking} \index{Performance} ! This module provides a simple way to time small bits of Python code. ! It has both command line as well as callable interfaces. It avoids a ! number of common traps for measuring execution times. See also Tim ! Peters' introduction to the ``Algorithms'' chapter in the ! \citetitle{Python Cookbook}, published by O'Reilly. ! The module defines the following public class: ! \begin{classdesc}{Timer}{\optional{stmt=\code{'pass'} ! \optional{, setup=\code{'pass'} ! \optional{, timer=}}}} Class for timing execution speed of small code snippets. ! The constructor takes a statement to be timed, an additional statement ! used for setup, and a timer function. Both statements default to ! \code{'pass'}; the timer function is platform-dependent (see the ! module doc string). The statements may contain newlines, as long as ! they don't contain multi-line string literals. ! To measure the execution time of the first statement, use the ! \method{timeit()} method. The \method{repeat()} method is a ! convenience to call \method{timeit()} multiple times and return a list ! of results. ! \end{classdesc} ! \begin{methoddesc}{print_exc}{\optional{file=\constant{None}}} Helper to print a traceback from the timed code. *************** *** 49,66 **** The advantage over the standard traceback is that source lines in the compiled template will be displayed. ! ! The optional file argument directs where the traceback is sent; it defaults ! to \code{sys.stderr}. \end{methoddesc} ! \begin{methoddesc}{repeat}{\optional{repeat=3\optional{, number=1000000}}} Call \method{timeit()} a few times. ! This is a convenience function that calls the \method{timeit()} repeatedly, ! returning a list of results. The first argument specifies how many times to ! call \function{timeit()}. The second argument specifies the \code{number} ! argument for \function{timeit()}. ! Note: it's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run --- 49,67 ---- The advantage over the standard traceback is that source lines in the compiled template will be displayed. ! The optional \var{file} argument directs where the traceback is sent; ! it defaults to \code{sys.stderr}. \end{methoddesc} ! \begin{methoddesc}{repeat}{\optional{repeat\code{=3}\optional{, ! number\code{=1000000}}}} Call \method{timeit()} a few times. ! This is a convenience function that calls the \method{timeit()} ! repeatedly, returning a list of results. The first argument specifies ! how many times to call \method{timeit()}. The second argument ! specifies the \var{number} argument for \function{timeit()}. ! \begin{notice} ! It's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run *************** *** 71,86 **** should look at the entire vector and apply common sense rather than statistics. \end{methoddesc} ! \begin{methoddesc}{timeit}{\optional{number=1000000}} ! Time \code{number} executions of the main statement. ! ! To be precise, this executes the setup statement once, and then returns the ! time it takes to execute the main statement a number of times, as a float ! measured in seconds. The argument is the number of times through the loop, ! defaulting to one million. The main statement, the setup statement and the ! timer function to be used are passed to the constructor. \end{methoddesc} ! \end{classdesc} \subsection{Command Line Interface} --- 72,88 ---- should look at the entire vector and apply common sense rather than statistics. + \end{notice} \end{methoddesc} ! \begin{methoddesc}{timeit}{\optional{number\code{=1000000}}} ! Time \var{number} executions of the main statement. ! This executes the setup statement once, and then ! returns the time it takes to execute the main statement a number of ! times, measured in seconds as a float. The argument is the number of ! times through the loop, defaulting to one million. The main ! statement, the setup statement and the timer function to be used are ! passed to the constructor. \end{methoddesc} ! \subsection{Command Line Interface} *************** *** 89,93 **** \begin{verbatim} ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} --- 91,95 ---- \begin{verbatim} ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} *************** *** 98,150 **** \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default ! 'pass') ! \item[-t/--time] use time.time() (default on all platforms but Windows) ! \item[-c/--clock] use time.clock() (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits ! precision \item[-h/--help] print a short usage message and exit \end{description} ! A multi-line statement may be given by specifying each line as a separate ! statement argument; indented lines are possible by enclosing an argument in ! quotes and using leading spaces. Multiple -s options are treated similarly. ! If -n is not given, a suitable number of loops is calculated by trying ! successive powers of 10 until the total time is at least 0.2 seconds. ! The default timer function is platform dependent. On Windows, clock() has ! microsecond granularity but time()'s granularity is 1/60th of a second; on ! Unix, clock() has 1/100th of a second granularity and time() is much more ! precise. On either platform, the default timer functions measures wall ! clock time, not the CPU time. This means that other processes running on ! the same computer may interfere with the timing. The best thing to do when ! accurate timing is necessary is to repeat the timing a few times and use the ! best time. The -r option is good for this; the default of 3 repetitions is ! probably enough in most cases. On Unix, you can use clock() to measure CPU ! time. ! Note: there is a certain baseline overhead associated with executing a pass ! statement. The code here doesn't try to hide it, but you should be aware of ! it. The baseline overhead can be measured by invoking the program without ! arguments. ! The baseline overhead differs between Python versions! Also, to fairly ! compare older Python versions to Python 2.3, you may want to use python -O ! for the older versions to avoid timing SET_LINENO instructions. \subsection{Examples} ! Here are two example sessions (one using the command line, one using the ! module interface) that compare the cost of using \function{hasattr()} ! vs. try/except to test for missing and present object attributes. \begin{verbatim} ! \% timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop ! \% timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop ! \% timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop ! \% timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} --- 100,161 ---- \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default ! \code{'pass'}) ! \item[-t/--time] use \function{time.time()} ! (default on all platforms but Windows) ! \item[-c/--clock] use \function{time.clock()} (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits ! precision \item[-h/--help] print a short usage message and exit \end{description} ! A multi-line statement may be given by specifying each line as a ! separate statement argument; indented lines are possible by enclosing ! an argument in quotes and using leading spaces. Multiple ! \programopt{-s} options are treated similarly. ! If \programopt{-n} is not given, a suitable number of loops is ! calculated by trying successive powers of 10 until the total time is ! at least 0.2 seconds. ! The default timer function is platform dependent. On Windows, ! \function{time.clock()} has microsecond granularity but ! \function{time.time()}'s granularity is 1/60th of a second; on \UNIX, ! \function{time.clock()} has 1/100th of a second granularity and ! \function{time.time()} is much more precise. On either platform, the ! default timer functions measures wall clock time, not the CPU time. ! This means that other processes running on the same computer may ! interfere with the timing. The best thing to do when accurate timing ! is necessary is to repeat the timing a few times and use the best ! time. The \programopt{-r} option is good for this; the default of 3 ! repetitions is probably enough in most cases. On \UNIX, you can use ! \function{time.clock()} to measure CPU time. ! \begin{notice} ! There is a certain baseline overhead associated with executing a ! pass statement. The code here doesn't try to hide it, but you ! should be aware of it. The baseline overhead can be measured by ! invoking the program without arguments. ! \end{notice} ! The baseline overhead differs between Python versions! Also, to ! fairly compare older Python versions to Python 2.3, you may want to ! use Python's \programopt{-O} option for the older versions to avoid ! timing \code{SET_LINENO} instructions. \subsection{Examples} ! Here are two example sessions (one using the command line, one using ! the module interface) that compare the cost of using ! \function{hasattr()} vs. \keyword{try}/\keyword{except} to test for ! missing and present object attributes. \begin{verbatim} ! % timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop ! % timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop ! % timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop ! % timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} *************** *** 154,160 **** >>> s = """\ ... try: ! ... str.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) --- 165,171 ---- >>> s = """\ ... try: ! ... str.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) *************** *** 169,175 **** >>> s = """\ ... try: ! ... int.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) --- 180,186 ---- >>> s = """\ ... try: ! ... int.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) From akuchling@users.sourceforge.net Wed Apr 9 13:35:53 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 09 Apr 2003 05:35:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command register.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv8646 Modified Files: register.py Log Message: Remove the --verify option in favor of the standard -n/--dry-run option Index: register.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/register.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** register.py 3 Mar 2003 18:26:01 -0000 1.5 --- register.py 9 Apr 2003 12:35:51 -0000 1.6 *************** *** 23,28 **** ('repository=', 'r', "url of repository [default: %s]"%DEFAULT_REPOSITORY), - ('verify', None, - 'verify the package metadata for correctness'), ('list-classifiers', None, 'list the valid Trove classifiers'), --- 23,26 ---- *************** *** 34,38 **** def initialize_options(self): self.repository = None - self.verify = 0 self.show_response = 0 self.list_classifiers = 0 --- 32,35 ---- *************** *** 44,48 **** def run(self): self.check_metadata() ! if self.verify: self.verify_metadata() elif self.list_classifiers: --- 41,45 ---- def run(self): self.check_metadata() ! if self.dry_run: self.verify_metadata() elif self.list_classifiers: From Jack.Jansen@cwi.nl Wed Apr 9 14:00:31 2003 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 9 Apr 2003 15:00:31 +0200 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.11,1.12 FrameWork.py,1.3,1.4 MiniAEFrame.py,1.1,1.2 argvemulator.py,1.2,1.3 icopen.py,1.1,1.2 In-Reply-To: Message-ID: <3EC47D84-6A8B-11D7-BC28-0030655234CE@cwi.nl> On Sunday, Apr 6, 2003, at 12:44 Europe/Amsterdam, Just van Rossum wrote: > rhettinger@users.sourceforge.net wrote: > >> Modified Files: >> EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py >> icopen.py >> Log Message: >> SF patch #701494: more apply removals > > Ouch, this checkin also detabbed these files! This obscures the real > change. Also: whether they need to be detabbed is up to Jack. I assume > it was a simple oversight, please back this change out. I'll bite the bullet and detab all of Lib/plat-mac. It had to happen one day anyway. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From jackjansen@users.sourceforge.net Wed Apr 9 14:25:21 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 09 Apr 2003 06:25:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon ControlAccessor.py,1.1,1.2 Res.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv29021 Modified Files: ControlAccessor.py Res.py Log Message: Detabbed. Index: ControlAccessor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/ControlAccessor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ControlAccessor.py 30 Dec 2002 22:04:21 -0000 1.1 --- ControlAccessor.py 9 Apr 2003 13:25:19 -0000 1.2 *************** *** 6,57 **** # These needn't go through this module, but are here for completeness def SetControlData_Handle(control, part, selector, data): ! control.SetControlData_Handle(part, selector, data) ! def GetControlData_Handle(control, part, selector): ! return control.GetControlData_Handle(part, selector) ! _accessdict = { ! kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle), } _codingdict = { ! kControlPushButtonDefaultTag : ("b", None, None), ! ! kControlEditTextTextTag: (None, None, None), ! kControlEditTextPasswordTag: (None, None, None), ! ! kControlPopupButtonMenuIDTag: ("h", None, None), ! ! kControlListBoxDoubleClickTag: ("b", None, None), } def SetControlData(control, part, selector, data): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! setfunc(control, part, selector, data) ! return ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! if coder: ! data = coder(data) ! if structfmt: ! data = struct.pack(structfmt, data) ! control.SetControlData(part, selector, data) ! def GetControlData(control, part, selector): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! return getfunc(control, part, selector, data) ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! data = control.GetControlData(part, selector) ! if structfmt: ! data = struct.unpack(structfmt, data) ! if decoder: ! data = decoder(data) ! if type(data) == type(()) and len(data) == 1: ! data = data[0] ! return data ! --- 6,57 ---- # These needn't go through this module, but are here for completeness def SetControlData_Handle(control, part, selector, data): ! control.SetControlData_Handle(part, selector, data) ! def GetControlData_Handle(control, part, selector): ! return control.GetControlData_Handle(part, selector) ! _accessdict = { ! kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle), } _codingdict = { ! kControlPushButtonDefaultTag : ("b", None, None), ! ! kControlEditTextTextTag: (None, None, None), ! kControlEditTextPasswordTag: (None, None, None), ! ! kControlPopupButtonMenuIDTag: ("h", None, None), ! ! kControlListBoxDoubleClickTag: ("b", None, None), } def SetControlData(control, part, selector, data): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! setfunc(control, part, selector, data) ! return ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! if coder: ! data = coder(data) ! if structfmt: ! data = struct.pack(structfmt, data) ! control.SetControlData(part, selector, data) ! def GetControlData(control, part, selector): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! return getfunc(control, part, selector, data) ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! data = control.GetControlData(part, selector) ! if structfmt: ! data = struct.unpack(structfmt, data) ! if decoder: ! data = decoder(data) ! if type(data) == type(()) and len(data) == 1: ! data = data[0] ! return data ! Index: Res.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Res.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Res.py 30 Dec 2002 22:04:21 -0000 1.1 --- Res.py 9 Apr 2003 13:25:19 -0000 1.2 *************** *** 1,4 **** try: ! from OverrideFrom23._Res import * except ImportError: ! from _Res import * --- 1,4 ---- try: ! from OverrideFrom23._Res import * except ImportError: ! from _Res import * From jackjansen@users.sourceforge.net Wed Apr 9 14:25:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 09 Apr 2003 06:25:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac Audio_mac.py,1.2,1.3 PixMapWrapper.py,1.2,1.3 aepack.py,1.5,1.6 aetools.py,1.6,1.7 aetypes.py,1.4,1.5 applesingle.py,1.1,1.2 appletrawmain.py,1.1,1.2 appletrunner.py,1.1,1.2 bgenlocations.py,1.3,1.4 buildtools.py,1.8,1.9 bundlebuilder.py,1.24,1.25 cfmfile.py,1.2,1.3 findertools.py,1.3,1.4 gensuitemodule.py,1.5,1.6 ic.py,1.4,1.5 macerrors.py,1.1,1.2 macfs.py,1.9,1.10 macresource.py,1.4,1.5 pimp.py,1.14,1.15 plistlib.py,1.1,1.2 videoreader.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv29131 Modified Files: Audio_mac.py PixMapWrapper.py aepack.py aetools.py aetypes.py applesingle.py appletrawmain.py appletrunner.py bgenlocations.py buildtools.py bundlebuilder.py cfmfile.py findertools.py gensuitemodule.py ic.py macerrors.py macfs.py macresource.py pimp.py plistlib.py videoreader.py Log Message: Detabbed. Index: Audio_mac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Audio_mac.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Audio_mac.py 6 Feb 2003 23:12:23 -0000 1.2 --- Audio_mac.py 9 Apr 2003 13:25:42 -0000 1.3 *************** *** 4,121 **** class Play_Audio_mac: ! def __init__(self, qsize=QSIZE): ! self._chan = None ! self._qsize = qsize ! self._outrate = 22254 ! self._sampwidth = 1 ! self._nchannels = 1 ! self._gc = [] ! self._usercallback = None ! def __del__(self): ! self.stop() ! self._usercallback = None ! def wait(self): ! import time ! while self.getfilled(): ! time.sleep(0.1) ! self._chan = None ! self._gc = [] ! def stop(self, quietNow = 1): ! ##chan = self._chan ! self._chan = None ! ##chan.SndDisposeChannel(1) ! self._gc = [] ! def setoutrate(self, outrate): ! self._outrate = outrate ! def setsampwidth(self, sampwidth): ! self._sampwidth = sampwidth ! def setnchannels(self, nchannels): ! self._nchannels = nchannels ! def writeframes(self, data): ! import time ! from Carbon.Sound import bufferCmd, callBackCmd, extSH ! import struct ! import MacOS ! if not self._chan: ! from Carbon import Snd ! self._chan = Snd.SndNewChannel(5, 0, self._callback) ! nframes = len(data) / self._nchannels / self._sampwidth ! if len(data) != nframes * self._nchannels * self._sampwidth: ! raise error, 'data is not a whole number of frames' ! while self._gc and \ ! self.getfilled() + nframes > \ ! self._qsize / self._nchannels / self._sampwidth: ! time.sleep(0.1) ! if self._sampwidth == 1: ! import audioop ! data = audioop.add(data, '\x80'*len(data), 1) ! h1 = struct.pack('llHhllbbl', ! id(data)+MacOS.string_id_to_buffer, ! self._nchannels, ! self._outrate, 0, ! 0, ! 0, ! extSH, ! 60, ! nframes) ! h2 = 22*'\0' ! h3 = struct.pack('hhlll', ! self._sampwidth*8, ! 0, ! 0, ! 0, ! 0) ! header = h1+h2+h3 ! self._gc.append((header, data)) ! self._chan.SndDoCommand((bufferCmd, 0, header), 0) ! self._chan.SndDoCommand((callBackCmd, 0, 0), 0) ! def _callback(self, *args): ! del self._gc[0] ! if self._usercallback: ! self._usercallback() ! ! def setcallback(self, callback): ! self._usercallback = callback ! def getfilled(self): ! filled = 0 ! for header, data in self._gc: ! filled = filled + len(data) ! return filled / self._nchannels / self._sampwidth ! def getfillable(self): ! return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled() ! def ulaw2lin(self, data): ! import audioop ! return audioop.ulaw2lin(data, 2) def test(): ! import aifc ! import EasyDialogs ! fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",)) ! if not fn: return ! af = aifc.open(fn, 'r') ! print af.getparams() ! p = Play_Audio_mac() ! p.setoutrate(af.getframerate()) ! p.setsampwidth(af.getsampwidth()) ! p.setnchannels(af.getnchannels()) ! BUFSIZ = 10000 ! while 1: ! data = af.readframes(BUFSIZ) ! if not data: break ! p.writeframes(data) ! print 'wrote', len(data), 'space', p.getfillable() ! p.wait() if __name__ == '__main__': ! test() --- 4,121 ---- class Play_Audio_mac: ! def __init__(self, qsize=QSIZE): ! self._chan = None ! self._qsize = qsize ! self._outrate = 22254 ! self._sampwidth = 1 ! self._nchannels = 1 ! self._gc = [] ! self._usercallback = None ! def __del__(self): ! self.stop() ! self._usercallback = None ! def wait(self): ! import time ! while self.getfilled(): ! time.sleep(0.1) ! self._chan = None ! self._gc = [] ! def stop(self, quietNow = 1): ! ##chan = self._chan ! self._chan = None ! ##chan.SndDisposeChannel(1) ! self._gc = [] ! def setoutrate(self, outrate): ! self._outrate = outrate ! def setsampwidth(self, sampwidth): ! self._sampwidth = sampwidth ! def setnchannels(self, nchannels): ! self._nchannels = nchannels ! def writeframes(self, data): ! import time ! from Carbon.Sound import bufferCmd, callBackCmd, extSH ! import struct ! import MacOS ! if not self._chan: ! from Carbon import Snd ! self._chan = Snd.SndNewChannel(5, 0, self._callback) ! nframes = len(data) / self._nchannels / self._sampwidth ! if len(data) != nframes * self._nchannels * self._sampwidth: ! raise error, 'data is not a whole number of frames' ! while self._gc and \ ! self.getfilled() + nframes > \ ! self._qsize / self._nchannels / self._sampwidth: ! time.sleep(0.1) ! if self._sampwidth == 1: ! import audioop ! data = audioop.add(data, '\x80'*len(data), 1) ! h1 = struct.pack('llHhllbbl', ! id(data)+MacOS.string_id_to_buffer, ! self._nchannels, ! self._outrate, 0, ! 0, ! 0, ! extSH, ! 60, ! nframes) ! h2 = 22*'\0' ! h3 = struct.pack('hhlll', ! self._sampwidth*8, ! 0, ! 0, ! 0, ! 0) ! header = h1+h2+h3 ! self._gc.append((header, data)) ! self._chan.SndDoCommand((bufferCmd, 0, header), 0) ! self._chan.SndDoCommand((callBackCmd, 0, 0), 0) ! def _callback(self, *args): ! del self._gc[0] ! if self._usercallback: ! self._usercallback() ! ! def setcallback(self, callback): ! self._usercallback = callback ! def getfilled(self): ! filled = 0 ! for header, data in self._gc: ! filled = filled + len(data) ! return filled / self._nchannels / self._sampwidth ! def getfillable(self): ! return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled() ! def ulaw2lin(self, data): ! import audioop ! return audioop.ulaw2lin(data, 2) def test(): ! import aifc ! import EasyDialogs ! fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",)) ! if not fn: return ! af = aifc.open(fn, 'r') ! print af.getparams() ! p = Play_Audio_mac() ! p.setoutrate(af.getframerate()) ! p.setsampwidth(af.getsampwidth()) ! p.setnchannels(af.getnchannels()) ! BUFSIZ = 10000 ! while 1: ! data = af.readframes(BUFSIZ) ! if not data: break ! p.writeframes(data) ! print 'wrote', len(data), 'space', p.getfillable() ! p.wait() if __name__ == '__main__': ! test() Index: PixMapWrapper.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/PixMapWrapper.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PixMapWrapper.py 21 Feb 2003 23:18:48 -0000 1.2 --- PixMapWrapper.py 9 Apr 2003 13:25:42 -0000 1.3 *************** *** 15,215 **** # PixMap data structure element format (as used with struct) _pmElemFormat = { ! 'baseAddr':'l', # address of pixel data ! 'rowBytes':'H', # bytes per row, plus 0x8000 ! 'bounds':'hhhh', # coordinates imposed over pixel data ! 'top':'h', ! 'left':'h', ! 'bottom':'h', ! 'right':'h', ! 'pmVersion':'h', # flags for Color QuickDraw ! 'packType':'h', # format of compression algorithm ! 'packSize':'l', # size after compression ! 'hRes':'l', # horizontal pixels per inch ! 'vRes':'l', # vertical pixels per inch ! 'pixelType':'h', # pixel format ! 'pixelSize':'h', # bits per pixel ! 'cmpCount':'h', # color components per pixel ! 'cmpSize':'h', # bits per component ! 'planeBytes':'l', # offset in bytes to next plane ! 'pmTable':'l', # handle to color table ! 'pmReserved':'l' # reserved for future use } # PixMap data structure element offset _pmElemOffset = { ! 'baseAddr':0, ! 'rowBytes':4, ! 'bounds':6, ! 'top':6, ! 'left':8, ! 'bottom':10, ! 'right':12, ! 'pmVersion':14, ! 'packType':16, ! 'packSize':18, ! 'hRes':22, ! 'vRes':26, ! 'pixelType':30, ! 'pixelSize':32, ! 'cmpCount':34, ! 'cmpSize':36, ! 'planeBytes':38, ! 'pmTable':42, ! 'pmReserved':46 } class PixMapWrapper: ! """PixMapWrapper -- wraps the QD PixMap object in a Python class, ! with methods to easily get/set various pixmap fields. Note: Use the ! PixMap() method when passing to QD calls.""" ! def __init__(self): ! self.__dict__['data'] = '' ! self._header = struct.pack("lhhhhhhhlllhhhhlll", ! id(self.data)+MacOS.string_id_to_buffer, ! 0, # rowBytes ! 0, 0, 0, 0, # bounds ! 0, # pmVersion ! 0, 0, # packType, packSize ! 72<<16, 72<<16, # hRes, vRes ! QuickDraw.RGBDirect, # pixelType ! 16, # pixelSize ! 2, 5, # cmpCount, cmpSize, ! 0, 0, 0) # planeBytes, pmTable, pmReserved ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! ! def _stuff(self, element, bytes): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! self._header = self._header[:offset] \ ! + struct.pack(fmt, bytes) \ ! + self._header[offset + struct.calcsize(fmt):] ! self.__dict__['_pm'] = None ! ! def _unstuff(self, element): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0] ! def __setattr__(self, attr, val): ! if attr == 'baseAddr': ! raise 'UseErr', "don't assign to .baseAddr -- assign to .data instead" ! elif attr == 'data': ! self.__dict__['data'] = val ! self._stuff('baseAddr', id(self.data) + MacOS.string_id_to_buffer) ! elif attr == 'rowBytes': ! # high bit is always set for some odd reason ! self._stuff('rowBytes', val | 0x8000) ! elif attr == 'bounds': ! # assume val is in official Left, Top, Right, Bottom order! ! self._stuff('left',val[0]) ! self._stuff('top',val[1]) ! self._stuff('right',val[2]) ! self._stuff('bottom',val[3]) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! self._stuff(attr, int(val) << 16) ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just stuff ! self._stuff(attr, val) ! else: ! self.__dict__[attr] = val ! def __getattr__(self, attr): ! if attr == 'rowBytes': ! # high bit is always set for some odd reason ! return self._unstuff('rowBytes') & 0x7FFF ! elif attr == 'bounds': ! # return bounds in official Left, Top, Right, Bottom order! ! return ( \ ! self._unstuff('left'), ! self._unstuff('top'), ! self._unstuff('right'), ! self._unstuff('bottom') ) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! return self._unstuff(attr) >> 16 ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just unstuff ! return self._unstuff(attr) ! else: ! return self.__dict__[attr] ! ! def PixMap(self): ! "Return a QuickDraw PixMap corresponding to this data." ! if not self.__dict__['_pm']: ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! return self.__dict__['_pm'] ! def blit(self, x1=0,y1=0,x2=None,y2=None, port=None): ! """Draw this pixmap into the given (default current) grafport.""" ! src = self.bounds ! dest = [x1,y1,x2,y2] ! if x2 == None: ! dest[2] = x1 + src[2]-src[0] ! if y2 == None: ! dest[3] = y1 + src[3]-src[1] ! if not port: port = Qd.GetPort() ! Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), ! QuickDraw.srcCopy, None) ! ! def fromstring(self,s,width,height,format=imgformat.macrgb): ! """Stuff this pixmap with raw pixel data from a string. ! Supply width, height, and one of the imgformat specifiers.""" ! # we only support 16- and 32-bit mac rgb... ! # so convert if necessary ! if format != imgformat.macrgb and format != imgformat.macrgb16: ! # (LATER!) ! raise "NotImplementedError", "conversion to macrgb or macrgb16" ! self.data = s ! self.bounds = (0,0,width,height) ! self.cmpCount = 3 ! self.pixelType = QuickDraw.RGBDirect ! if format == imgformat.macrgb: ! self.pixelSize = 32 ! self.cmpSize = 8 ! else: ! self.pixelSize = 16 ! self.cmpSize = 5 ! self.rowBytes = width*self.pixelSize/8 ! def tostring(self, format=imgformat.macrgb): ! """Return raw data as a string in the specified format.""" ! # is the native format requested? if so, just return data ! if (format == imgformat.macrgb and self.pixelSize == 32) or \ ! (format == imgformat.macrgb16 and self.pixelsize == 16): ! return self.data ! # otherwise, convert to the requested format ! # (LATER!) ! raise "NotImplementedError", "data format conversion" ! def fromImage(self,im): ! """Initialize this PixMap from a PIL Image object.""" ! # We need data in ARGB format; PIL can't currently do that, ! # but it can do RGBA, which we can use by inserting one null ! # up frontpm = ! if im.mode != 'RGBA': im = im.convert('RGBA') ! data = chr(0) + im.tostring() ! self.fromstring(data, im.size[0], im.size[1]) ! def toImage(self): ! """Return the contents of this PixMap as a PIL Image object.""" ! import Image ! # our tostring() method returns data in ARGB format, ! # whereas Image uses RGBA; a bit of slicing fixes this... ! data = self.tostring()[1:] + chr(0) ! bounds = self.bounds ! return Image.fromstring('RGBA',(bounds[2]-bounds[0],bounds[3]-bounds[1]),data) def test(): ! import MacOS ! import EasyDialogs ! import Image ! path = EasyDialogs.AskFileForOpen("Image File:") ! if not path: return ! pm = PixMapWrapper() ! pm.fromImage( Image.open(path) ) ! pm.blit(20,20) ! return pm --- 15,215 ---- # PixMap data structure element format (as used with struct) _pmElemFormat = { ! 'baseAddr':'l', # address of pixel data ! 'rowBytes':'H', # bytes per row, plus 0x8000 ! 'bounds':'hhhh', # coordinates imposed over pixel data ! 'top':'h', ! 'left':'h', ! 'bottom':'h', ! 'right':'h', ! 'pmVersion':'h', # flags for Color QuickDraw ! 'packType':'h', # format of compression algorithm ! 'packSize':'l', # size after compression ! 'hRes':'l', # horizontal pixels per inch ! 'vRes':'l', # vertical pixels per inch ! 'pixelType':'h', # pixel format ! 'pixelSize':'h', # bits per pixel ! 'cmpCount':'h', # color components per pixel ! 'cmpSize':'h', # bits per component ! 'planeBytes':'l', # offset in bytes to next plane ! 'pmTable':'l', # handle to color table ! 'pmReserved':'l' # reserved for future use } # PixMap data structure element offset _pmElemOffset = { ! 'baseAddr':0, ! 'rowBytes':4, ! 'bounds':6, ! 'top':6, ! 'left':8, ! 'bottom':10, ! 'right':12, ! 'pmVersion':14, ! 'packType':16, ! 'packSize':18, ! 'hRes':22, ! 'vRes':26, ! 'pixelType':30, ! 'pixelSize':32, ! 'cmpCount':34, ! 'cmpSize':36, ! 'planeBytes':38, ! 'pmTable':42, ! 'pmReserved':46 } class PixMapWrapper: ! """PixMapWrapper -- wraps the QD PixMap object in a Python class, ! with methods to easily get/set various pixmap fields. Note: Use the ! PixMap() method when passing to QD calls.""" ! def __init__(self): ! self.__dict__['data'] = '' ! self._header = struct.pack("lhhhhhhhlllhhhhlll", ! id(self.data)+MacOS.string_id_to_buffer, ! 0, # rowBytes ! 0, 0, 0, 0, # bounds ! 0, # pmVersion ! 0, 0, # packType, packSize ! 72<<16, 72<<16, # hRes, vRes ! QuickDraw.RGBDirect, # pixelType ! 16, # pixelSize ! 2, 5, # cmpCount, cmpSize, ! 0, 0, 0) # planeBytes, pmTable, pmReserved ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! ! def _stuff(self, element, bytes): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! self._header = self._header[:offset] \ ! + struct.pack(fmt, bytes) \ ! + self._header[offset + struct.calcsize(fmt):] ! self.__dict__['_pm'] = None ! ! def _unstuff(self, element): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0] ! def __setattr__(self, attr, val): ! if attr == 'baseAddr': ! raise 'UseErr', "don't assign to .baseAddr -- assign to .data instead" ! elif attr == 'data': ! self.__dict__['data'] = val ! self._stuff('baseAddr', id(self.data) + MacOS.string_id_to_buffer) ! elif attr == 'rowBytes': ! # high bit is always set for some odd reason ! self._stuff('rowBytes', val | 0x8000) ! elif attr == 'bounds': ! # assume val is in official Left, Top, Right, Bottom order! ! self._stuff('left',val[0]) ! self._stuff('top',val[1]) ! self._stuff('right',val[2]) ! self._stuff('bottom',val[3]) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! self._stuff(attr, int(val) << 16) ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just stuff ! self._stuff(attr, val) ! else: ! self.__dict__[attr] = val ! def __getattr__(self, attr): ! if attr == 'rowBytes': ! # high bit is always set for some odd reason ! return self._unstuff('rowBytes') & 0x7FFF ! elif attr == 'bounds': ! # return bounds in official Left, Top, Right, Bottom order! ! return ( \ ! self._unstuff('left'), ! self._unstuff('top'), ! self._unstuff('right'), ! self._unstuff('bottom') ) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! return self._unstuff(attr) >> 16 ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just unstuff ! return self._unstuff(attr) ! else: ! return self.__dict__[attr] ! ! def PixMap(self): ! "Return a QuickDraw PixMap corresponding to this data." ! if not self.__dict__['_pm']: ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! return self.__dict__['_pm'] ! def blit(self, x1=0,y1=0,x2=None,y2=None, port=None): ! """Draw this pixmap into the given (default current) grafport.""" ! src = self.bounds ! dest = [x1,y1,x2,y2] ! if x2 == None: ! dest[2] = x1 + src[2]-src[0] ! if y2 == None: ! dest[3] = y1 + src[3]-src[1] ! if not port: port = Qd.GetPort() ! Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), ! QuickDraw.srcCopy, None) ! ! def fromstring(self,s,width,height,format=imgformat.macrgb): ! """Stuff this pixmap with raw pixel data from a string. ! Supply width, height, and one of the imgformat specifiers.""" ! # we only support 16- and 32-bit mac rgb... ! # so convert if necessary ! if format != imgformat.macrgb and format != imgformat.macrgb16: ! # (LATER!) ! raise "NotImplementedError", "conversion to macrgb or macrgb16" ! self.data = s ! self.bounds = (0,0,width,height) ! self.cmpCount = 3 ! self.pixelType = QuickDraw.RGBDirect ! if format == imgformat.macrgb: ! self.pixelSize = 32 ! self.cmpSize = 8 ! else: ! self.pixelSize = 16 ! self.cmpSize = 5 ! self.rowBytes = width*self.pixelSize/8 ! def tostring(self, format=imgformat.macrgb): ! """Return raw data as a string in the specified format.""" ! # is the native format requested? if so, just return data ! if (format == imgformat.macrgb and self.pixelSize == 32) or \ ! (format == imgformat.macrgb16 and self.pixelsize == 16): ! return self.data ! # otherwise, convert to the requested format ! # (LATER!) ! raise "NotImplementedError", "data format conversion" ! def fromImage(self,im): ! """Initialize this PixMap from a PIL Image object.""" ! # We need data in ARGB format; PIL can't currently do that, ! # but it can do RGBA, which we can use by inserting one null ! # up frontpm = ! if im.mode != 'RGBA': im = im.convert('RGBA') ! data = chr(0) + im.tostring() ! self.fromstring(data, im.size[0], im.size[1]) ! def toImage(self): ! """Return the contents of this PixMap as a PIL Image object.""" ! import Image ! # our tostring() method returns data in ARGB format, ! # whereas Image uses RGBA; a bit of slicing fixes this... ! data = self.tostring()[1:] + chr(0) ! bounds = self.bounds ! return Image.fromstring('RGBA',(bounds[2]-bounds[0],bounds[3]-bounds[1]),data) def test(): ! import MacOS ! import EasyDialogs ! import Image ! path = EasyDialogs.AskFileForOpen("Image File:") ! if not path: return ! pm = PixMapWrapper() ! pm.fromImage( Image.open(path) ) ! pm.blit(20,20) ! return pm Index: aepack.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aepack.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aepack.py 31 Mar 2003 13:32:59 -0000 1.5 --- aepack.py 9 Apr 2003 13:25:42 -0000 1.6 *************** *** 45,57 **** # unpacker_coercions = { ! typeComp : typeFloat, ! typeColorTable : typeAEList, ! typeDrawingArea : typeAERecord, ! typeFixed : typeFloat, ! typeExtended : typeFloat, ! typePixelMap : typeAERecord, ! typeRotation : typeAERecord, ! typeStyledText : typeAERecord, ! typeTextStyles : typeAERecord, }; --- 45,57 ---- # unpacker_coercions = { ! typeComp : typeFloat, ! typeColorTable : typeAEList, ! typeDrawingArea : typeAERecord, ! typeFixed : typeFloat, ! typeExtended : typeFloat, ! typePixelMap : typeAERecord, ! typeRotation : typeAERecord, ! typeStyledText : typeAERecord, ! typeTextStyles : typeAERecord, }; *************** *** 65,259 **** def packkey(ae, key, value): ! if hasattr(key, 'which'): ! keystr = key.which ! elif hasattr(key, 'want'): ! keystr = key.want ! else: ! keystr = key ! ae.AEPutParamDesc(keystr, pack(value)) def pack(x, forcetype = None): ! """Pack a python object into an AE descriptor""" ! ! if forcetype: ! if type(x) is StringType: ! return AE.AECreateDesc(forcetype, x) ! else: ! return pack(x).AECoerceDesc(forcetype) ! ! if x == None: ! return AE.AECreateDesc('null', '') ! ! if isinstance(x, AEDescType): ! return x ! if isinstance(x, FSSType): ! return AE.AECreateDesc('fss ', x.data) ! if isinstance(x, FSRefType): ! return AE.AECreateDesc('fsrf', x.data) ! if isinstance(x, AliasType): ! return AE.AECreateDesc('alis', x.data) ! if isinstance(x, IntType): ! return AE.AECreateDesc('long', struct.pack('l', x)) ! if isinstance(x, FloatType): ! return AE.AECreateDesc('doub', struct.pack('d', x)) ! if isinstance(x, StringType): ! return AE.AECreateDesc('TEXT', x) ! if isinstance(x, UnicodeType): ! data = x.encode('utf16') ! if data[:2] == '\xfe\xff': ! data = data[2:] ! return AE.AECreateDesc('utxt', data) ! if isinstance(x, ListType): ! list = AE.AECreateList('', 0) ! for item in x: ! list.AEPutDesc(0, pack(item)) ! return list ! if isinstance(x, DictionaryType): ! record = AE.AECreateList('', 1) ! for key, value in x.items(): ! packkey(record, key, value) ! #record.AEPutParamDesc(key, pack(value)) ! return record ! if type(x) == types.ClassType and issubclass(x, ObjectSpecifier): ! # Note: we are getting a class object here, not an instance ! return AE.AECreateDesc('type', x.want) ! if hasattr(x, '__aepack__'): ! return x.__aepack__() ! if hasattr(x, 'which'): ! return AE.AECreateDesc('TEXT', x.which) ! if hasattr(x, 'want'): ! return AE.AECreateDesc('TEXT', x.want) ! return AE.AECreateDesc('TEXT', repr(x)) # Copout def unpack(desc, formodulename=""): ! """Unpack an AE descriptor to a python object""" ! t = desc.type ! ! if unpacker_coercions.has_key(t): ! desc = desc.AECoerceDesc(unpacker_coercions[t]) ! t = desc.type # This is a guess by Jack.... ! ! if t == typeAEList: ! l = [] ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! l.append(unpack(item, formodulename)) ! return l ! if t == typeAERecord: ! d = {} ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! d[keyword] = unpack(item, formodulename) ! return d ! if t == typeAEText: ! record = desc.AECoerceDesc('reco') ! return mkaetext(unpack(record, formodulename)) ! if t == typeAlias: ! return Carbon.File.Alias(rawdata=desc.data) ! # typeAppleEvent returned as unknown ! if t == typeBoolean: ! return struct.unpack('b', desc.data)[0] ! if t == typeChar: ! return desc.data ! if t == typeUnicodeText: ! return unicode(desc.data, 'utf16') ! # typeColorTable coerced to typeAEList ! # typeComp coerced to extended ! # typeData returned as unknown ! # typeDrawingArea coerced to typeAERecord ! if t == typeEnumeration: ! return mkenum(desc.data) ! # typeEPS returned as unknown ! if t == typeFalse: ! return 0 ! if t == typeFloat: ! data = desc.data ! return struct.unpack('d', data)[0] ! if t == typeFSS: ! return Carbon.File.FSSpec(rawdata=desc.data) ! if t == typeFSRef: ! return Carbon.File.FSRef(rawdata=desc.data) ! if t == typeInsertionLoc: ! record = desc.AECoerceDesc('reco') ! return mkinsertionloc(unpack(record, formodulename)) ! # typeInteger equal to typeLongInteger ! if t == typeIntlText: ! script, language = struct.unpack('hh', desc.data[:4]) ! return aetypes.IntlText(script, language, desc.data[4:]) ! if t == typeIntlWritingCode: ! script, language = struct.unpack('hh', desc.data) ! return aetypes.IntlWritingCode(script, language) ! if t == typeKeyword: ! return mkkeyword(desc.data) ! if t == typeLongInteger: ! return struct.unpack('l', desc.data)[0] ! if t == typeLongDateTime: ! a, b = struct.unpack('lL', desc.data) ! return (long(a) << 32) + b ! if t == typeNull: ! return None ! if t == typeMagnitude: ! v = struct.unpack('l', desc.data) ! if v < 0: ! v = 0x100000000L + v ! return v ! if t == typeObjectSpecifier: ! record = desc.AECoerceDesc('reco') ! # If we have been told the name of the module we are unpacking aedescs for, ! # we can attempt to create the right type of python object from that module. ! if formodulename: ! return mkobjectfrommodule(unpack(record, formodulename), formodulename) ! return mkobject(unpack(record, formodulename)) ! # typePict returned as unknown ! # typePixelMap coerced to typeAERecord ! # typePixelMapMinus returned as unknown ! # typeProcessSerialNumber returned as unknown ! if t == typeQDPoint: ! v, h = struct.unpack('hh', desc.data) ! return aetypes.QDPoint(v, h) ! if t == typeQDRectangle: ! v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) ! return aetypes.QDRectangle(v0, h0, v1, h1) ! if t == typeRGBColor: ! r, g, b = struct.unpack('hhh', desc.data) ! return aetypes.RGBColor(r, g, b) ! # typeRotation coerced to typeAERecord ! # typeScrapStyles returned as unknown ! # typeSessionID returned as unknown ! if t == typeShortFloat: ! return struct.unpack('f', desc.data)[0] ! if t == typeShortInteger: ! return struct.unpack('h', desc.data)[0] ! # typeSMFloat identical to typeShortFloat ! # typeSMInt indetical to typeShortInt ! # typeStyledText coerced to typeAERecord ! if t == typeTargetID: ! return mktargetid(desc.data) ! # typeTextStyles coerced to typeAERecord ! # typeTIFF returned as unknown ! if t == typeTrue: ! return 1 ! if t == typeType: ! return mktype(desc.data, formodulename) ! # ! # The following are special ! # ! if t == 'rang': ! record = desc.AECoerceDesc('reco') ! return mkrange(unpack(record, formodulename)) ! if t == 'cmpd': ! record = desc.AECoerceDesc('reco') ! return mkcomparison(unpack(record, formodulename)) ! if t == 'logi': ! record = desc.AECoerceDesc('reco') ! return mklogical(unpack(record, formodulename)) ! return mkunknown(desc.type, desc.data) ! def coerce(data, egdata): ! """Coerce a python object to another type using the AE coercers""" ! pdata = pack(data) ! pegdata = pack(egdata) ! pdata = pdata.AECoerceDesc(pegdata.type) ! return unpack(pdata) # --- 65,259 ---- def packkey(ae, key, value): ! if hasattr(key, 'which'): ! keystr = key.which ! elif hasattr(key, 'want'): ! keystr = key.want ! else: ! keystr = key ! ae.AEPutParamDesc(keystr, pack(value)) def pack(x, forcetype = None): ! """Pack a python object into an AE descriptor""" ! ! if forcetype: ! if type(x) is StringType: ! return AE.AECreateDesc(forcetype, x) ! else: ! return pack(x).AECoerceDesc(forcetype) ! ! if x == None: ! return AE.AECreateDesc('null', '') ! ! if isinstance(x, AEDescType): ! return x ! if isinstance(x, FSSType): ! return AE.AECreateDesc('fss ', x.data) ! if isinstance(x, FSRefType): ! return AE.AECreateDesc('fsrf', x.data) ! if isinstance(x, AliasType): ! return AE.AECreateDesc('alis', x.data) ! if isinstance(x, IntType): ! return AE.AECreateDesc('long', struct.pack('l', x)) ! if isinstance(x, FloatType): ! return AE.AECreateDesc('doub', struct.pack('d', x)) ! if isinstance(x, StringType): ! return AE.AECreateDesc('TEXT', x) ! if isinstance(x, UnicodeType): ! data = x.encode('utf16') ! if data[:2] == '\xfe\xff': ! data = data[2:] ! return AE.AECreateDesc('utxt', data) ! if isinstance(x, ListType): ! list = AE.AECreateList('', 0) ! for item in x: ! list.AEPutDesc(0, pack(item)) ! return list ! if isinstance(x, DictionaryType): ! record = AE.AECreateList('', 1) ! for key, value in x.items(): ! packkey(record, key, value) ! #record.AEPutParamDesc(key, pack(value)) ! return record ! if type(x) == types.ClassType and issubclass(x, ObjectSpecifier): ! # Note: we are getting a class object here, not an instance ! return AE.AECreateDesc('type', x.want) ! if hasattr(x, '__aepack__'): ! return x.__aepack__() ! if hasattr(x, 'which'): ! return AE.AECreateDesc('TEXT', x.which) ! if hasattr(x, 'want'): ! return AE.AECreateDesc('TEXT', x.want) ! return AE.AECreateDesc('TEXT', repr(x)) # Copout def unpack(desc, formodulename=""): ! """Unpack an AE descriptor to a python object""" ! t = desc.type ! ! if unpacker_coercions.has_key(t): ! desc = desc.AECoerceDesc(unpacker_coercions[t]) ! t = desc.type # This is a guess by Jack.... ! ! if t == typeAEList: ! l = [] ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! l.append(unpack(item, formodulename)) ! return l ! if t == typeAERecord: ! d = {} ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! d[keyword] = unpack(item, formodulename) ! return d ! if t == typeAEText: ! record = desc.AECoerceDesc('reco') ! return mkaetext(unpack(record, formodulename)) ! if t == typeAlias: ! return Carbon.File.Alias(rawdata=desc.data) ! # typeAppleEvent returned as unknown ! if t == typeBoolean: ! return struct.unpack('b', desc.data)[0] ! if t == typeChar: ! return desc.data ! if t == typeUnicodeText: ! return unicode(desc.data, 'utf16') ! # typeColorTable coerced to typeAEList ! # typeComp coerced to extended ! # typeData returned as unknown ! # typeDrawingArea coerced to typeAERecord ! if t == typeEnumeration: ! return mkenum(desc.data) ! # typeEPS returned as unknown ! if t == typeFalse: ! return 0 ! if t == typeFloat: ! data = desc.data ! return struct.unpack('d', data)[0] ! if t == typeFSS: ! return Carbon.File.FSSpec(rawdata=desc.data) ! if t == typeFSRef: ! return Carbon.File.FSRef(rawdata=desc.data) ! if t == typeInsertionLoc: ! record = desc.AECoerceDesc('reco') ! return mkinsertionloc(unpack(record, formodulename)) ! # typeInteger equal to typeLongInteger ! if t == typeIntlText: ! script, language = struct.unpack('hh', desc.data[:4]) ! return aetypes.IntlText(script, language, desc.data[4:]) ! if t == typeIntlWritingCode: ! script, language = struct.unpack('hh', desc.data) ! return aetypes.IntlWritingCode(script, language) ! if t == typeKeyword: ! return mkkeyword(desc.data) ! if t == typeLongInteger: ! return struct.unpack('l', desc.data)[0] ! if t == typeLongDateTime: ! a, b = struct.unpack('lL', desc.data) ! return (long(a) << 32) + b ! if t == typeNull: ! return None ! if t == typeMagnitude: ! v = struct.unpack('l', desc.data) ! if v < 0: ! v = 0x100000000L + v ! return v ! if t == typeObjectSpecifier: ! record = desc.AECoerceDesc('reco') ! # If we have been told the name of the module we are unpacking aedescs for, ! # we can attempt to create the right type of python object from that module. ! if formodulename: ! return mkobjectfrommodule(unpack(record, formodulename), formodulename) ! return mkobject(unpack(record, formodulename)) ! # typePict returned as unknown ! # typePixelMap coerced to typeAERecord ! # typePixelMapMinus returned as unknown ! # typeProcessSerialNumber returned as unknown ! if t == typeQDPoint: ! v, h = struct.unpack('hh', desc.data) ! return aetypes.QDPoint(v, h) ! if t == typeQDRectangle: ! v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) ! return aetypes.QDRectangle(v0, h0, v1, h1) ! if t == typeRGBColor: ! r, g, b = struct.unpack('hhh', desc.data) ! return aetypes.RGBColor(r, g, b) ! # typeRotation coerced to typeAERecord ! # typeScrapStyles returned as unknown ! # typeSessionID returned as unknown ! if t == typeShortFloat: ! return struct.unpack('f', desc.data)[0] ! if t == typeShortInteger: ! return struct.unpack('h', desc.data)[0] ! # typeSMFloat identical to typeShortFloat ! # typeSMInt indetical to typeShortInt ! # typeStyledText coerced to typeAERecord ! if t == typeTargetID: ! return mktargetid(desc.data) ! # typeTextStyles coerced to typeAERecord ! # typeTIFF returned as unknown ! if t == typeTrue: ! return 1 ! if t == typeType: ! return mktype(desc.data, formodulename) ! # ! # The following are special ! # ! if t == 'rang': ! record = desc.AECoerceDesc('reco') ! return mkrange(unpack(record, formodulename)) ! if t == 'cmpd': ! record = desc.AECoerceDesc('reco') ! return mkcomparison(unpack(record, formodulename)) ! if t == 'logi': ! record = desc.AECoerceDesc('reco') ! return mklogical(unpack(record, formodulename)) ! return mkunknown(desc.type, desc.data) ! def coerce(data, egdata): ! """Coerce a python object to another type using the AE coercers""" ! pdata = pack(data) ! pegdata = pack(egdata) ! pdata = pdata.AECoerceDesc(pegdata.type) ! return unpack(pdata) # *************** *** 261,340 **** # def mktargetid(data): ! sessionID = getlong(data[:4]) ! name = mkppcportrec(data[4:4+72]) ! location = mklocationnamerec(data[76:76+36]) ! rcvrName = mkppcportrec(data[112:112+72]) ! return sessionID, name, location, rcvrName def mkppcportrec(rec): ! namescript = getword(rec[:2]) ! name = getpstr(rec[2:2+33]) ! portkind = getword(rec[36:38]) ! if portkind == 1: ! ctor = rec[38:42] ! type = rec[42:46] ! identity = (ctor, type) ! else: ! identity = getpstr(rec[38:38+33]) ! return namescript, name, portkind, identity def mklocationnamerec(rec): ! kind = getword(rec[:2]) ! stuff = rec[2:] ! if kind == 0: stuff = None ! if kind == 2: stuff = getpstr(stuff) ! return kind, stuff def mkunknown(type, data): ! return aetypes.Unknown(type, data) def getpstr(s): ! return s[1:1+ord(s[0])] def getlong(s): ! return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) def getword(s): ! return (ord(s[0])<<8) | (ord(s[1])<<0) def mkkeyword(keyword): ! return aetypes.Keyword(keyword) def mkrange(dict): ! return aetypes.Range(dict['star'], dict['stop']) def mkcomparison(dict): ! return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) def mklogical(dict): ! return aetypes.Logical(dict['logc'], dict['term']) def mkstyledtext(dict): ! return aetypes.StyledText(dict['ksty'], dict['ktxt']) ! def mkaetext(dict): ! return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) ! def mkinsertionloc(dict): ! return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) def mkobject(dict): ! want = dict['want'].type ! form = dict['form'].enum ! seld = dict['seld'] ! fr = dict['from'] ! if form in ('name', 'indx', 'rang', 'test'): ! if want == 'text': return aetypes.Text(seld, fr) ! if want == 'cha ': return aetypes.Character(seld, fr) ! if want == 'cwor': return aetypes.Word(seld, fr) ! if want == 'clin': return aetypes.Line(seld, fr) ! if want == 'cpar': return aetypes.Paragraph(seld, fr) ! if want == 'cwin': return aetypes.Window(seld, fr) ! if want == 'docu': return aetypes.Document(seld, fr) ! if want == 'file': return aetypes.File(seld, fr) ! if want == 'cins': return aetypes.InsertionPoint(seld, fr) ! if want == 'prop' and form == 'prop' and aetypes.IsType(seld): ! return aetypes.Property(seld.type, fr) ! return aetypes.ObjectSpecifier(want, form, seld, fr) # Note by Jack: I'm not 100% sure of the following code. This was --- 261,340 ---- # def mktargetid(data): ! sessionID = getlong(data[:4]) ! name = mkppcportrec(data[4:4+72]) ! location = mklocationnamerec(data[76:76+36]) ! rcvrName = mkppcportrec(data[112:112+72]) ! return sessionID, name, location, rcvrName def mkppcportrec(rec): ! namescript = getword(rec[:2]) ! name = getpstr(rec[2:2+33]) ! portkind = getword(rec[36:38]) ! if portkind == 1: ! ctor = rec[38:42] ! type = rec[42:46] ! identity = (ctor, type) ! else: ! identity = getpstr(rec[38:38+33]) ! return namescript, name, portkind, identity def mklocationnamerec(rec): ! kind = getword(rec[:2]) ! stuff = rec[2:] ! if kind == 0: stuff = None ! if kind == 2: stuff = getpstr(stuff) ! return kind, stuff def mkunknown(type, data): ! return aetypes.Unknown(type, data) def getpstr(s): ! return s[1:1+ord(s[0])] def getlong(s): ! return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) def getword(s): ! return (ord(s[0])<<8) | (ord(s[1])<<0) def mkkeyword(keyword): ! return aetypes.Keyword(keyword) def mkrange(dict): ! return aetypes.Range(dict['star'], dict['stop']) def mkcomparison(dict): ! return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) def mklogical(dict): ! return aetypes.Logical(dict['logc'], dict['term']) def mkstyledtext(dict): ! return aetypes.StyledText(dict['ksty'], dict['ktxt']) ! def mkaetext(dict): ! return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) ! def mkinsertionloc(dict): ! return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) def mkobject(dict): ! want = dict['want'].type ! form = dict['form'].enum ! seld = dict['seld'] ! fr = dict['from'] ! if form in ('name', 'indx', 'rang', 'test'): ! if want == 'text': return aetypes.Text(seld, fr) ! if want == 'cha ': return aetypes.Character(seld, fr) ! if want == 'cwor': return aetypes.Word(seld, fr) ! if want == 'clin': return aetypes.Line(seld, fr) ! if want == 'cpar': return aetypes.Paragraph(seld, fr) ! if want == 'cwin': return aetypes.Window(seld, fr) ! if want == 'docu': return aetypes.Document(seld, fr) ! if want == 'file': return aetypes.File(seld, fr) ! if want == 'cins': return aetypes.InsertionPoint(seld, fr) ! if want == 'prop' and form == 'prop' and aetypes.IsType(seld): ! return aetypes.Property(seld.type, fr) ! return aetypes.ObjectSpecifier(want, form, seld, fr) # Note by Jack: I'm not 100% sure of the following code. This was *************** *** 343,366 **** # initializer for the classes in the suites? def mkobjectfrommodule(dict, modulename): ! if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): ! # The type has already been converted to Python. Convert back:-( ! classtype = dict['want'] ! dict['want'] = aetypes.mktype(classtype.want) ! want = dict['want'].type ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(want, None) ! newobj = mkobject(dict) ! if classtype: ! assert issubclass(classtype, ObjectSpecifier) ! newobj.__class__ = classtype ! return newobj ! def mktype(typecode, modulename=None): ! if modulename: ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(typecode, None) ! if classtype: ! return classtype ! return aetypes.mktype(typecode) --- 343,366 ---- # initializer for the classes in the suites? def mkobjectfrommodule(dict, modulename): ! if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): ! # The type has already been converted to Python. Convert back:-( ! classtype = dict['want'] ! dict['want'] = aetypes.mktype(classtype.want) ! want = dict['want'].type ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(want, None) ! newobj = mkobject(dict) ! if classtype: ! assert issubclass(classtype, ObjectSpecifier) ! newobj.__class__ = classtype ! return newobj ! def mktype(typecode, modulename=None): ! if modulename: ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(typecode, None) ! if classtype: ! return classtype ! return aetypes.mktype(typecode) Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** aetools.py 1 Apr 2003 22:27:18 -0000 1.6 --- aetools.py 9 Apr 2003 13:25:42 -0000 1.7 *************** *** 10,18 **** ranges, conditionals, logicals, etc., so you can write, e.g.: ! x = Character(1, Document("foobar")) and pack(x) will create an AE object reference equivalent to AppleScript's ! character 1 of document "foobar" Some of the stuff that appears to be exported from this module comes from other --- 10,18 ---- ranges, conditionals, logicals, etc., so you can write, e.g.: ! x = Character(1, Document("foobar")) and pack(x) will create an AE object reference equivalent to AppleScript's ! character 1 of document "foobar" Some of the stuff that appears to be exported from this module comes from other *************** *** 42,102 **** aekeywords = [ ! 'tran', ! 'rtid', ! 'evcl', ! 'evid', ! 'addr', ! 'optk', ! 'timo', ! 'inte', # this attribute is read only - will be set in AESend ! 'esrc', # this attribute is read only ! 'miss', # this attribute is read only ! 'from' # new in 1.0.1 ] def missed(ae): ! try: ! desc = ae.AEGetAttributeDesc('miss', 'keyw') ! except AE.Error, msg: ! return None ! return desc.data def unpackevent(ae, formodulename=""): ! parameters = {} ! try: ! dirobj = ae.AEGetParamDesc('----', '****') ! except AE.Error: ! pass ! else: ! parameters['----'] = unpack(dirobj, formodulename) ! del dirobj ! # Workaround for what I feel is a bug in OSX 10.2: 'errn' won't show up in missed... ! try: ! dirobj = ae.AEGetParamDesc('errn', '****') ! except AE.Error: ! pass ! else: ! parameters['errn'] = unpack(dirobj, formodulename) ! del dirobj ! while 1: ! key = missed(ae) ! if not key: break ! parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename) ! attributes = {} ! for key in aekeywords: ! try: ! desc = ae.AEGetAttributeDesc(key, '****') ! except (AE.Error, MacOS.Error), msg: ! if msg[0] != -1701 and msg[0] != -1704: ! raise ! continue ! attributes[key] = unpack(desc, formodulename) ! return parameters, attributes def packevent(ae, parameters = {}, attributes = {}): ! for key, value in parameters.items(): ! packkey(ae, key, value) ! for key, value in attributes.items(): ! ae.AEPutAttributeDesc(key, pack(value)) # --- 42,102 ---- aekeywords = [ ! 'tran', ! 'rtid', ! 'evcl', ! 'evid', ! 'addr', ! 'optk', ! 'timo', ! 'inte', # this attribute is read only - will be set in AESend ! 'esrc', # this attribute is read only ! 'miss', # this attribute is read only ! 'from' # new in 1.0.1 ] def missed(ae): ! try: ! desc = ae.AEGetAttributeDesc('miss', 'keyw') ! except AE.Error, msg: ! return None ! return desc.data def unpackevent(ae, formodulename=""): ! parameters = {} ! try: ! dirobj = ae.AEGetParamDesc('----', '****') ! except AE.Error: ! pass ! else: ! parameters['----'] = unpack(dirobj, formodulename) ! del dirobj ! # Workaround for what I feel is a bug in OSX 10.2: 'errn' won't show up in missed... ! try: ! dirobj = ae.AEGetParamDesc('errn', '****') ! except AE.Error: ! pass ! else: ! parameters['errn'] = unpack(dirobj, formodulename) ! del dirobj ! while 1: ! key = missed(ae) ! if not key: break ! parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename) ! attributes = {} ! for key in aekeywords: ! try: ! desc = ae.AEGetAttributeDesc(key, '****') ! except (AE.Error, MacOS.Error), msg: ! if msg[0] != -1701 and msg[0] != -1704: ! raise ! continue ! attributes[key] = unpack(desc, formodulename) ! return parameters, attributes def packevent(ae, parameters = {}, attributes = {}): ! for key, value in parameters.items(): ! packkey(ae, key, value) ! for key, value in attributes.items(): ! ae.AEPutAttributeDesc(key, pack(value)) # *************** *** 105,346 **** # def keysubst(arguments, keydict): ! """Replace long name keys by their 4-char counterparts, and check""" ! ok = keydict.values() ! for k in arguments.keys(): ! if keydict.has_key(k): ! v = arguments[k] ! del arguments[k] ! arguments[keydict[k]] = v ! elif k != '----' and k not in ok: ! raise TypeError, 'Unknown keyword argument: %s'%k ! def enumsubst(arguments, key, edict): ! """Substitute a single enum keyword argument, if it occurs""" ! if not arguments.has_key(key) or edict is None: ! return ! v = arguments[key] ! ok = edict.values() ! if edict.has_key(v): ! arguments[key] = Enum(edict[v]) ! elif not v in ok: ! raise TypeError, 'Unknown enumerator: %s'%v ! def decodeerror(arguments): ! """Create the 'best' argument for a raise MacOS.Error""" ! errn = arguments['errn'] ! err_a1 = errn ! if arguments.has_key('errs'): ! err_a2 = arguments['errs'] ! else: ! err_a2 = MacOS.GetErrorString(errn) ! if arguments.has_key('erob'): ! err_a3 = arguments['erob'] ! else: ! err_a3 = None ! ! return (err_a1, err_a2, err_a3) class TalkTo: ! """An AE connection to an application""" ! _signature = None # Can be overridden by subclasses ! _moduleName = None # Can be overridden by subclasses ! ! __eventloop_initialized = 0 ! def __ensure_WMAvailable(klass): ! if klass.__eventloop_initialized: return 1 ! if not MacOS.WMAvailable(): return 0 ! # Workaround for a but in MacOSX 10.2: we must have an event ! # loop before we can call AESend. ! Evt.WaitNextEvent(0,0) ! return 1 ! __ensure_WMAvailable = classmethod(__ensure_WMAvailable) ! def __init__(self, signature=None, start=0, timeout=0): ! """Create a communication channel with a particular application. ! ! Addressing the application is done by specifying either a ! 4-byte signature, an AEDesc or an object that will __aepack__ ! to an AEDesc. ! """ ! self.target_signature = None ! if signature is None: ! signature = self._signature ! if type(signature) == AEDescType: ! self.target = signature ! elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): ! self.target = signature.__aepack__() ! elif type(signature) == StringType and len(signature) == 4: ! self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) ! self.target_signature = signature ! else: ! raise TypeError, "signature should be 4-char string or AEDesc" ! self.send_flags = AppleEvents.kAEWaitReply ! self.send_priority = AppleEvents.kAENormalPriority ! if timeout: ! self.send_timeout = timeout ! else: ! self.send_timeout = AppleEvents.kAEDefaultTimeout ! if start: ! self._start() ! ! def _start(self): ! """Start the application, if it is not running yet""" ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! _launch(self.target_signature) ! for i in range(LAUNCH_MAX_WAIT_TIME): ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! pass ! else: ! break ! time.sleep(1) ! ! def start(self): ! """Deprecated, used _start()""" ! self._start() ! ! def newevent(self, code, subcode, parameters = {}, attributes = {}): ! """Create a complete structure for an apple event""" ! ! event = AE.AECreateAppleEvent(code, subcode, self.target, ! AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) ! packevent(event, parameters, attributes) ! return event ! ! def sendevent(self, event): ! """Send a pre-created appleevent, await the reply and unpack it""" ! if not self.__ensure_WMAvailable(): ! raise RuntimeError, "No window manager access, cannot send AppleEvent" ! reply = event.AESend(self.send_flags, self.send_priority, ! self.send_timeout) ! parameters, attributes = unpackevent(reply, self._moduleName) ! return reply, parameters, attributes ! ! def send(self, code, subcode, parameters = {}, attributes = {}): ! """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" ! return self.sendevent(self.newevent(code, subcode, parameters, attributes)) ! ! # ! # The following events are somehow "standard" and don't seem to appear in any ! # suite... ! # ! def activate(self): ! """Send 'activate' command""" ! self.send('misc', 'actv') ! def _get(self, _object, as=None, _attributes={}): ! """_get: get data from an object ! Required argument: the object ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the data ! """ ! _code = 'core' ! _subcode = 'getd' ! _arguments = {'----':_object} ! if as: ! _arguments['rtyp'] = mktype(as) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! if _arguments.has_key('----'): ! return _arguments['----'] ! if as: ! item.__class__ = as ! return item ! ! get = _get ! ! _argmap_set = { ! 'to' : 'data', ! } ! def _set(self, _object, _attributes={}, **_arguments): ! """set: Set an object's data. ! Required argument: the object for the command ! Keyword argument to: The new value. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! set = _set # Tiny Finder class, for local use only class _miniFinder(TalkTo): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] #pass ! _finder = _miniFinder('MACS') def _launch(appfile): ! """Open a file thru the finder. Specify file by name or fsspec""" ! _finder.open(_application_file(('ID ', appfile))) class _application_file(ComponentItem): ! """application file - An application's file on disk""" ! want = 'appf' ! _application_file._propdict = { } _application_file._elemdict = { } ! # Test program # XXXX Should test more, really... def test(): ! target = AE.AECreateDesc('sign', 'quil') ! ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) ! print unpackevent(ae) ! raw_input(":") ! ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) ! obj = Character(2, Word(1, Document(1))) ! print obj ! print repr(obj) ! packevent(ae, {'----': obj}) ! params, attrs = unpackevent(ae) ! print params['----'] ! raw_input(":") if __name__ == '__main__': ! test() ! sys.exit(1) --- 105,346 ---- # def keysubst(arguments, keydict): ! """Replace long name keys by their 4-char counterparts, and check""" ! ok = keydict.values() ! for k in arguments.keys(): ! if keydict.has_key(k): ! v = arguments[k] ! del arguments[k] ! arguments[keydict[k]] = v ! elif k != '----' and k not in ok: ! raise TypeError, 'Unknown keyword argument: %s'%k ! def enumsubst(arguments, key, edict): ! """Substitute a single enum keyword argument, if it occurs""" ! if not arguments.has_key(key) or edict is None: ! return ! v = arguments[key] ! ok = edict.values() ! if edict.has_key(v): ! arguments[key] = Enum(edict[v]) ! elif not v in ok: ! raise TypeError, 'Unknown enumerator: %s'%v ! def decodeerror(arguments): ! """Create the 'best' argument for a raise MacOS.Error""" ! errn = arguments['errn'] ! err_a1 = errn ! if arguments.has_key('errs'): ! err_a2 = arguments['errs'] ! else: ! err_a2 = MacOS.GetErrorString(errn) ! if arguments.has_key('erob'): ! err_a3 = arguments['erob'] ! else: ! err_a3 = None ! ! return (err_a1, err_a2, err_a3) class TalkTo: ! """An AE connection to an application""" ! _signature = None # Can be overridden by subclasses ! _moduleName = None # Can be overridden by subclasses ! ! __eventloop_initialized = 0 ! def __ensure_WMAvailable(klass): ! if klass.__eventloop_initialized: return 1 ! if not MacOS.WMAvailable(): return 0 ! # Workaround for a but in MacOSX 10.2: we must have an event ! # loop before we can call AESend. ! Evt.WaitNextEvent(0,0) ! return 1 ! __ensure_WMAvailable = classmethod(__ensure_WMAvailable) ! def __init__(self, signature=None, start=0, timeout=0): ! """Create a communication channel with a particular application. ! ! Addressing the application is done by specifying either a ! 4-byte signature, an AEDesc or an object that will __aepack__ ! to an AEDesc. ! """ ! self.target_signature = None ! if signature is None: ! signature = self._signature ! if type(signature) == AEDescType: ! self.target = signature ! elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): ! self.target = signature.__aepack__() ! elif type(signature) == StringType and len(signature) == 4: ! self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) ! self.target_signature = signature ! else: ! raise TypeError, "signature should be 4-char string or AEDesc" ! self.send_flags = AppleEvents.kAEWaitReply ! self.send_priority = AppleEvents.kAENormalPriority ! if timeout: ! self.send_timeout = timeout ! else: ! self.send_timeout = AppleEvents.kAEDefaultTimeout ! if start: ! self._start() ! ! def _start(self): ! """Start the application, if it is not running yet""" ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! _launch(self.target_signature) ! for i in range(LAUNCH_MAX_WAIT_TIME): ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! pass ! else: ! break ! time.sleep(1) ! ! def start(self): ! """Deprecated, used _start()""" ! self._start() ! ! def newevent(self, code, subcode, parameters = {}, attributes = {}): ! """Create a complete structure for an apple event""" ! ! event = AE.AECreateAppleEvent(code, subcode, self.target, ! AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) ! packevent(event, parameters, attributes) ! return event ! ! def sendevent(self, event): ! """Send a pre-created appleevent, await the reply and unpack it""" ! if not self.__ensure_WMAvailable(): ! raise RuntimeError, "No window manager access, cannot send AppleEvent" ! reply = event.AESend(self.send_flags, self.send_priority, ! self.send_timeout) ! parameters, attributes = unpackevent(reply, self._moduleName) ! return reply, parameters, attributes ! ! def send(self, code, subcode, parameters = {}, attributes = {}): ! """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" ! return self.sendevent(self.newevent(code, subcode, parameters, attributes)) ! ! # ! # The following events are somehow "standard" and don't seem to appear in any ! # suite... ! # ! def activate(self): ! """Send 'activate' command""" ! self.send('misc', 'actv') ! def _get(self, _object, as=None, _attributes={}): ! """_get: get data from an object ! Required argument: the object ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the data ! """ ! _code = 'core' ! _subcode = 'getd' ! _arguments = {'----':_object} ! if as: ! _arguments['rtyp'] = mktype(as) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! if _arguments.has_key('----'): ! return _arguments['----'] ! if as: ! item.__class__ = as ! return item ! ! get = _get ! ! _argmap_set = { ! 'to' : 'data', ! } ! def _set(self, _object, _attributes={}, **_arguments): ! """set: Set an object's data. ! Required argument: the object for the command ! Keyword argument to: The new value. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! set = _set # Tiny Finder class, for local use only class _miniFinder(TalkTo): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] #pass ! _finder = _miniFinder('MACS') def _launch(appfile): ! """Open a file thru the finder. Specify file by name or fsspec""" ! _finder.open(_application_file(('ID ', appfile))) class _application_file(ComponentItem): ! """application file - An application's file on disk""" ! want = 'appf' ! _application_file._propdict = { } _application_file._elemdict = { } ! # Test program # XXXX Should test more, really... def test(): ! target = AE.AECreateDesc('sign', 'quil') ! ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) ! print unpackevent(ae) ! raw_input(":") ! ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) ! obj = Character(2, Word(1, Document(1))) ! print obj ! print repr(obj) ! packevent(ae, {'----': obj}) ! params, attrs = unpackevent(ae) ! print params['----'] ! raw_input(":") if __name__ == '__main__': ! test() ! sys.exit(1) Index: aetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetypes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** aetypes.py 21 Mar 2003 12:04:18 -0000 1.4 --- aetypes.py 9 Apr 2003 13:25:42 -0000 1.5 *************** *** 11,433 **** # def pack(*args, **kwargs): ! from aepack import pack ! return pack( *args, **kwargs) ! def nice(s): ! """'nice' representation of an object""" ! if type(s) is StringType: return repr(s) ! else: return str(s) [...1066 lines suppressed...] ! cls = self._propdict[name] ! return cls(self) ! raise AttributeError, name ! ! class DelayedComponentItem: ! def __init__(self, compclass, fr): ! self.compclass = compclass ! self.fr = fr ! ! def __call__(self, which): ! return self.compclass(which, self.fr) ! ! def __repr__(self): ! return "%s(???, %s)" % (self.__class__.__name__, `self.fr`) ! ! def __str__(self): ! return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) template = """ Index: applesingle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/applesingle.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** applesingle.py 30 Dec 2002 22:04:20 -0000 1.1 --- applesingle.py 9 Apr 2003 13:25:42 -0000 1.2 *************** *** 25,100 **** def decode(input, output, resonly=0): ! if type(input) == type(''): ! input = open(input, 'rb') ! # Should we also test for FSSpecs or FSRefs? ! header = input.read(AS_HEADER_LENGTH) ! try: ! magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) ! except ValueError, arg: ! raise Error, "Unpack header error: %s"%arg ! if verbose: ! print 'Magic: 0x%8.8x'%magic ! print 'Version: 0x%8.8x'%version ! print 'Entries: %d'%nentry ! if magic != AS_MAGIC: ! raise Error, 'Unknown AppleSingle magic number 0x%8.8x'%magic ! if version != AS_VERSION: ! raise Error, 'Unknown AppleSingle version number 0x%8.8x'%version ! if nentry <= 0: ! raise Error, "AppleSingle file contains no forks" ! headers = [input.read(AS_ENTRY_LENGTH) for i in range(nentry)] ! didwork = 0 ! for hdr in headers: ! try: ! id, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr) ! except ValueError, arg: ! raise Error, "Unpack entry error: %s"%arg ! if verbose: ! print 'Fork %d, offset %d, length %d'%(id, offset, length) ! input.seek(offset) ! if length == 0: ! data = '' ! else: ! data = input.read(length) ! if len(data) != length: ! raise Error, 'Short read: expected %d bytes got %d'%(length, len(data)) ! if id == AS_DATAFORK: ! if verbose: ! print ' (data fork)' ! if not resonly: ! didwork = 1 ! fp = open(output, 'wb') ! fp.write(data) ! fp.close() ! elif id == AS_RESOURCEFORK: ! didwork = 1 ! if verbose: ! print ' (resource fork)' ! if resonly: ! fp = open(output, 'wb') ! else: ! fp = MacOS.openrf(output, 'wb') ! fp.write(data) ! fp.close() ! elif id in AS_IGNORE: ! if verbose: ! print ' (ignored)' ! else: ! raise Error, 'Unknown fork type %d'%id ! if not didwork: ! raise Error, 'No useful forks found' def _test(): ! if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: ! print 'Usage: applesingle.py [-r] applesinglefile decodedfile' ! sys.exit(1) ! if sys.argv[1] == '-r': ! resonly = 1 ! del sys.argv[1] ! else: ! resonly = 0 ! decode(sys.argv[1], sys.argv[2], resonly=resonly) ! if __name__ == '__main__': ! _test() ! \ No newline at end of file --- 25,100 ---- def decode(input, output, resonly=0): ! if type(input) == type(''): ! input = open(input, 'rb') ! # Should we also test for FSSpecs or FSRefs? ! header = input.read(AS_HEADER_LENGTH) ! try: ! magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) ! except ValueError, arg: ! raise Error, "Unpack header error: %s"%arg ! if verbose: ! print 'Magic: 0x%8.8x'%magic ! print 'Version: 0x%8.8x'%version ! print 'Entries: %d'%nentry ! if magic != AS_MAGIC: ! raise Error, 'Unknown AppleSingle magic number 0x%8.8x'%magic ! if version != AS_VERSION: ! raise Error, 'Unknown AppleSingle version number 0x%8.8x'%version ! if nentry <= 0: ! raise Error, "AppleSingle file contains no forks" ! headers = [input.read(AS_ENTRY_LENGTH) for i in range(nentry)] ! didwork = 0 ! for hdr in headers: ! try: ! id, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr) ! except ValueError, arg: ! raise Error, "Unpack entry error: %s"%arg ! if verbose: ! print 'Fork %d, offset %d, length %d'%(id, offset, length) ! input.seek(offset) ! if length == 0: ! data = '' ! else: ! data = input.read(length) ! if len(data) != length: ! raise Error, 'Short read: expected %d bytes got %d'%(length, len(data)) ! if id == AS_DATAFORK: ! if verbose: ! print ' (data fork)' ! if not resonly: ! didwork = 1 ! fp = open(output, 'wb') ! fp.write(data) ! fp.close() ! elif id == AS_RESOURCEFORK: ! didwork = 1 ! if verbose: ! print ' (resource fork)' ! if resonly: ! fp = open(output, 'wb') ! else: ! fp = MacOS.openrf(output, 'wb') ! fp.write(data) ! fp.close() ! elif id in AS_IGNORE: ! if verbose: ! print ' (ignored)' ! else: ! raise Error, 'Unknown fork type %d'%id ! if not didwork: ! raise Error, 'No useful forks found' def _test(): ! if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: ! print 'Usage: applesingle.py [-r] applesinglefile decodedfile' ! sys.exit(1) ! if sys.argv[1] == '-r': ! resonly = 1 ! del sys.argv[1] ! else: ! resonly = 0 ! decode(sys.argv[1], sys.argv[2], resonly=resonly) ! if __name__ == '__main__': ! _test() ! \ No newline at end of file Index: appletrawmain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/appletrawmain.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** appletrawmain.py 30 Dec 2002 22:04:20 -0000 1.1 --- appletrawmain.py 9 Apr 2003 13:25:42 -0000 1.2 *************** *** 15,25 **** # if not sys.argv or sys.argv[0][:1] == '-': ! # Insert our (guessed) name. ! _dir = os.path.split(sys.executable)[0] # removes "python" ! _dir = os.path.split(_dir)[0] # Removes "MacOS" ! _dir = os.path.join(_dir, 'Resources') ! sys.argv.insert(0, '__rawmain__') else: ! _dir = os.path.split(sys.argv[0])[0] # # Add the Resources directory to the path. This is where files installed --- 15,25 ---- # if not sys.argv or sys.argv[0][:1] == '-': ! # Insert our (guessed) name. ! _dir = os.path.split(sys.executable)[0] # removes "python" ! _dir = os.path.split(_dir)[0] # Removes "MacOS" ! _dir = os.path.join(_dir, 'Resources') ! sys.argv.insert(0, '__rawmain__') else: ! _dir = os.path.split(sys.argv[0])[0] # # Add the Resources directory to the path. This is where files installed *************** *** 37,63 **** __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): ! # ! # Setup something resembling a normal environment and go. ! # ! sys.argv[0] = __file__ ! del argvemulator, os, sys, _dir ! execfile(__file__) else: ! __file__ = os.path.join(_dir, '__main__.pyc') ! if os.path.exists(__file__): ! # ! # If we have only a .pyc file we read the code object from that ! # ! sys.argv[0] = __file__ ! _fp = open(__file__, 'rb') ! _fp.read(8) ! __code__ = marshal.load(_fp) ! # ! # Again, we create an almost-normal environment (only __code__ is ! # funny) and go. ! # ! del argvemulator, os, sys, marshal, _dir, _fp ! exec __code__ ! else: ! sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0]) ! sys.exit(1) --- 37,63 ---- __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): ! # ! # Setup something resembling a normal environment and go. ! # ! sys.argv[0] = __file__ ! del argvemulator, os, sys, _dir ! execfile(__file__) else: ! __file__ = os.path.join(_dir, '__main__.pyc') ! if os.path.exists(__file__): ! # ! # If we have only a .pyc file we read the code object from that ! # ! sys.argv[0] = __file__ ! _fp = open(__file__, 'rb') ! _fp.read(8) ! __code__ = marshal.load(_fp) ! # ! # Again, we create an almost-normal environment (only __code__ is ! # funny) and go. ! # ! del argvemulator, os, sys, marshal, _dir, _fp ! exec __code__ ! else: ! sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0]) ! sys.exit(1) Index: appletrunner.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/appletrunner.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** appletrunner.py 30 Dec 2002 22:04:20 -0000 1.1 --- appletrunner.py 9 Apr 2003 13:25:42 -0000 1.2 *************** *** 7,17 **** import sys for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]: ! realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), ! "Resources", name) ! if os.path.exists(realmain): ! break else: ! sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0]) ! sys.exit(1) sys.argv.insert(1, realmain) os.execve(sys.executable, sys.argv, os.environ) --- 7,17 ---- import sys for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]: ! realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), ! "Resources", name) ! if os.path.exists(realmain): ! break else: ! sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0]) ! sys.exit(1) sys.argv.insert(1, realmain) os.execve(sys.executable, sys.argv, os.environ) Index: bgenlocations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bgenlocations.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bgenlocations.py 12 Feb 2003 15:37:26 -0000 1.3 --- bgenlocations.py 9 Apr 2003 13:25:42 -0000 1.4 *************** *** 13,22 **** # the source tree here. if sys.platform == 'mac': ! # For MacPython we know where it is ! def _pardir(p): return os.path.split(p)[0] ! BGENDIR=os.path.join(sys.prefix, "Tools", "bgen", "bgen") else: ! # for unix-Python we don't know, please set it yourself. ! BGENDIR="/Users/jack/src/python/Tools/bgen/bgen" # --- 13,22 ---- # the source tree here. if sys.platform == 'mac': ! # For MacPython we know where it is ! def _pardir(p): return os.path.split(p)[0] ! BGENDIR=os.path.join(sys.prefix, "Tools", "bgen", "bgen") else: ! # for unix-Python we don't know, please set it yourself. ! BGENDIR="/Users/jack/src/python/Tools/bgen/bgen" # *************** *** 27,33 **** # if sys.platform == 'mac': ! _MWERKSDIR="Sap:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") --- 27,33 ---- # if sys.platform == 'mac': ! _MWERKSDIR="Sap:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") *************** *** 38,44 **** # if sys.platform == 'mac': ! TOOLBOXDIR=os.path.join(sys.prefix, "Lib", "plat-mac", "Carbon") else: ! TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" # Creator for C files: --- 38,44 ---- # if sys.platform == 'mac': ! TOOLBOXDIR=os.path.join(sys.prefix, "Lib", "plat-mac", "Carbon") else: ! TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" # Creator for C files: *************** *** 46,61 **** if not os.path.exists(BGENDIR): ! raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR if not os.path.exists(INCLUDEDIR): ! raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR if not os.path.exists(TOOLBOXDIR): ! raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR ! # Sigh, due to the way these are used make sure they end with : or /. if BGENDIR[-1] != os.sep: ! BGENDIR = BGENDIR + os.sep if INCLUDEDIR[-1] != os.sep: ! INCLUDEDIR = INCLUDEDIR + os.sep if TOOLBOXDIR[-1] != os.sep: ! TOOLBOXDIR = TOOLBOXDIR + os.sep ! --- 46,61 ---- if not os.path.exists(BGENDIR): ! raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR if not os.path.exists(INCLUDEDIR): ! raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR if not os.path.exists(TOOLBOXDIR): ! raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR ! # Sigh, due to the way these are used make sure they end with : or /. if BGENDIR[-1] != os.sep: ! BGENDIR = BGENDIR + os.sep if INCLUDEDIR[-1] != os.sep: ! INCLUDEDIR = INCLUDEDIR + os.sep if TOOLBOXDIR[-1] != os.sep: ! TOOLBOXDIR = TOOLBOXDIR + os.sep ! Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/buildtools.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** buildtools.py 25 Feb 2003 23:02:03 -0000 1.8 --- buildtools.py 9 Apr 2003 13:25:42 -0000 1.9 *************** *** 43,325 **** def findtemplate(template=None): ! """Locate the applet template along sys.path""" ! if MacOS.runtimemodel == 'macho': ! return None ! if not template: ! template=TEMPLATE ! for p in sys.path: ! file = os.path.join(p, template) ! try: ! file, d1, d2 = Carbon.File.FSResolveAliasFile(file, 1) ! break ! except (Carbon.File.Error, ValueError): ! continue ! else: ! raise BuildError, "Template %s not found on sys.path" % `template` ! file = file.as_pathname() ! return file ! def process(template, filename, destname, copy_codefragment=0, ! rsrcname=None, others=[], raw=0, progress="default"): ! ! if progress == "default": ! progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) ! progress.label("Compiling...") ! progress.inc(0) ! # check for the script name being longer than 32 chars. This may trigger a bug ! # on OSX that can destroy your sourcefile. ! if '#' in os.path.split(filename)[1]: ! raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename ! # Read the source and compile it ! # (there's no point overwriting the destination if it has a syntax error) ! ! fp = open(filename, 'rU') ! text = fp.read() ! fp.close() ! try: ! code = compile(text + '\n', filename, "exec") ! except SyntaxError, arg: ! raise BuildError, "Syntax error in script %s: %s" % (filename, arg) ! except EOFError: ! raise BuildError, "End-of-file in script %s" % (filename,) ! ! # Set the destination file name. Note that basename ! # does contain the whole filepath, only a .py is stripped. ! ! if string.lower(filename[-3:]) == ".py": ! basename = filename[:-3] ! if MacOS.runtimemodel != 'macho' and not destname: ! destname = basename ! else: ! basename = filename ! ! if not destname: ! if MacOS.runtimemodel == 'macho': ! destname = basename + '.app' ! else: ! destname = basename + '.applet' ! if not rsrcname: ! rsrcname = basename + '.rsrc' ! ! # Try removing the output file. This fails in MachO, but it should ! # do any harm. ! try: ! os.remove(destname) ! except os.error: ! pass ! process_common(template, progress, code, rsrcname, destname, 0, ! copy_codefragment, raw, others, filename) ! def update(template, filename, output): ! if MacOS.runtimemodel == 'macho': ! raise BuildError, "No updating yet for MachO applets" ! if progress: ! progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120) ! else: ! progress = None ! if not output: ! output = filename + ' (updated)' ! ! # Try removing the output file ! try: ! os.remove(output) ! except os.error: ! pass ! process_common(template, progress, None, filename, output, 1, 1) def process_common(template, progress, code, rsrcname, destname, is_update, ! copy_codefragment, raw=0, others=[], filename=None): ! if MacOS.runtimemodel == 'macho': ! return process_common_macho(template, progress, code, rsrcname, destname, ! is_update, raw, others, filename) ! if others: ! raise BuildError, "Extra files only allowed for MachoPython applets" ! # Create FSSpecs for the various files ! template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) ! template = template_fsr.as_pathname() ! ! # Copy data (not resources, yet) from the template ! if progress: ! progress.label("Copy data fork...") ! progress.set(10) ! ! if copy_codefragment: ! tmpl = open(template, "rb") ! dest = open(destname, "wb") ! data = tmpl.read() ! if data: ! dest.write(data) ! dest.close() ! tmpl.close() ! del dest ! del tmpl ! ! # Open the output resource fork ! ! if progress: ! progress.label("Copy resources...") ! progress.set(20) ! try: ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! except MacOS.Error: ! destdir, destfile = os.path.split(destname) ! Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! ! # Copy the resources from the target specific resource template, if any ! typesfound, ownertype = [], None ! try: ! input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) ! except (MacOS.Error, ValueError): ! pass ! if progress: ! progress.inc(50) ! else: ! if is_update: ! skip_oldfile = ['cfrg'] ! else: ! skip_oldfile = [] ! typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) ! Res.CloseResFile(input) ! ! # Check which resource-types we should not copy from the template ! skiptypes = [] ! if 'vers' in typesfound: skiptypes.append('vers') ! if 'SIZE' in typesfound: skiptypes.append('SIZE') ! if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', ! 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] ! if not copy_codefragment: ! skiptypes.append('cfrg') ! ## skipowner = (ownertype <> None) ! ! # Copy the resources from the template ! ! input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) ! dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) ! ! Res.CloseResFile(input) ! ## if ownertype == None: ! ## raise BuildError, "No owner resource found in either resource file or template" ! # Make sure we're manipulating the output resource file now ! ! Res.UseResFile(output) ! if ownertype == None: ! # No owner resource in the template. We have skipped the ! # Python owner resource, so we have to add our own. The relevant ! # bundle stuff is already included in the interpret/applet template. ! newres = Res.Resource('\0') ! newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") ! ownertype = DEFAULT_APPLET_CREATOR ! ! if code: ! # Delete any existing 'PYC ' resource named __main__ ! ! try: ! res = Res.Get1NamedResource(RESTYPE, RESNAME) ! res.RemoveResource() ! except Res.Error: ! pass ! ! # Create the raw data for the resource from the code object ! if progress: ! progress.label("Write PYC resource...") ! progress.set(120) ! ! data = marshal.dumps(code) ! del code ! data = (MAGIC + '\0\0\0\0') + data ! ! # Create the resource and write it ! ! id = 0 ! while id < 128: ! id = Res.Unique1ID(RESTYPE) ! res = Res.Resource(data) ! res.AddResource(RESTYPE, id, RESNAME) ! attrs = res.GetResAttrs() ! attrs = attrs | 0x04 # set preload ! res.SetResAttrs(attrs) ! res.WriteResource() ! res.ReleaseResource() ! ! # Close the output file ! ! Res.CloseResFile(output) ! ! # Now set the creator, type and bundle bit of the destination. ! # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) ! dest_fss = Carbon.File.FSSpec(destname) ! dest_finfo = dest_fss.FSpGetFInfo() ! dest_finfo.Creator = ownertype ! dest_finfo.Type = 'APPL' ! dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared ! dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited ! dest_fss.FSpSetFInfo(dest_finfo) ! ! macostools.touched(destname) ! if progress: ! progress.label("Done.") ! progress.inc(0) def process_common_macho(template, progress, code, rsrcname, destname, is_update, ! raw=0, others=[], filename=None): ! # Check that we have a filename ! if filename is None: ! raise BuildError, "Need source filename on MacOSX" ! # First make sure the name ends in ".app" ! if destname[-4:] != '.app': ! destname = destname + '.app' ! # Now deduce the short name ! destdir, shortname = os.path.split(destname) ! if shortname[-4:] == '.app': ! # Strip the .app suffix ! shortname = shortname[:-4] ! # And deduce the .plist and .icns names ! plistname = None ! icnsname = None ! if rsrcname and rsrcname[-5:] == '.rsrc': ! tmp = rsrcname[:-5] ! plistname = tmp + '.plist' ! if os.path.exists(plistname): ! icnsname = tmp + '.icns' ! if not os.path.exists(icnsname): ! icnsname = None ! else: ! plistname = None ! if not os.path.exists(rsrcname): ! rsrcname = None ! if progress: ! progress.label('Creating bundle...') ! import bundlebuilder ! builder = bundlebuilder.AppBuilder(verbosity=0) ! builder.mainprogram = filename ! builder.builddir = destdir ! builder.name = shortname ! if rsrcname: ! realrsrcname = macresource.resource_pathname(rsrcname) ! builder.files.append((realrsrcname, ! os.path.join('Contents/Resources', os.path.basename(rsrcname)))) ! for o in others: ! if type(o) == str: ! builder.resources.append(o) ! else: ! builder.files.append(o) ! if plistname: ! import plistlib ! builder.plist = plistlib.Plist.fromFile(plistname) ! if icnsname: ! builder.iconfile = icnsname ! if not raw: ! builder.argv_emulation = 1 ! builder.setup() ! builder.build() ! if progress: ! progress.label('Done.') ! progress.inc(0) ! ! ## macostools.touched(dest_fss) # Copy resources between two resource file descriptors. --- 43,325 ---- def findtemplate(template=None): ! """Locate the applet template along sys.path""" ! if MacOS.runtimemodel == 'macho': ! return None ! if not template: ! template=TEMPLATE ! for p in sys.path: ! file = os.path.join(p, template) ! try: ! file, d1, d2 = Carbon.File.FSResolveAliasFile(file, 1) ! break ! except (Carbon.File.Error, ValueError): ! continue ! else: ! raise BuildError, "Template %s not found on sys.path" % `template` ! file = file.as_pathname() ! return file ! def process(template, filename, destname, copy_codefragment=0, ! rsrcname=None, others=[], raw=0, progress="default"): ! ! if progress == "default": ! progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) ! progress.label("Compiling...") ! progress.inc(0) ! # check for the script name being longer than 32 chars. This may trigger a bug ! # on OSX that can destroy your sourcefile. ! if '#' in os.path.split(filename)[1]: ! raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename ! # Read the source and compile it ! # (there's no point overwriting the destination if it has a syntax error) ! ! fp = open(filename, 'rU') ! text = fp.read() ! fp.close() ! try: ! code = compile(text + '\n', filename, "exec") ! except SyntaxError, arg: ! raise BuildError, "Syntax error in script %s: %s" % (filename, arg) ! except EOFError: ! raise BuildError, "End-of-file in script %s" % (filename,) ! ! # Set the destination file name. Note that basename ! # does contain the whole filepath, only a .py is stripped. ! ! if string.lower(filename[-3:]) == ".py": ! basename = filename[:-3] ! if MacOS.runtimemodel != 'macho' and not destname: ! destname = basename ! else: ! basename = filename ! ! if not destname: ! if MacOS.runtimemodel == 'macho': ! destname = basename + '.app' ! else: ! destname = basename + '.applet' ! if not rsrcname: ! rsrcname = basename + '.rsrc' ! ! # Try removing the output file. This fails in MachO, but it should ! # do any harm. ! try: ! os.remove(destname) ! except os.error: ! pass ! process_common(template, progress, code, rsrcname, destname, 0, ! copy_codefragment, raw, others, filename) ! def update(template, filename, output): ! if MacOS.runtimemodel == 'macho': ! raise BuildError, "No updating yet for MachO applets" ! if progress: ! progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120) ! else: ! progress = None ! if not output: ! output = filename + ' (updated)' ! ! # Try removing the output file ! try: ! os.remove(output) ! except os.error: ! pass ! process_common(template, progress, None, filename, output, 1, 1) def process_common(template, progress, code, rsrcname, destname, is_update, ! copy_codefragment, raw=0, others=[], filename=None): ! if MacOS.runtimemodel == 'macho': ! return process_common_macho(template, progress, code, rsrcname, destname, ! is_update, raw, others, filename) ! if others: ! raise BuildError, "Extra files only allowed for MachoPython applets" ! # Create FSSpecs for the various files ! template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) ! template = template_fsr.as_pathname() ! ! # Copy data (not resources, yet) from the template ! if progress: ! progress.label("Copy data fork...") ! progress.set(10) ! ! if copy_codefragment: ! tmpl = open(template, "rb") ! dest = open(destname, "wb") ! data = tmpl.read() ! if data: ! dest.write(data) ! dest.close() ! tmpl.close() ! del dest ! del tmpl ! ! # Open the output resource fork ! ! if progress: ! progress.label("Copy resources...") ! progress.set(20) ! try: ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! except MacOS.Error: ! destdir, destfile = os.path.split(destname) ! Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! ! # Copy the resources from the target specific resource template, if any ! typesfound, ownertype = [], None ! try: ! input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) ! except (MacOS.Error, ValueError): ! pass ! if progress: ! progress.inc(50) ! else: ! if is_update: ! skip_oldfile = ['cfrg'] ! else: ! skip_oldfile = [] ! typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) ! Res.CloseResFile(input) ! ! # Check which resource-types we should not copy from the template ! skiptypes = [] ! if 'vers' in typesfound: skiptypes.append('vers') ! if 'SIZE' in typesfound: skiptypes.append('SIZE') ! if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', ! 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] ! if not copy_codefragment: ! skiptypes.append('cfrg') ! ## skipowner = (ownertype <> None) ! ! # Copy the resources from the template ! ! input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) ! dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) ! ! Res.CloseResFile(input) ! ## if ownertype == None: ! ## raise BuildError, "No owner resource found in either resource file or template" ! # Make sure we're manipulating the output resource file now ! ! Res.UseResFile(output) ! if ownertype == None: ! # No owner resource in the template. We have skipped the ! # Python owner resource, so we have to add our own. The relevant ! # bundle stuff is already included in the interpret/applet template. ! newres = Res.Resource('\0') ! newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") ! ownertype = DEFAULT_APPLET_CREATOR ! ! if code: ! # Delete any existing 'PYC ' resource named __main__ ! ! try: ! res = Res.Get1NamedResource(RESTYPE, RESNAME) ! res.RemoveResource() ! except Res.Error: ! pass ! ! # Create the raw data for the resource from the code object ! if progress: ! progress.label("Write PYC resource...") ! progress.set(120) ! ! data = marshal.dumps(code) ! del code ! data = (MAGIC + '\0\0\0\0') + data ! ! # Create the resource and write it ! ! id = 0 ! while id < 128: ! id = Res.Unique1ID(RESTYPE) ! res = Res.Resource(data) ! res.AddResource(RESTYPE, id, RESNAME) ! attrs = res.GetResAttrs() ! attrs = attrs | 0x04 # set preload ! res.SetResAttrs(attrs) ! res.WriteResource() ! res.ReleaseResource() ! ! # Close the output file ! ! Res.CloseResFile(output) ! ! # Now set the creator, type and bundle bit of the destination. ! # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) ! dest_fss = Carbon.File.FSSpec(destname) ! dest_finfo = dest_fss.FSpGetFInfo() ! dest_finfo.Creator = ownertype ! dest_finfo.Type = 'APPL' ! dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared ! dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited ! dest_fss.FSpSetFInfo(dest_finfo) ! ! macostools.touched(destname) ! if progress: ! progress.label("Done.") ! progress.inc(0) def process_common_macho(template, progress, code, rsrcname, destname, is_update, ! raw=0, others=[], filename=None): ! # Check that we have a filename ! if filename is None: ! raise BuildError, "Need source filename on MacOSX" ! # First make sure the name ends in ".app" ! if destname[-4:] != '.app': ! destname = destname + '.app' ! # Now deduce the short name ! destdir, shortname = os.path.split(destname) ! if shortname[-4:] == '.app': ! # Strip the .app suffix ! shortname = shortname[:-4] ! # And deduce the .plist and .icns names ! plistname = None ! icnsname = None ! if rsrcname and rsrcname[-5:] == '.rsrc': ! tmp = rsrcname[:-5] ! plistname = tmp + '.plist' ! if os.path.exists(plistname): ! icnsname = tmp + '.icns' ! if not os.path.exists(icnsname): ! icnsname = None ! else: ! plistname = None ! if not os.path.exists(rsrcname): ! rsrcname = None ! if progress: ! progress.label('Creating bundle...') ! import bundlebuilder ! builder = bundlebuilder.AppBuilder(verbosity=0) ! builder.mainprogram = filename ! builder.builddir = destdir ! builder.name = shortname ! if rsrcname: ! realrsrcname = macresource.resource_pathname(rsrcname) ! builder.files.append((realrsrcname, ! os.path.join('Contents/Resources', os.path.basename(rsrcname)))) ! for o in others: ! if type(o) == str: ! builder.resources.append(o) ! else: ! builder.files.append(o) ! if plistname: ! import plistlib ! builder.plist = plistlib.Plist.fromFile(plistname) ! if icnsname: ! builder.iconfile = icnsname ! if not raw: ! builder.argv_emulation = 1 ! builder.setup() ! builder.build() ! if progress: ! progress.label('Done.') ! progress.inc(0) ! ! ## macostools.touched(dest_fss) # Copy resources between two resource file descriptors. *************** *** 328,416 **** # def copyres(input, output, skiptypes, skipowner, progress=None): ! ctor = None ! alltypes = [] ! Res.UseResFile(input) ! ntypes = Res.Count1Types() ! progress_type_inc = 50/ntypes ! for itype in range(1, 1+ntypes): ! type = Res.Get1IndType(itype) ! if type in skiptypes: ! continue ! alltypes.append(type) ! nresources = Res.Count1Resources(type) ! progress_cur_inc = progress_type_inc/nresources ! for ires in range(1, 1+nresources): ! res = Res.Get1IndResource(type, ires) ! id, type, name = res.GetResInfo() ! lcname = string.lower(name) ! if lcname == OWNERNAME and id == 0: ! if skipowner: ! continue # Skip this one ! else: ! ctor = type ! size = res.size ! attrs = res.GetResAttrs() ! if progress: ! progress.label("Copy %s %d %s"%(type, id, name)) ! progress.inc(progress_cur_inc) ! res.LoadResource() ! res.DetachResource() ! Res.UseResFile(output) ! try: ! res2 = Res.Get1Resource(type, id) ! except MacOS.Error: ! res2 = None ! if res2: ! if progress: ! progress.label("Overwrite %s %d %s"%(type, id, name)) ! progress.inc(0) ! res2.RemoveResource() ! res.AddResource(type, id, name) ! res.WriteResource() ! attrs = attrs | res.GetResAttrs() ! res.SetResAttrs(attrs) ! Res.UseResFile(input) ! return alltypes, ctor def copyapptree(srctree, dsttree, exceptlist=[], progress=None): ! names = [] ! if os.path.exists(dsttree): ! shutil.rmtree(dsttree) ! os.mkdir(dsttree) ! todo = os.listdir(srctree) ! while todo: ! this, todo = todo[0], todo[1:] ! if this in exceptlist: ! continue ! thispath = os.path.join(srctree, this) ! if os.path.isdir(thispath): ! thiscontent = os.listdir(thispath) ! for t in thiscontent: ! todo.append(os.path.join(this, t)) ! names.append(this) ! for this in names: ! srcpath = os.path.join(srctree, this) ! dstpath = os.path.join(dsttree, this) ! if os.path.isdir(srcpath): ! os.mkdir(dstpath) ! elif os.path.islink(srcpath): ! endpoint = os.readlink(srcpath) ! os.symlink(endpoint, dstpath) ! else: ! if progress: ! progress.label('Copy '+this) ! progress.inc(0) ! shutil.copy2(srcpath, dstpath) ! def writepycfile(codeobject, cfile): ! import marshal ! fc = open(cfile, 'wb') ! fc.write('\0\0\0\0') # MAGIC placeholder, written later ! fc.write('\0\0\0\0') # Timestap placeholder, not needed ! marshal.dump(codeobject, fc) ! fc.flush() ! fc.seek(0, 0) ! fc.write(MAGIC) ! fc.close() --- 328,416 ---- # def copyres(input, output, skiptypes, skipowner, progress=None): ! ctor = None ! alltypes = [] ! Res.UseResFile(input) ! ntypes = Res.Count1Types() ! progress_type_inc = 50/ntypes ! for itype in range(1, 1+ntypes): ! type = Res.Get1IndType(itype) ! if type in skiptypes: ! continue ! alltypes.append(type) ! nresources = Res.Count1Resources(type) ! progress_cur_inc = progress_type_inc/nresources ! for ires in range(1, 1+nresources): ! res = Res.Get1IndResource(type, ires) ! id, type, name = res.GetResInfo() ! lcname = string.lower(name) ! if lcname == OWNERNAME and id == 0: ! if skipowner: ! continue # Skip this one ! else: ! ctor = type ! size = res.size ! attrs = res.GetResAttrs() ! if progress: ! progress.label("Copy %s %d %s"%(type, id, name)) ! progress.inc(progress_cur_inc) ! res.LoadResource() ! res.DetachResource() ! Res.UseResFile(output) ! try: ! res2 = Res.Get1Resource(type, id) ! except MacOS.Error: ! res2 = None ! if res2: ! if progress: ! progress.label("Overwrite %s %d %s"%(type, id, name)) ! progress.inc(0) ! res2.RemoveResource() ! res.AddResource(type, id, name) ! res.WriteResource() ! attrs = attrs | res.GetResAttrs() ! res.SetResAttrs(attrs) ! Res.UseResFile(input) ! return alltypes, ctor def copyapptree(srctree, dsttree, exceptlist=[], progress=None): ! names = [] ! if os.path.exists(dsttree): ! shutil.rmtree(dsttree) ! os.mkdir(dsttree) ! todo = os.listdir(srctree) ! while todo: ! this, todo = todo[0], todo[1:] ! if this in exceptlist: ! continue ! thispath = os.path.join(srctree, this) ! if os.path.isdir(thispath): ! thiscontent = os.listdir(thispath) ! for t in thiscontent: ! todo.append(os.path.join(this, t)) ! names.append(this) ! for this in names: ! srcpath = os.path.join(srctree, this) ! dstpath = os.path.join(dsttree, this) ! if os.path.isdir(srcpath): ! os.mkdir(dstpath) ! elif os.path.islink(srcpath): ! endpoint = os.readlink(srcpath) ! os.symlink(endpoint, dstpath) ! else: ! if progress: ! progress.label('Copy '+this) ! progress.inc(0) ! shutil.copy2(srcpath, dstpath) ! def writepycfile(codeobject, cfile): ! import marshal ! fc = open(cfile, 'wb') ! fc.write('\0\0\0\0') # MAGIC placeholder, written later ! fc.write('\0\0\0\0') # Timestap placeholder, not needed ! marshal.dump(codeobject, fc) ! fc.flush() ! fc.seek(0, 0) ! fc.write(MAGIC) ! fc.close() Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** bundlebuilder.py 21 Mar 2003 22:22:19 -0000 1.24 --- bundlebuilder.py 9 Apr 2003 13:25:42 -0000 1.25 *************** *** 43,213 **** class Defaults: ! """Class attributes that don't start with an underscore and are ! not functions or classmethods are (deep)copied to self.__dict__. ! This allows for mutable default values. ! """ ! def __init__(self, **kwargs): ! defaults = self._getDefaults() ! defaults.update(kwargs) [...1344 lines suppressed...] ! if command == "build": ! builder.setup() ! builder.build() ! elif command == "report": ! builder.setup() ! builder.report() ! elif command == "help": ! usage() ! else: ! usage("Unknown command '%s'" % command) def buildapp(**kwargs): ! builder = AppBuilder(**kwargs) ! main(builder) if __name__ == "__main__": ! main() Index: cfmfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/cfmfile.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cfmfile.py 5 Feb 2003 15:44:03 -0000 1.2 --- cfmfile.py 9 Apr 2003 13:25:42 -0000 1.3 *************** *** 19,184 **** def mergecfmfiles(srclist, dst, architecture = 'fat'): ! """Merge all files in srclist into a new file dst. ! ! If architecture is given, only code fragments of that type will be used: ! "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" ! 68k code, since it does not use code fragments to begin with. ! If architecture is None, all fragments will be used, enabling FAT binaries. ! """ ! ! srclist = list(srclist) ! for i in range(len(srclist)): ! srclist[i] = Carbon.File.pathname(srclist[i]) ! dst = Carbon.File.pathname(dst) ! ! dstfile = open(dst, "wb") ! rf = Res.FSpOpenResFile(dst, 3) ! try: ! dstcfrg = CfrgResource() ! for src in srclist: ! srccfrg = CfrgResource(src) ! for frag in srccfrg.fragments: ! if frag.architecture == 'pwpc' and architecture == 'm68k': ! continue ! if frag.architecture == 'm68k' and architecture == 'pwpc': ! continue ! dstcfrg.append(frag) ! ! frag.copydata(dstfile) ! ! cfrgres = Res.Resource(dstcfrg.build()) ! Res.UseResFile(rf) ! cfrgres.AddResource('cfrg', 0, "") ! finally: ! dstfile.close() ! rf = Res.CloseResFile(rf) class CfrgResource: ! ! def __init__(self, path = None): ! self.version = 1 ! self.fragments = [] ! self.path = path ! if path is not None and os.path.exists(path): ! currentresref = Res.CurResFile() ! resref = Res.FSpOpenResFile(path, 1) ! Res.UseResFile(resref) ! try: ! try: ! data = Res.Get1Resource('cfrg', 0).data ! except Res.Error: ! raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback ! finally: ! Res.CloseResFile(resref) ! Res.UseResFile(currentresref) ! self.parse(data) ! if self.version <> 1: ! raise error, "unknown 'cfrg' resource format" ! ! def parse(self, data): ! (res1, res2, self.version, ! res3, res4, res5, res6, ! self.memberCount) = struct.unpack("8l", data[:32]) ! data = data[32:] ! while data: ! frag = FragmentDescriptor(self.path, data) ! data = data[frag.memberSize:] ! self.fragments.append(frag) ! ! def build(self): ! self.memberCount = len(self.fragments) ! data = struct.pack("8l", 0, 0, self.version, 0, 0, 0, 0, self.memberCount) ! for frag in self.fragments: ! data = data + frag.build() ! return data ! ! def append(self, frag): ! self.fragments.append(frag) class FragmentDescriptor: ! ! def __init__(self, path, data = None): ! self.path = path ! if data is not None: ! self.parse(data) ! ! def parse(self, data): ! self.architecture = data[:4] ! ( self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2, ! self.memberSize,) = struct.unpack("4lhBB4lh", data[4:42]) ! pname = data[42:self.memberSize] ! self.name = pname[1:1+ord(pname[0])] ! ! def build(self): ! data = self.architecture ! data = data + struct.pack("4lhBB4l", ! self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2) ! self.memberSize = len(data) + 2 + 1 + len(self.name) ! # pad to 4 byte boundaries ! if self.memberSize % 4: ! self.memberSize = self.memberSize + 4 - (self.memberSize % 4) ! data = data + struct.pack("hb", self.memberSize, len(self.name)) ! data = data + self.name ! data = data + '\000' * (self.memberSize - len(data)) ! return data ! ! def getfragment(self): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! f = open(self.path, "rb") ! f.seek(self.offset) ! if self.length: ! frag = f.read(self.length) ! else: ! frag = f.read() ! f.close() ! return frag ! ! def copydata(self, outfile): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! infile = open(self.path, "rb") ! if self.length == 0: ! infile.seek(0, 2) ! self.length = infile.tell() ! ! # Position input file and record new offset from output file ! infile.seek(self.offset) ! ! # pad to 16 byte boundaries ! offset = outfile.tell() ! if offset % 16: ! offset = offset + 16 - (offset % 16) ! outfile.seek(offset) ! self.offset = offset ! ! l = self.length ! while l: ! if l > BUFSIZE: ! outfile.write(infile.read(BUFSIZE)) ! l = l - BUFSIZE ! else: ! outfile.write(infile.read(l)) ! l = 0 ! infile.close() --- 19,184 ---- def mergecfmfiles(srclist, dst, architecture = 'fat'): ! """Merge all files in srclist into a new file dst. ! ! If architecture is given, only code fragments of that type will be used: ! "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" ! 68k code, since it does not use code fragments to begin with. ! If architecture is None, all fragments will be used, enabling FAT binaries. ! """ ! ! srclist = list(srclist) ! for i in range(len(srclist)): ! srclist[i] = Carbon.File.pathname(srclist[i]) ! dst = Carbon.File.pathname(dst) ! ! dstfile = open(dst, "wb") ! rf = Res.FSpOpenResFile(dst, 3) ! try: ! dstcfrg = CfrgResource() ! for src in srclist: ! srccfrg = CfrgResource(src) ! for frag in srccfrg.fragments: ! if frag.architecture == 'pwpc' and architecture == 'm68k': ! continue ! if frag.architecture == 'm68k' and architecture == 'pwpc': ! continue ! dstcfrg.append(frag) ! ! frag.copydata(dstfile) ! ! cfrgres = Res.Resource(dstcfrg.build()) ! Res.UseResFile(rf) ! cfrgres.AddResource('cfrg', 0, "") ! finally: ! dstfile.close() ! rf = Res.CloseResFile(rf) class CfrgResource: ! ! def __init__(self, path = None): ! self.version = 1 ! self.fragments = [] ! self.path = path ! if path is not None and os.path.exists(path): ! currentresref = Res.CurResFile() ! resref = Res.FSpOpenResFile(path, 1) ! Res.UseResFile(resref) ! try: ! try: ! data = Res.Get1Resource('cfrg', 0).data ! except Res.Error: ! raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback ! finally: ! Res.CloseResFile(resref) ! Res.UseResFile(currentresref) ! self.parse(data) ! if self.version <> 1: ! raise error, "unknown 'cfrg' resource format" ! ! def parse(self, data): ! (res1, res2, self.version, ! res3, res4, res5, res6, ! self.memberCount) = struct.unpack("8l", data[:32]) ! data = data[32:] ! while data: ! frag = FragmentDescriptor(self.path, data) ! data = data[frag.memberSize:] ! self.fragments.append(frag) ! ! def build(self): ! self.memberCount = len(self.fragments) ! data = struct.pack("8l", 0, 0, self.version, 0, 0, 0, 0, self.memberCount) ! for frag in self.fragments: ! data = data + frag.build() ! return data ! ! def append(self, frag): ! self.fragments.append(frag) class FragmentDescriptor: ! ! def __init__(self, path, data = None): ! self.path = path ! if data is not None: ! self.parse(data) ! ! def parse(self, data): ! self.architecture = data[:4] ! ( self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2, ! self.memberSize,) = struct.unpack("4lhBB4lh", data[4:42]) ! pname = data[42:self.memberSize] ! self.name = pname[1:1+ord(pname[0])] ! ! def build(self): ! data = self.architecture ! data = data + struct.pack("4lhBB4l", ! self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2) ! self.memberSize = len(data) + 2 + 1 + len(self.name) ! # pad to 4 byte boundaries ! if self.memberSize % 4: ! self.memberSize = self.memberSize + 4 - (self.memberSize % 4) ! data = data + struct.pack("hb", self.memberSize, len(self.name)) ! data = data + self.name ! data = data + '\000' * (self.memberSize - len(data)) ! return data ! ! def getfragment(self): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! f = open(self.path, "rb") ! f.seek(self.offset) ! if self.length: ! frag = f.read(self.length) ! else: ! frag = f.read() ! f.close() ! return frag ! ! def copydata(self, outfile): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! infile = open(self.path, "rb") ! if self.length == 0: ! infile.seek(0, 2) ! self.length = infile.tell() ! ! # Position input file and record new offset from output file ! infile.seek(self.offset) ! ! # pad to 16 byte boundaries ! offset = outfile.tell() ! if offset % 16: ! offset = offset + 16 - (offset % 16) ! outfile.seek(offset) ! self.offset = offset ! ! l = self.length ! while l: ! if l > BUFSIZE: ! outfile.write(infile.read(BUFSIZE)) ! l = l - BUFSIZE ! else: ! outfile.write(infile.read(l)) ! l = 0 ! infile.close() Index: findertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/findertools.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** findertools.py 21 Feb 2003 23:14:30 -0000 1.3 --- findertools.py 9 Apr 2003 13:25:42 -0000 1.4 *************** *** 31,832 **** def _getfinder(): ! """returns basic (recyclable) Finder AE interface object""" ! global _finder_talker ! if not _finder_talker: ! _finder_talker = Finder.Finder() ! _finder_talker.send_flags = ( _finder_talker.send_flags | ! AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer) ! return _finder_talker ! [...1575 lines suppressed...] ! print 'Return a list of current active processes:' ! for p in pr: ! print '\t', p ! ! # get attributes of the first process in the list ! print 'Attributes of the first process in the list:' ! pinfo = processinfo(pr[0][0]) ! print '\t', pr[0][0] ! print '\t\tmemory partition', pinfo.partition # the memory allocated to this process ! print '\t\tmemory used', pinfo.used # the memory actuall used by this process ! print '\t\tis visible', pinfo.visible # is the process visible to the user ! print '\t\tis frontmost', pinfo.frontmost # is the process the front most one? ! print '\t\thas scripting', pinfo.hasscripting # is the process scriptable? ! print '\t\taccepts high level events', pinfo.accepthighlevel # does the process accept high level appleevents? if __name__ == '__main__': ! _test() ! _test2() ! _test3() ! Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gensuitemodule.py 1 Apr 2003 22:01:58 -0000 1.5 --- gensuitemodule.py 9 Apr 2003 13:25:42 -0000 1.6 *************** *** 30,35 **** def usage(): ! sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) ! sys.stderr.write("""Options: --output pkgdir Pathname of the output package (short: -o) --resource Parse resource file in stead of launching application (-r) --- 30,35 ---- def usage(): ! sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) [...2296 lines suppressed...] ! rv = '' ! ok = string.ascii_letters + '_' ! ok2 = ok + string.digits ! for c in str: ! if c in ok: ! rv = rv + c ! elif c == ' ': ! rv = rv + '_' ! else: ! rv = rv + '_%02.2x_'%ord(c) ! ok = ok2 ! if keyword.iskeyword(rv): ! rv = rv + '_' ! return rv # Call the main program if __name__ == '__main__': ! main() ! sys.exit(1) Index: ic.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/ic.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ic.py 25 Feb 2003 13:34:22 -0000 1.4 --- ic.py 9 Apr 2003 13:25:43 -0000 1.5 *************** *** 12,25 **** # From ictypes.h: ! icPrefNotFoundErr = -666 # preference not found (duh!) ! icPermErr = -667 # cannot set preference ! icPrefDataErr = -668 # problem with preference data ! icInternalErr = -669 # hmm, this is not good ! icTruncatedErr = -670 # more data was present than was returned ! icNoMoreWritersErr = -671 # you cannot begin a write session because someone else is already doing it */ ! icNothingToOverrideErr = -672 # no component for the override component to capture ! icNoURLErr = -673 # no URL found ! icConfigNotFoundErr = -674 # no configuration was found ! icConfigInappropriateErr = -675 # incorrect manufacturer code ICattr_no_change = -1 --- 12,25 ---- # From ictypes.h: ! icPrefNotFoundErr = -666 # preference not found (duh!) ! icPermErr = -667 # cannot set preference ! icPrefDataErr = -668 # problem with preference data ! icInternalErr = -669 # hmm, this is not good ! icTruncatedErr = -670 # more data was present than was returned ! icNoMoreWritersErr = -671 # you cannot begin a write session because someone else is already doing it */ ! icNothingToOverrideErr = -672 # no component for the override component to capture ! icNoURLErr = -673 # no URL found ! icConfigNotFoundErr = -674 # no configuration was found ! icConfigInappropriateErr = -675 # incorrect manufacturer code ICattr_no_change = -1 *************** *** 31,269 **** class ICOpaqueData: ! """An unparseable IC entry""" ! def __init__(self, data): ! self.data = data ! def __repr__(self): ! return "ICOpaqueData(%s)"%`self.data` _ICOpaqueDataType=type(ICOpaqueData('')) ! def _decode_default(data, key): ! if len(data) == 0: ! return data ! if ord(data[0]) == len(data)-1: ! # Assume Pstring ! return data[1:] ! return ICOpaqueData(data) ! ! def _decode_multistr(data, key): ! numstr = ord(data[0]) << 8 | ord(data[1]) ! rv = [] ! ptr = 2 ! for i in range(numstr): ! strlen = ord(data[ptr]) ! str = data[ptr+1:ptr+strlen+1] ! rv.append(str) ! ptr = ptr + strlen + 1 ! return rv ! def _decode_fontrecord(data, key): ! size = ord(data[0]) << 8 | ord(data[1]) ! face = ord(data[2]) ! namelen = ord(data[4]) ! return size, face, data[5:5+namelen] ! def _decode_boolean(data, key): ! return ord(data[0]) ! def _decode_text(data, key): ! return data ! def _decode_charset(data, key): ! return data[:256], data[256:] ! def _decode_appspec(data, key): ! namelen = ord(data[4]) ! return data[0:4], data[5:5+namelen] def _code_default(data, key): ! return chr(len(data)) + data ! def _code_multistr(data, key): ! numstr = len(data) ! rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff) ! for i in data: ! rv = rv + _code_default(i) ! return rv ! def _code_fontrecord(data, key): ! size, face, name = data ! return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \ ! chr(0) + _code_default(name) ! def _code_boolean(data, key): ! print 'XXXX boolean:', `data` ! return chr(data) ! def _code_text(data, key): ! return data ! def _code_charset(data, key): ! return data[0] + data[1] ! def _code_appspec(data, key): ! return data[0] + _code_default(data[1]) ! _decoder_table = { ! "ArchieAll" : (_decode_multistr , _code_multistr), ! "UMichAll" : (_decode_multistr , _code_multistr), ! "InfoMacAll" : (_decode_multistr , _code_multistr), ! "ListFont" : (_decode_fontrecord , _code_fontrecord), ! "ScreenFont" : (_decode_fontrecord , _code_fontrecord), ! "PrinterFont" : (_decode_fontrecord , _code_fontrecord), ! # "DownloadFolder" : (_decode_filespec , _code_filespec), ! "Signature": (_decode_text , _code_text), ! "Plan" : (_decode_text , _code_text), ! "MailHeaders" : (_decode_text , _code_text), ! "NewsHeaders" : (_decode_text , _code_text), ! # "Mapping" ! "CharacterSet" : (_decode_charset , _code_charset), ! "Helper\245" : (_decode_appspec , _code_appspec), ! # "Services" : (_decode_services, ????), ! "NewMailFlashIcon" : (_decode_boolean , _code_boolean), ! "NewMailDialog" : (_decode_boolean , _code_boolean), ! "NewMailPlaySound" : (_decode_boolean , _code_boolean), ! # "WebBackgroundColor" : _decode_color, ! "NoProxyDomains" : (_decode_multistr , _code_multistr), ! "UseHTTPProxy" : (_decode_boolean , _code_boolean), ! "UseGopherProxy": (_decode_boolean , _code_boolean), ! "UseFTPProxy" : (_decode_boolean , _code_boolean), ! "UsePassiveFTP" : (_decode_boolean , _code_boolean), } def _decode(data, key): ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! decoder = _decoder_table[key2][0] ! else: ! decoder = _decode_default ! return decoder(data, key) def _code(data, key): ! if type(data) == _ICOpaqueDataType: ! return data.data ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! coder = _decoder_table[key2][1] ! else: ! coder = _code_default ! return coder(data, key) ! class IC: ! def __init__(self, signature='Pyth', ic=None): ! if ic: ! self.ic = ic ! else: ! self.ic = icglue.ICStart(signature) ! if hasattr(self.ic, 'ICFindConfigFile'): ! self.ic.ICFindConfigFile() ! self.h = Res.Resource('') ! ! def keys(self): ! rv = [] ! self.ic.ICBegin(icReadOnlyPerm) ! num = self.ic.ICCountPref() ! for i in range(num): ! rv.append(self.ic.ICGetIndPref(i+1)) ! self.ic.ICEnd() ! return rv ! ! def has_key(self, key): ! return self.__contains__(key) ! ! def __contains__(self, key): ! try: ! dummy = self.ic.ICFindPrefHandle(key, self.h) ! except icglue.error: ! return 0 ! return 1 ! ! def __getitem__(self, key): ! attr = self.ic.ICFindPrefHandle(key, self.h) ! return _decode(self.h.data, key) ! ! def __setitem__(self, key, value): ! value = _code(value, key) ! self.ic.ICSetPref(key, ICattr_no_change, value) ! ! def launchurl(self, url, hint=""): ! # Work around a bug in ICLaunchURL: file:/foo does ! # not work but file:///foo does. ! if url[:6] == 'file:/' and url[6] != '/': ! url = 'file:///' + url[6:] ! self.ic.ICLaunchURL(hint, url, 0, len(url)) ! ! def parseurl(self, data, start=None, end=None, hint=""): ! if start == None: ! selStart = 0 ! selEnd = len(data) ! else: ! selStart = selEnd = start ! if end != None: ! selEnd = end ! selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) ! return self.h.data, selStart, selEnd ! ! def mapfile(self, file): ! if type(file) != type(''): ! file = file.as_tuple()[2] ! return self.ic.ICMapFilename(file) ! ! def maptypecreator(self, type, creator, filename=""): ! return self.ic.ICMapTypeCreator(type, creator, filename) ! ! def settypecreator(self, file): ! file = Carbon.File.pathname(file) ! record = self.mapfile(os.path.split(file)[1]) ! MacOS.SetCreatorAndType(file, record[2], record[1]) ! macostools.touched(fss) ! # Convenience routines _dft_ic = None def launchurl(url, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.launchurl(url, hint) ! def parseurl(data, start=None, end=None, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.parseurl(data, start, end, hint) ! def mapfile(filename): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.mapfile(filename) ! def maptypecreator(type, creator, filename=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.maptypecreator(type, creator, filename) ! def settypecreator(file): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.settypecreator(file) ! def _test(): ! ic = IC() ! for k in ic.keys(): ! try: ! v = ic[k] ! except error: ! v = '????' ! print k, '\t', v ! sys.exit(1) ! if __name__ == '__main__': ! _test() ! --- 31,269 ---- class ICOpaqueData: ! """An unparseable IC entry""" ! def __init__(self, data): ! self.data = data ! def __repr__(self): ! return "ICOpaqueData(%s)"%`self.data` _ICOpaqueDataType=type(ICOpaqueData('')) ! def _decode_default(data, key): ! if len(data) == 0: ! return data ! if ord(data[0]) == len(data)-1: ! # Assume Pstring ! return data[1:] ! return ICOpaqueData(data) ! ! def _decode_multistr(data, key): ! numstr = ord(data[0]) << 8 | ord(data[1]) ! rv = [] ! ptr = 2 ! for i in range(numstr): ! strlen = ord(data[ptr]) ! str = data[ptr+1:ptr+strlen+1] ! rv.append(str) ! ptr = ptr + strlen + 1 ! return rv ! def _decode_fontrecord(data, key): ! size = ord(data[0]) << 8 | ord(data[1]) ! face = ord(data[2]) ! namelen = ord(data[4]) ! return size, face, data[5:5+namelen] ! def _decode_boolean(data, key): ! return ord(data[0]) ! def _decode_text(data, key): ! return data ! def _decode_charset(data, key): ! return data[:256], data[256:] ! def _decode_appspec(data, key): ! namelen = ord(data[4]) ! return data[0:4], data[5:5+namelen] def _code_default(data, key): ! return chr(len(data)) + data ! def _code_multistr(data, key): ! numstr = len(data) ! rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff) ! for i in data: ! rv = rv + _code_default(i) ! return rv ! def _code_fontrecord(data, key): ! size, face, name = data ! return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \ ! chr(0) + _code_default(name) ! def _code_boolean(data, key): ! print 'XXXX boolean:', `data` ! return chr(data) ! def _code_text(data, key): ! return data ! def _code_charset(data, key): ! return data[0] + data[1] ! def _code_appspec(data, key): ! return data[0] + _code_default(data[1]) ! _decoder_table = { ! "ArchieAll" : (_decode_multistr , _code_multistr), ! "UMichAll" : (_decode_multistr , _code_multistr), ! "InfoMacAll" : (_decode_multistr , _code_multistr), ! "ListFont" : (_decode_fontrecord , _code_fontrecord), ! "ScreenFont" : (_decode_fontrecord , _code_fontrecord), ! "PrinterFont" : (_decode_fontrecord , _code_fontrecord), ! # "DownloadFolder" : (_decode_filespec , _code_filespec), ! "Signature": (_decode_text , _code_text), ! "Plan" : (_decode_text , _code_text), ! "MailHeaders" : (_decode_text , _code_text), ! "NewsHeaders" : (_decode_text , _code_text), ! # "Mapping" ! "CharacterSet" : (_decode_charset , _code_charset), ! "Helper\245" : (_decode_appspec , _code_appspec), ! # "Services" : (_decode_services, ????), ! "NewMailFlashIcon" : (_decode_boolean , _code_boolean), ! "NewMailDialog" : (_decode_boolean , _code_boolean), ! "NewMailPlaySound" : (_decode_boolean , _code_boolean), ! # "WebBackgroundColor" : _decode_color, ! "NoProxyDomains" : (_decode_multistr , _code_multistr), ! "UseHTTPProxy" : (_decode_boolean , _code_boolean), ! "UseGopherProxy": (_decode_boolean , _code_boolean), ! "UseFTPProxy" : (_decode_boolean , _code_boolean), ! "UsePassiveFTP" : (_decode_boolean , _code_boolean), } def _decode(data, key): ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! decoder = _decoder_table[key2][0] ! else: ! decoder = _decode_default ! return decoder(data, key) def _code(data, key): ! if type(data) == _ICOpaqueDataType: ! return data.data ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! coder = _decoder_table[key2][1] ! else: ! coder = _code_default ! return coder(data, key) ! class IC: ! def __init__(self, signature='Pyth', ic=None): ! if ic: ! self.ic = ic ! else: ! self.ic = icglue.ICStart(signature) ! if hasattr(self.ic, 'ICFindConfigFile'): ! self.ic.ICFindConfigFile() ! self.h = Res.Resource('') ! ! def keys(self): ! rv = [] ! self.ic.ICBegin(icReadOnlyPerm) ! num = self.ic.ICCountPref() ! for i in range(num): ! rv.append(self.ic.ICGetIndPref(i+1)) ! self.ic.ICEnd() ! return rv ! ! def has_key(self, key): ! return self.__contains__(key) ! ! def __contains__(self, key): ! try: ! dummy = self.ic.ICFindPrefHandle(key, self.h) ! except icglue.error: ! return 0 ! return 1 ! ! def __getitem__(self, key): ! attr = self.ic.ICFindPrefHandle(key, self.h) ! return _decode(self.h.data, key) ! ! def __setitem__(self, key, value): ! value = _code(value, key) ! self.ic.ICSetPref(key, ICattr_no_change, value) ! ! def launchurl(self, url, hint=""): ! # Work around a bug in ICLaunchURL: file:/foo does ! # not work but file:///foo does. ! if url[:6] == 'file:/' and url[6] != '/': ! url = 'file:///' + url[6:] ! self.ic.ICLaunchURL(hint, url, 0, len(url)) ! ! def parseurl(self, data, start=None, end=None, hint=""): ! if start == None: ! selStart = 0 ! selEnd = len(data) ! else: ! selStart = selEnd = start ! if end != None: ! selEnd = end ! selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) ! return self.h.data, selStart, selEnd ! ! def mapfile(self, file): ! if type(file) != type(''): ! file = file.as_tuple()[2] ! return self.ic.ICMapFilename(file) ! ! def maptypecreator(self, type, creator, filename=""): ! return self.ic.ICMapTypeCreator(type, creator, filename) ! ! def settypecreator(self, file): ! file = Carbon.File.pathname(file) ! record = self.mapfile(os.path.split(file)[1]) ! MacOS.SetCreatorAndType(file, record[2], record[1]) ! macostools.touched(fss) ! # Convenience routines _dft_ic = None def launchurl(url, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.launchurl(url, hint) ! def parseurl(data, start=None, end=None, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.parseurl(data, start, end, hint) ! def mapfile(filename): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.mapfile(filename) ! def maptypecreator(type, creator, filename=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.maptypecreator(type, creator, filename) ! def settypecreator(file): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.settypecreator(file) ! def _test(): ! ic = IC() ! for k in ic.keys(): ! try: ! v = ic[k] ! except error: ! v = '????' ! print k, '\t', v ! sys.exit(1) ! if __name__ == '__main__': ! _test() ! Index: macerrors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macerrors.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** macerrors.py 30 Dec 2002 22:04:20 -0000 1.1 --- macerrors.py 9 Apr 2003 13:25:43 -0000 1.2 *************** *** 1,1852 **** ! svTempDisable = -32768 #svTempDisable ! svDisabled = -32640 #Reserve range -32640 to -32768 for Apple temp disables. ! fontNotOutlineErr = -32615 #bitmap font passed to routine that does outlines only ! kURL68kNotSupportedError = -30788 #kURL68kNotSupportedError ! kURLAccessNotAvailableError = -30787 #kURLAccessNotAvailableError ! kURLInvalidConfigurationError = -30786 #kURLInvalidConfigurationError ! kURLExtensionFailureError = -30785 #kURLExtensionFailureError ! kURLFileEmptyError = -30783 #kURLFileEmptyError ! kURLInvalidCallError = -30781 #kURLInvalidCallError ! kURLUnsettablePropertyError = -30780 #kURLUnsettablePropertyError [...3675 lines suppressed...] ! ENETRESET = 52 #Network dropped connection on reset ! ECONNABORTED = 53 #Software caused connection abort ! ECONNRESET = 54 #Connection reset by peer ! ENOBUFS = 55 #No buffer space available ! EISCONN = 56 #Socket is already connected ! ENOTCONN = 57 #Socket is not connected ! ESHUTDOWN = 58 #Can't send after socket shutdown ! ETOOMANYREFS = 59 #Too many references: can't splice ! ETIMEDOUT = 60 #Operation timed out ! ECONNREFUSED = 61 #Connection refused ! ELOOP = 62 #Too many levels of symbolic links ! ENAMETOOLONG = 63 #File name too long ! EHOSTDOWN = 64 #Host is down ! EHOSTUNREACH = 65 #No route to host ! ENOTEMPTY = 66 #Directory not empty ! ELOOK = 67 #Internal mapping for kOTLookErr, don't return to client ! ENOLCK = 77 #No locks available ! ENOSYS = 78 #Function not implemented ! EILSEQ = 88 #Wide character encoding error ! EUNKNOWN = 99 #Unknown error Index: macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macfs.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** macfs.py 27 Feb 2003 23:17:59 -0000 1.9 --- macfs.py 9 Apr 2003 13:25:43 -0000 1.10 *************** *** 29,51 **** import time if time.gmtime(0)[0] == 1970: ! _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L ! def _utc2time(utc): ! t = utc[1] + _EPOCHCONVERT ! return int(t) ! def _time2utc(t): ! t = int(t) - _EPOCHCONVERT ! if t < -0x7fffffff: ! t = t + 0x10000000L ! return (0, int(t), 0) else: ! def _utc2time(utc): ! t = utc[1] ! if t < 0: ! t = t + 0x100000000L ! return t ! def _time2utc(t): ! if t > 0x7fffffff: ! t = t - 0x100000000L ! return (0, int(t), 0) # The old name of the error object: --- 29,51 ---- import time if time.gmtime(0)[0] == 1970: ! _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L ! def _utc2time(utc): ! t = utc[1] + _EPOCHCONVERT ! return int(t) ! def _time2utc(t): ! t = int(t) - _EPOCHCONVERT ! if t < -0x7fffffff: ! t = t + 0x10000000L ! return (0, int(t), 0) else: ! def _utc2time(utc): ! t = utc[1] ! if t < 0: ! t = t + 0x100000000L ! return t ! def _time2utc(t): ! if t > 0x7fffffff: ! t = t - 0x100000000L ! return (0, int(t), 0) # The old name of the error object: *************** *** 57,114 **** # class FSSpec(Carbon.File.FSSpec): ! def as_fsref(self): ! return FSRef(self) ! ! def NewAlias(self, src=None): ! return Alias(Carbon.File.NewAlias(src, self)) ! ! def GetCreatorType(self): ! finfo = self.FSpGetFInfo() ! return finfo.Creator, finfo.Type ! ! def SetCreatorType(self, ctor, tp): ! finfo = self.FSpGetFInfo() ! finfo.Creator = ctor ! finfo.Type = tp ! self.FSpSetFInfo(finfo) ! ! def GetFInfo(self): ! return self.FSpGetFInfo() ! ! def SetFInfo(self, info): ! return self.FSpSetFInfo(info) ! ! def GetDates(self): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) ! cdate = catinfo.createDate ! mdate = catinfo.contentModDate ! bdate = catinfo.backupDate ! return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) ! ! def SetDates(self, cdate, mdate, bdate): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo = Carbon.File.FSCatalogInfo( ! createDate = _time2utc(cdate), ! contentModDate = _time2utc(mdate), ! backupDate = _time2utc(bdate)) ! FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) ! class FSRef(Carbon.File.FSRef): ! def as_fsspec(self): ! return FSSpec(self) ! class Alias(Carbon.File.Alias): ! def GetInfo(self, index): ! return self.GetAliasInfo(index) ! ! def Update(self, *args): ! pass # print "Alias.Update not yet implemented" ! ! def Resolve(self, src=None): ! fss, changed = self.ResolveAlias(src) ! return FSSpec(fss), changed ! from Carbon.File import FInfo --- 57,114 ---- # class FSSpec(Carbon.File.FSSpec): ! def as_fsref(self): ! return FSRef(self) ! ! def NewAlias(self, src=None): ! return Alias(Carbon.File.NewAlias(src, self)) ! ! def GetCreatorType(self): ! finfo = self.FSpGetFInfo() ! return finfo.Creator, finfo.Type ! ! def SetCreatorType(self, ctor, tp): ! finfo = self.FSpGetFInfo() ! finfo.Creator = ctor ! finfo.Type = tp ! self.FSpSetFInfo(finfo) ! ! def GetFInfo(self): ! return self.FSpGetFInfo() ! ! def SetFInfo(self, info): ! return self.FSpSetFInfo(info) ! ! def GetDates(self): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) ! cdate = catinfo.createDate ! mdate = catinfo.contentModDate ! bdate = catinfo.backupDate ! return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) ! ! def SetDates(self, cdate, mdate, bdate): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo = Carbon.File.FSCatalogInfo( ! createDate = _time2utc(cdate), ! contentModDate = _time2utc(mdate), ! backupDate = _time2utc(bdate)) ! FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) ! class FSRef(Carbon.File.FSRef): ! def as_fsspec(self): ! return FSSpec(self) ! class Alias(Carbon.File.Alias): ! def GetInfo(self, index): ! return self.GetAliasInfo(index) ! ! def Update(self, *args): ! pass # print "Alias.Update not yet implemented" ! ! def Resolve(self, src=None): ! fss, changed = self.ResolveAlias(src) ! return FSSpec(fss), changed ! from Carbon.File import FInfo *************** *** 121,139 **** # Global functions: def ResolveAliasFile(fss, chain=1): ! fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) ! return FSSpec(fss), isdir, isalias ! def RawFSSpec(data): ! return FSSpec(rawdata=data) ! def RawAlias(data): ! return Alias(rawdata=data) ! def FindApplication(*args): ! raise NotImplementedError, "FindApplication no longer implemented" ! def NewAliasMinimalFromFullPath(path): ! return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) ! # Another global function: from Carbon.Folder import FindFolder --- 121,139 ---- # Global functions: def ResolveAliasFile(fss, chain=1): ! fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) ! return FSSpec(fss), isdir, isalias ! def RawFSSpec(data): ! return FSSpec(rawdata=data) ! def RawAlias(data): ! return Alias(rawdata=data) ! def FindApplication(*args): ! raise NotImplementedError, "FindApplication no longer implemented" ! def NewAliasMinimalFromFullPath(path): ! return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) ! # Another global function: from Carbon.Folder import FindFolder *************** *** 146,198 **** def StandardGetFile(*typelist): ! """Ask for an input file, optionally specifying 4-char file types that are ! allowable""" ! return PromptGetFile('', *typelist) ! def PromptGetFile(prompt, *typelist): ! """Ask for an input file giving the user a prompt message. Optionally you can ! specifying 4-char file types that are allowable""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if not typelist: ! typelist = None ! fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, ! typeList=typelist, defaultLocation=_handleSetFolder()) ! return fss, not fss is None def StandardPutFile(prompt, default=None): ! """Ask the user for an output file, with a prompt. Optionally you cn supply a ! default output filename""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, ! savedFileName=default, defaultLocation=_handleSetFolder()) ! return fss, not fss is None ! def SetFolder(folder): ! global _curfolder ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if _curfolder: ! rv = FSSpec(_curfolder) ! else: ! rv = None ! _curfolder = folder ! return rv ! def _handleSetFolder(): ! global _curfolder ! rv = _curfolder ! _curfolder = None ! return rv ! def GetDirectory(prompt=None): ! """Ask the user to select a folder. Optionally you can give a prompt.""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, ! defaultLocation=_handleSetFolder()) ! return fss, not fss is None --- 146,198 ---- def StandardGetFile(*typelist): ! """Ask for an input file, optionally specifying 4-char file types that are ! allowable""" ! return PromptGetFile('', *typelist) ! def PromptGetFile(prompt, *typelist): ! """Ask for an input file giving the user a prompt message. Optionally you can ! specifying 4-char file types that are allowable""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if not typelist: ! typelist = None ! fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, ! typeList=typelist, defaultLocation=_handleSetFolder()) ! return fss, not fss is None def StandardPutFile(prompt, default=None): ! """Ask the user for an output file, with a prompt. Optionally you cn supply a ! default output filename""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, ! savedFileName=default, defaultLocation=_handleSetFolder()) ! return fss, not fss is None ! def SetFolder(folder): ! global _curfolder ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if _curfolder: ! rv = FSSpec(_curfolder) ! else: ! rv = None ! _curfolder = folder ! return rv ! def _handleSetFolder(): ! global _curfolder ! rv = _curfolder ! _curfolder = None ! return rv ! def GetDirectory(prompt=None): ! """Ask the user to select a folder. Optionally you can give a prompt.""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, ! defaultLocation=_handleSetFolder()) ! return fss, not fss is None Index: macresource.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macresource.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** macresource.py 25 Feb 2003 23:02:03 -0000 1.4 --- macresource.py 9 Apr 2003 13:25:43 -0000 1.5 *************** *** 11,146 **** def need(restype, resid, filename=None, modname=None): ! """Open a resource file, if needed. restype and resid ! are required parameters, and identify the resource for which to test. If it ! is available we are done. If it is not available we look for a file filename ! (default: modname with .rsrc appended) either in the same folder as ! where modname was loaded from, or otherwise across sys.path. ! ! Returns the refno of the resource file opened (or None)""" ! if modname is None and filename is None: ! raise ArgumentError, "Either filename or modname argument (or both) must be given" ! ! if type(resid) is type(1): ! try: ! h = Res.GetResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! else: ! try: ! h = Res.GetNamedResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! ! # Construct a filename if we don't have one ! if not filename: ! if '.' in modname: ! filename = modname.split('.')[-1] + '.rsrc' ! else: ! filename = modname + '.rsrc' ! ! # Now create a list of folders to search ! searchdirs = [] ! if modname == '__main__': ! # If we're main we look in the current directory ! searchdirs = [os.curdir] ! if sys.modules.has_key(modname): ! mod = sys.modules[modname] ! if hasattr(mod, '__file__'): ! searchdirs = [os.path.dirname(mod.__file__)] ! searchdirs.extend(sys.path) ! ! # And look for the file ! for dir in searchdirs: ! pathname = os.path.join(dir, filename) ! if os.path.exists(pathname): ! break ! else: ! raise ResourceFileNotFoundError, filename ! ! refno = open_pathname(pathname) ! ! # And check that the resource exists now ! if type(resid) is type(1): ! h = Res.GetResource(restype, resid) ! else: ! h = Res.GetNamedResource(restype, resid) ! return refno ! def open_pathname(pathname, verbose=0): ! """Open a resource file given by pathname, possibly decoding an ! AppleSingle file""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! else: ! raise ! return refno ! def resource_pathname(pathname, verbose=0): ! """Return the pathname for a resource file (either DF or RF based). ! If the pathname given already refers to such a file simply return it, ! otherwise first decode it.""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! Res.CloseResFile(refno) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! else: ! raise ! return pathname ! def open_error_resource(): ! """Open the resource file containing the error code to error message ! mapping.""" ! need('Estr', 1, filename="errors.rsrc", modname=__name__) ! def _decode(pathname, verbose=0): ! # Decode an AppleSingle resource file, return the new pathname. ! newpathname = pathname + '.df.rsrc' ! if os.path.exists(newpathname) and \ ! os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: ! return newpathname ! if hasattr(os, 'access') and not \ ! os.access(os.path.dirname(pathname), os.W_OK|os.X_OK): ! # The destination directory isn't writeable. Create the file in ! # a temporary directory ! import tempfile ! fd, newpathname = tempfile.mkstemp(".rsrc") ! if verbose: ! print 'Decoding', pathname, 'to', newpathname ! import applesingle ! applesingle.decode(pathname, newpathname, resonly=1) ! return newpathname --- 11,146 ---- def need(restype, resid, filename=None, modname=None): ! """Open a resource file, if needed. restype and resid ! are required parameters, and identify the resource for which to test. If it ! is available we are done. If it is not available we look for a file filename ! (default: modname with .rsrc appended) either in the same folder as ! where modname was loaded from, or otherwise across sys.path. ! ! Returns the refno of the resource file opened (or None)""" ! if modname is None and filename is None: ! raise ArgumentError, "Either filename or modname argument (or both) must be given" ! ! if type(resid) is type(1): ! try: ! h = Res.GetResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! else: ! try: ! h = Res.GetNamedResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! ! # Construct a filename if we don't have one ! if not filename: ! if '.' in modname: ! filename = modname.split('.')[-1] + '.rsrc' ! else: ! filename = modname + '.rsrc' ! ! # Now create a list of folders to search ! searchdirs = [] ! if modname == '__main__': ! # If we're main we look in the current directory ! searchdirs = [os.curdir] ! if sys.modules.has_key(modname): ! mod = sys.modules[modname] ! if hasattr(mod, '__file__'): ! searchdirs = [os.path.dirname(mod.__file__)] ! searchdirs.extend(sys.path) ! ! # And look for the file ! for dir in searchdirs: ! pathname = os.path.join(dir, filename) ! if os.path.exists(pathname): ! break ! else: ! raise ResourceFileNotFoundError, filename ! ! refno = open_pathname(pathname) ! ! # And check that the resource exists now ! if type(resid) is type(1): ! h = Res.GetResource(restype, resid) ! else: ! h = Res.GetNamedResource(restype, resid) ! return refno ! def open_pathname(pathname, verbose=0): ! """Open a resource file given by pathname, possibly decoding an ! AppleSingle file""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! else: ! raise ! return refno ! def resource_pathname(pathname, verbose=0): ! """Return the pathname for a resource file (either DF or RF based). ! If the pathname given already refers to such a file simply return it, ! otherwise first decode it.""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! Res.CloseResFile(refno) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! else: ! raise ! return pathname ! def open_error_resource(): ! """Open the resource file containing the error code to error message ! mapping.""" ! need('Estr', 1, filename="errors.rsrc", modname=__name__) ! def _decode(pathname, verbose=0): ! # Decode an AppleSingle resource file, return the new pathname. ! newpathname = pathname + '.df.rsrc' ! if os.path.exists(newpathname) and \ ! os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: ! return newpathname ! if hasattr(os, 'access') and not \ ! os.access(os.path.dirname(pathname), os.W_OK|os.X_OK): ! # The destination directory isn't writeable. Create the file in ! # a temporary directory ! import tempfile ! fd, newpathname = tempfile.mkstemp(".rsrc") ! if verbose: ! print 'Decoding', pathname, 'to', newpathname ! import applesingle ! applesingle.decode(pathname, newpathname, resonly=1) ! return newpathname Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pimp.py 17 Mar 2003 10:54:41 -0000 1.14 --- pimp.py 9 Apr 2003 13:25:43 -0000 1.15 *************** *** 44,798 **** ARCHIVE_FORMATS = [ ! (".tar.Z", "zcat \"%s\" | tar -xf -"), ! (".taz", "zcat \"%s\" | tar -xf -"), ! (".tar.gz", "zcat \"%s\" | tar -xf -"), ! (".tgz", "zcat \"%s\" | tar -xf -"), ! (".tar.bz", "bzcat \"%s\" | tar -xf -"), ! (".zip", "unzip \"%s\""), ] [...1481 lines suppressed...] ! _help() ! mode = 'list' ! if o == '-d': ! if mode: ! _help() ! mode = 'dump' ! if o == '-i': ! mode = 'install' ! if o == '-f': ! force = 1 ! if o == '-v': ! verbose = 1 ! if not mode: ! _help() ! _run(mode, verbose, force, args) ! if __name__ == '__main__': ! main() ! ! Index: plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/plistlib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plistlib.py 30 Dec 2002 22:04:20 -0000 1.1 --- plistlib.py 9 Apr 2003 13:25:43 -0000 1.2 *************** *** 34,60 **** Generate Plist example: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! pl.write(fileName) Parse Plist example: ! pl = Plist.fromFile(pathOrFile) ! print pl.aKey --- 34,60 ---- Generate Plist example: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! pl.write(fileName) Parse Plist example: ! pl = Plist.fromFile(pathOrFile) ! print pl.aKey *************** *** 72,109 **** class DumbXMLWriter: ! def __init__(self, file): ! self.file = file ! self.stack = [] ! self.indentLevel = 0 ! def beginElement(self, element): ! self.stack.append(element) ! self.writeln("<%s>" % element) ! self.indentLevel += 1 ! def endElement(self, element): ! assert self.indentLevel > 0 ! assert self.stack.pop() == element ! self.indentLevel -= 1 ! self.writeln("" % element) ! def simpleElement(self, element, value=None): ! if value: ! value = _encode(value) ! self.writeln("<%s>%s" % (element, value, element)) ! else: ! self.writeln("<%s/>" % element) ! def writeln(self, line): ! if line: ! self.file.write(self.indentLevel * INDENT + line + "\n") ! else: ! self.file.write("\n") def _encode(text): ! text = text.replace("&", "&") ! text = text.replace("<", "<") ! return text.encode("utf-8") --- 72,109 ---- class DumbXMLWriter: ! def __init__(self, file): ! self.file = file ! self.stack = [] ! self.indentLevel = 0 ! def beginElement(self, element): ! self.stack.append(element) ! self.writeln("<%s>" % element) ! self.indentLevel += 1 ! def endElement(self, element): ! assert self.indentLevel > 0 ! assert self.stack.pop() == element ! self.indentLevel -= 1 ! self.writeln("" % element) ! def simpleElement(self, element, value=None): ! if value: ! value = _encode(value) ! self.writeln("<%s>%s" % (element, value, element)) ! else: ! self.writeln("<%s/>" % element) ! def writeln(self, line): ! if line: ! self.file.write(self.indentLevel * INDENT + line + "\n") ! else: ! self.file.write("\n") def _encode(text): ! text = text.replace("&", "&") ! text = text.replace("<", "<") ! return text.encode("utf-8") *************** *** 115,375 **** class PlistWriter(DumbXMLWriter): ! def __init__(self, file): ! file.write(PLISTHEADER) ! DumbXMLWriter.__init__(self, file) ! def writeValue(self, value): ! if isinstance(value, (str, unicode)): ! self.simpleElement("string", value) ! elif isinstance(value, bool): ! # must switch for bool before int, as bool is a ! # subclass of int... ! if value: ! self.simpleElement("true") ! else: ! self.simpleElement("false") ! elif isinstance(value, int): ! self.simpleElement("integer", str(value)) ! elif isinstance(value, float): ! # should perhaps use repr() for better precision? ! self.simpleElement("real", str(value)) ! elif isinstance(value, (dict, Dict)): ! self.writeDict(value) ! elif isinstance(value, Data): ! self.writeData(value) ! elif isinstance(value, Date): ! self.simpleElement("date", value.toString()) ! elif isinstance(value, (tuple, list)): ! self.writeArray(value) ! else: ! assert 0, "unsuported type: %s" % type(value) ! def writeData(self, data): ! self.beginElement("data") ! for line in data.asBase64().split("\n"): ! if line: ! self.writeln(line) ! self.endElement("data") ! def writeDict(self, d): ! self.beginElement("dict") ! items = d.items() ! items.sort() ! for key, value in items: ! assert isinstance(key, (str, unicode)), "keys must be strings" ! self.simpleElement("key", key) ! self.writeValue(value) ! self.endElement("dict") ! def writeArray(self, array): ! self.beginElement("array") ! for value in array: ! self.writeValue(value) ! self.endElement("array") class Dict: ! """Dict wrapper for convenient access of values through attributes.""" ! def __init__(self, **kwargs): ! self.__dict__.update(kwargs) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.__dict__, other.__dict__) ! elif isinstance(other, dict): ! return cmp(self.__dict__, other) ! else: ! return cmp(id(self), id(other)) ! def __str__(self): ! return "%s(**%s)" % (self.__class__.__name__, self.__dict__) ! __repr__ = __str__ ! def copy(self): ! return self.__class__(**self.__dict__) ! def __getattr__(self, attr): ! """Delegate everything else to the dict object.""" ! return getattr(self.__dict__, attr) class Plist(Dict): ! """The main Plist object. Basically a dict (the toplevel object ! of a plist is a dict) with two additional methods to read from ! and write to files. ! """ ! def fromFile(cls, pathOrFile): ! didOpen = 0 ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile) ! didOpen = 1 ! p = PlistParser() ! plist = p.parse(pathOrFile) ! if didOpen: ! pathOrFile.close() ! return plist ! fromFile = classmethod(fromFile) ! def write(self, pathOrFile): ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile, "w") ! didOpen = 1 ! else: ! didOpen = 0 ! writer = PlistWriter(pathOrFile) ! writer.writeln("") ! writer.writeDict(self.__dict__) ! writer.writeln("") ! if didOpen: ! pathOrFile.close() class Data: ! """Wrapper for binary data.""" ! def __init__(self, data): ! self.data = data ! def fromBase64(cls, data): ! import base64 ! return cls(base64.decodestring(data)) ! fromBase64 = classmethod(fromBase64) ! def asBase64(self): ! import base64 ! return base64.encodestring(self.data) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.data, other.data) ! elif isinstance(other, str): ! return cmp(self.data, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.data)) class Date: ! """Primitive date wrapper, uses time floats internally, is agnostic ! about time zones. ! """ ! def __init__(self, date): ! if isinstance(date, str): ! from xml.utils.iso8601 import parse ! date = parse(date) ! self.date = date ! def toString(self): ! from xml.utils.iso8601 import tostring ! return tostring(self.date) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.date, other.date) ! elif isinstance(other, (int, float)): ! return cmp(self.date, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.toString())) class PlistParser: ! def __init__(self): ! self.stack = [] ! self.currentKey = None ! self.root = None ! def parse(self, file): ! from xml.parsers.expat import ParserCreate ! parser = ParserCreate() ! parser.StartElementHandler = self.handleBeginElement ! parser.EndElementHandler = self.handleEndElement ! parser.CharacterDataHandler = self.handleData ! parser.ParseFile(file) ! return self.root ! def handleBeginElement(self, element, attrs): ! self.data = [] ! handler = getattr(self, "begin_" + element, None) ! if handler is not None: ! handler(attrs) ! def handleEndElement(self, element): ! handler = getattr(self, "end_" + element, None) ! if handler is not None: ! handler() ! def handleData(self, data): ! self.data.append(data) ! def addObject(self, value): ! if self.currentKey is not None: ! self.stack[-1][self.currentKey] = value ! self.currentKey = None ! elif not self.stack: ! # this is the root object ! assert self.root is value ! else: ! self.stack[-1].append(value) ! def getData(self): ! data = "".join(self.data) ! try: ! data = data.encode("ascii") ! except UnicodeError: ! pass ! self.data = [] ! return data ! # element handlers ! def begin_dict(self, attrs): ! if self.root is None: ! self.root = d = Plist() ! else: ! d = Dict() ! self.addObject(d) ! self.stack.append(d) ! def end_dict(self): ! self.stack.pop() ! def end_key(self): ! self.currentKey = self.getData() ! def begin_array(self, attrs): ! a = [] ! self.addObject(a) ! self.stack.append(a) ! def end_array(self): ! self.stack.pop() ! def end_true(self): ! self.addObject(True) ! def end_false(self): ! self.addObject(False) ! def end_integer(self): ! self.addObject(int(self.getData())) ! def end_real(self): ! self.addObject(float(self.getData())) ! def end_string(self): ! self.addObject(self.getData()) ! def end_data(self): ! self.addObject(Data.fromBase64(self.getData())) ! def end_date(self): ! self.addObject(Date(self.getData())) --- 115,375 ---- class PlistWriter(DumbXMLWriter): ! def __init__(self, file): ! file.write(PLISTHEADER) ! DumbXMLWriter.__init__(self, file) ! def writeValue(self, value): ! if isinstance(value, (str, unicode)): ! self.simpleElement("string", value) ! elif isinstance(value, bool): ! # must switch for bool before int, as bool is a ! # subclass of int... ! if value: ! self.simpleElement("true") ! else: ! self.simpleElement("false") ! elif isinstance(value, int): ! self.simpleElement("integer", str(value)) ! elif isinstance(value, float): ! # should perhaps use repr() for better precision? ! self.simpleElement("real", str(value)) ! elif isinstance(value, (dict, Dict)): ! self.writeDict(value) ! elif isinstance(value, Data): ! self.writeData(value) ! elif isinstance(value, Date): ! self.simpleElement("date", value.toString()) ! elif isinstance(value, (tuple, list)): ! self.writeArray(value) ! else: ! assert 0, "unsuported type: %s" % type(value) ! def writeData(self, data): ! self.beginElement("data") ! for line in data.asBase64().split("\n"): ! if line: ! self.writeln(line) ! self.endElement("data") ! def writeDict(self, d): ! self.beginElement("dict") ! items = d.items() ! items.sort() ! for key, value in items: ! assert isinstance(key, (str, unicode)), "keys must be strings" ! self.simpleElement("key", key) ! self.writeValue(value) ! self.endElement("dict") ! def writeArray(self, array): ! self.beginElement("array") ! for value in array: ! self.writeValue(value) ! self.endElement("array") class Dict: ! """Dict wrapper for convenient access of values through attributes.""" ! def __init__(self, **kwargs): ! self.__dict__.update(kwargs) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.__dict__, other.__dict__) ! elif isinstance(other, dict): ! return cmp(self.__dict__, other) ! else: ! return cmp(id(self), id(other)) ! def __str__(self): ! return "%s(**%s)" % (self.__class__.__name__, self.__dict__) ! __repr__ = __str__ ! def copy(self): ! return self.__class__(**self.__dict__) ! def __getattr__(self, attr): ! """Delegate everything else to the dict object.""" ! return getattr(self.__dict__, attr) class Plist(Dict): ! """The main Plist object. Basically a dict (the toplevel object ! of a plist is a dict) with two additional methods to read from ! and write to files. ! """ ! def fromFile(cls, pathOrFile): ! didOpen = 0 ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile) ! didOpen = 1 ! p = PlistParser() ! plist = p.parse(pathOrFile) ! if didOpen: ! pathOrFile.close() ! return plist ! fromFile = classmethod(fromFile) ! def write(self, pathOrFile): ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile, "w") ! didOpen = 1 ! else: ! didOpen = 0 ! writer = PlistWriter(pathOrFile) ! writer.writeln("") ! writer.writeDict(self.__dict__) ! writer.writeln("") ! if didOpen: ! pathOrFile.close() class Data: ! """Wrapper for binary data.""" ! def __init__(self, data): ! self.data = data ! def fromBase64(cls, data): ! import base64 ! return cls(base64.decodestring(data)) ! fromBase64 = classmethod(fromBase64) ! def asBase64(self): ! import base64 ! return base64.encodestring(self.data) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.data, other.data) ! elif isinstance(other, str): ! return cmp(self.data, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.data)) class Date: ! """Primitive date wrapper, uses time floats internally, is agnostic ! about time zones. ! """ ! def __init__(self, date): ! if isinstance(date, str): ! from xml.utils.iso8601 import parse ! date = parse(date) ! self.date = date ! def toString(self): ! from xml.utils.iso8601 import tostring ! return tostring(self.date) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.date, other.date) ! elif isinstance(other, (int, float)): ! return cmp(self.date, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.toString())) class PlistParser: ! def __init__(self): ! self.stack = [] ! self.currentKey = None ! self.root = None ! def parse(self, file): ! from xml.parsers.expat import ParserCreate ! parser = ParserCreate() ! parser.StartElementHandler = self.handleBeginElement ! parser.EndElementHandler = self.handleEndElement ! parser.CharacterDataHandler = self.handleData ! parser.ParseFile(file) ! return self.root ! def handleBeginElement(self, element, attrs): ! self.data = [] ! handler = getattr(self, "begin_" + element, None) ! if handler is not None: ! handler(attrs) ! def handleEndElement(self, element): ! handler = getattr(self, "end_" + element, None) ! if handler is not None: ! handler() ! def handleData(self, data): ! self.data.append(data) ! def addObject(self, value): ! if self.currentKey is not None: ! self.stack[-1][self.currentKey] = value ! self.currentKey = None ! elif not self.stack: ! # this is the root object ! assert self.root is value ! else: ! self.stack[-1].append(value) ! def getData(self): ! data = "".join(self.data) ! try: ! data = data.encode("ascii") ! except UnicodeError: ! pass ! self.data = [] ! return data ! # element handlers ! def begin_dict(self, attrs): ! if self.root is None: ! self.root = d = Plist() ! else: ! d = Dict() ! self.addObject(d) ! self.stack.append(d) ! def end_dict(self): ! self.stack.pop() ! def end_key(self): ! self.currentKey = self.getData() ! def begin_array(self, attrs): ! a = [] ! self.addObject(a) ! self.stack.append(a) ! def end_array(self): ! self.stack.pop() ! def end_true(self): ! self.addObject(True) ! def end_false(self): ! self.addObject(False) ! def end_integer(self): ! self.addObject(int(self.getData())) ! def end_real(self): ! self.addObject(float(self.getData())) ! def end_string(self): ! self.addObject(self.getData()) ! def end_data(self): ! self.addObject(Data.fromBase64(self.getData())) ! def end_date(self): ! self.addObject(Date(self.getData())) *************** *** 377,436 **** import sys if sys.version_info[:2] < (2, 3): ! # Python 2.2 and earlier: no booleans ! # Python 2.2.x: booleans are ints ! class bool(int): ! """Imitation of the Python 2.3 bool object.""" ! def __new__(cls, value): ! return int.__new__(cls, not not value) ! def __repr__(self): ! if self: ! return "True" ! else: ! return "False" ! True = bool(1) ! False = bool(0) else: ! # Bind the boolean builtins to local names ! True = True ! False = False ! bool = bool if __name__ == "__main__": ! from StringIO import StringIO ! import time ! if len(sys.argv) == 1: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! elif len(sys.argv) == 2: ! pl = Plist.fromFile(sys.argv[1]) ! else: ! print "Too many arguments: at most 1 plist file can be given." ! sys.exit(1) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! f = StringIO() ! pl.write(f) ! xml = f.getvalue() ! print xml ! f.seek(0) ! pl2 = Plist.fromFile(f) ! assert pl == pl2 ! f = StringIO() ! pl2.write(f) ! assert xml == f.getvalue() ! #print repr(pl2) --- 377,436 ---- import sys if sys.version_info[:2] < (2, 3): ! # Python 2.2 and earlier: no booleans ! # Python 2.2.x: booleans are ints ! class bool(int): ! """Imitation of the Python 2.3 bool object.""" ! def __new__(cls, value): ! return int.__new__(cls, not not value) ! def __repr__(self): ! if self: ! return "True" ! else: ! return "False" ! True = bool(1) ! False = bool(0) else: ! # Bind the boolean builtins to local names ! True = True ! False = False ! bool = bool if __name__ == "__main__": ! from StringIO import StringIO ! import time ! if len(sys.argv) == 1: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! elif len(sys.argv) == 2: ! pl = Plist.fromFile(sys.argv[1]) ! else: ! print "Too many arguments: at most 1 plist file can be given." ! sys.exit(1) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! f = StringIO() ! pl.write(f) ! xml = f.getvalue() ! print xml ! f.seek(0) ! pl2 = Plist.fromFile(f) ! assert pl == pl2 ! f = StringIO() ! pl2.write(f) ! assert xml == f.getvalue() ! #print repr(pl2) Index: videoreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/videoreader.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoreader.py 4 Feb 2003 15:36:42 -0000 1.2 --- videoreader.py 9 Apr 2003 13:25:43 -0000 1.3 *************** *** 14,292 **** from Carbon import Res try: ! import MediaDescr except ImportError: ! def _audiodescr(data): ! return None else: ! def _audiodescr(data): ! return MediaDescr.SoundDescription.decode(data) try: ! from imgformat import macrgb except ImportError: ! macrgb = "Macintosh RGB format" import os # import audio.format class VideoFormat: ! def __init__(self, name, descr, width, height, format): ! self.__name = name ! self.__descr = descr ! self.__width = width ! self.__height = height ! self.__format = format ! ! def getname(self): ! return self.__name ! ! def getdescr(self): ! return self.__descr ! ! def getsize(self): ! return self.__width, self.__height ! ! def getformat(self): ! return self.__format ! class _Reader: ! def __init__(self, path): ! fd = Qt.OpenMovieFile(path, 0) ! self.movie, d1, d2 = Qt.NewMovieFromFile(fd, 0, 0) ! self.movietimescale = self.movie.GetMovieTimeScale() ! try: ! self.audiotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.AudioMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.audiomedia = self.audiotrack.GetTrackMedia() ! except Qt.Error: ! self.audiotrack = self.audiomedia = None ! self.audiodescr = {} ! else: ! handle = Res.Handle('') ! n = self.audiomedia.GetMediaSampleDescriptionCount() ! self.audiomedia.GetMediaSampleDescription(1, handle) ! self.audiodescr = _audiodescr(handle.data) ! self.audiotimescale = self.audiomedia.GetMediaTimeScale() ! del handle ! ! try: ! self.videotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.videomedia = self.videotrack.GetTrackMedia() ! except Qt.Error: ! self.videotrack = self.videomedia = self.videotimescale = None ! if self.videotrack: ! self.videotimescale = self.videomedia.GetMediaTimeScale() ! x0, y0, x1, y1 = self.movie.GetMovieBox() ! self.videodescr = {'width':(x1-x0), 'height':(y1-y0)} ! self._initgworld() ! self.videocurtime = None ! self.audiocurtime = None ! ! def __del__(self): ! self.audiomedia = None ! self.audiotrack = None ! self.videomedia = None ! self.videotrack = None ! self.movie = None ! ! def _initgworld(self): ! old_port, old_dev = Qdoffs.GetGWorld() ! try: ! movie_w = self.videodescr['width'] ! movie_h = self.videodescr['height'] ! movie_rect = (0, 0, movie_w, movie_h) ! self.gworld = Qdoffs.NewGWorld(32, movie_rect, None, None, QDOffscreen.keepLocal) ! self.pixmap = self.gworld.GetGWorldPixMap() ! Qdoffs.LockPixels(self.pixmap) ! Qdoffs.SetGWorld(self.gworld.as_GrafPtr(), None) ! Qd.EraseRect(movie_rect) ! self.movie.SetMovieGWorld(self.gworld.as_GrafPtr(), None) ! self.movie.SetMovieBox(movie_rect) ! self.movie.SetMovieActive(1) ! self.movie.MoviesTask(0) ! self.movie.SetMoviePlayHints(QuickTime.hintsHighQuality, QuickTime.hintsHighQuality) ! # XXXX framerate ! finally: ! Qdoffs.SetGWorld(old_port, old_dev) ! ! def _gettrackduration_ms(self, track): ! tracktime = track.GetTrackDuration() ! return self._movietime_to_ms(tracktime) ! ! def _movietime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000) ! return value ! ! def _videotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000) ! return value ! ! def _audiotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000) ! return value ! ! def _videotime_to_movietime(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), ! self.movietimescale) ! return value ! ! def HasAudio(self): ! return not self.audiotrack is None ! ! def HasVideo(self): ! return not self.videotrack is None ! ! def GetAudioDuration(self): ! if not self.audiotrack: ! return 0 ! return self._gettrackduration_ms(self.audiotrack) ! def GetVideoDuration(self): ! if not self.videotrack: ! return 0 ! return self._gettrackduration_ms(self.videotrack) ! ! def GetAudioFormat(self): ! if not self.audiodescr: ! return None, None, None, None, None ! bps = self.audiodescr['sampleSize'] ! nch = self.audiodescr['numChannels'] ! if nch == 1: ! channels = ['mono'] ! elif nch == 2: ! channels = ['left', 'right'] ! else: ! channels = map(lambda x: str(x+1), range(nch)) ! if bps % 8: ! # Funny bits-per sample. We pretend not to understand ! blocksize = 0 ! fpb = 0 ! else: ! # QuickTime is easy (for as far as we support it): samples are always a whole ! # number of bytes, so frames are nchannels*samplesize, and there's one frame per block. ! blocksize = (bps/8)*nch ! fpb = 1 ! if self.audiodescr['dataFormat'] == 'raw ': ! encoding = 'linear-excess' ! elif self.audiodescr['dataFormat'] == 'twos': ! encoding = 'linear-signed' ! else: ! encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat'] ! ## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', ! ## channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps) ! return channels, encoding, blocksize, fpb, bps ! ! def GetAudioFrameRate(self): ! if not self.audiodescr: ! return None ! return int(self.audiodescr['sampleRate']) ! ! def GetVideoFormat(self): ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb) ! ! def GetVideoFrameRate(self): ! tv = self.videocurtime ! if tv == None: ! tv = 0 ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) ! dur = self._videotime_to_ms(dur) ! return int((1000.0/dur)+0.5) ! ! def ReadAudio(self, nframes, time=None): ! if not time is None: ! self.audiocurtime = time ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! if self.audiocurtime == None: ! self.audiocurtime = 0 ! tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0) ! if tv < 0 or (self.audiocurtime and tv < self.audiocurtime): ! return self._audiotime_to_ms(self.audiocurtime), None ! h = Res.Handle('') ! desc_h = Res.Handle('') ! size, actualtime, sampleduration, desc_index, actualcount, flags = \ ! self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes) ! self.audiocurtime = actualtime + actualcount*sampleduration ! return self._audiotime_to_ms(actualtime), h.data ! ! def ReadVideo(self, time=None): ! if not time is None: ! self.videocurtime = time ! flags = QuickTime.nextTimeStep ! if self.videocurtime == None: ! flags = flags | QuickTime.nextTimeEdgeOK ! self.videocurtime = 0 ! tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0) ! if tv < 0 or (self.videocurtime and tv <= self.videocurtime): ! return self._videotime_to_ms(self.videocurtime), None ! self.videocurtime = tv ! moviecurtime = self._videotime_to_movietime(self.videocurtime) ! self.movie.SetMovieTimeValue(moviecurtime) ! self.movie.MoviesTask(0) ! return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent() ! ! def _getpixmapcontent(self): ! """Shuffle the offscreen PixMap data, because it may have funny stride values""" ! rowbytes = Qdoffs.GetPixRowBytes(self.pixmap) ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! start = 0 ! rv = '' ! for i in range(height): ! nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) ! start = start + rowbytes ! rv = rv + nextline ! return rv def reader(url): ! try: ! rdr = _Reader(url) ! except IOError: ! return None ! return rdr def _test(): ! import EasyDialogs ! try: ! import img ! except ImportError: ! img = None ! import MacOS ! Qt.EnterMovies() ! path = EasyDialogs.AskFileForOpen(message='Video to convert') ! if not path: sys.exit(0) ! rdr = reader(path) ! if not rdr: ! sys.exit(1) ! dstdir = EasyDialogs.AskFileForSave(message='Name for output folder') ! if not dstdir: sys.exit(0) ! num = 0 ! os.mkdir(dstdir) ! videofmt = rdr.GetVideoFormat() ! imgfmt = videofmt.getformat() ! imgw, imgh = videofmt.getsize() ! timestamp, data = rdr.ReadVideo() ! while data: ! fname = 'frame%04.4d.jpg'%num ! num = num+1 ! pname = os.path.join(dstdir, fname) ! if not img: print 'Not', ! print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) ! if img: ! wrt = img.writer(imgfmt, pname) ! wrt.width = imgw ! wrt.height = imgh ! wrt.write(data) ! timestamp, data = rdr.ReadVideo() ! MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') ! if num > 20: ! print 'stopping at 20 frames so your disk does not fill up:-)' ! break ! print 'Total frames:', num ! if __name__ == '__main__': ! _test() ! sys.exit(1) ! --- 14,292 ---- from Carbon import Res try: ! import MediaDescr except ImportError: ! def _audiodescr(data): ! return None else: ! def _audiodescr(data): ! return MediaDescr.SoundDescription.decode(data) try: ! from imgformat import macrgb except ImportError: ! macrgb = "Macintosh RGB format" import os # import audio.format class VideoFormat: ! def __init__(self, name, descr, width, height, format): ! self.__name = name ! self.__descr = descr ! self.__width = width ! self.__height = height ! self.__format = format ! ! def getname(self): ! return self.__name ! ! def getdescr(self): ! return self.__descr ! ! def getsize(self): ! return self.__width, self.__height ! ! def getformat(self): ! return self.__format ! class _Reader: ! def __init__(self, path): ! fd = Qt.OpenMovieFile(path, 0) ! self.movie, d1, d2 = Qt.NewMovieFromFile(fd, 0, 0) ! self.movietimescale = self.movie.GetMovieTimeScale() ! try: ! self.audiotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.AudioMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.audiomedia = self.audiotrack.GetTrackMedia() ! except Qt.Error: ! self.audiotrack = self.audiomedia = None ! self.audiodescr = {} ! else: ! handle = Res.Handle('') ! n = self.audiomedia.GetMediaSampleDescriptionCount() ! self.audiomedia.GetMediaSampleDescription(1, handle) ! self.audiodescr = _audiodescr(handle.data) ! self.audiotimescale = self.audiomedia.GetMediaTimeScale() ! del handle ! ! try: ! self.videotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.videomedia = self.videotrack.GetTrackMedia() ! except Qt.Error: ! self.videotrack = self.videomedia = self.videotimescale = None ! if self.videotrack: ! self.videotimescale = self.videomedia.GetMediaTimeScale() ! x0, y0, x1, y1 = self.movie.GetMovieBox() ! self.videodescr = {'width':(x1-x0), 'height':(y1-y0)} ! self._initgworld() ! self.videocurtime = None ! self.audiocurtime = None ! ! def __del__(self): ! self.audiomedia = None ! self.audiotrack = None ! self.videomedia = None ! self.videotrack = None ! self.movie = None ! ! def _initgworld(self): ! old_port, old_dev = Qdoffs.GetGWorld() ! try: ! movie_w = self.videodescr['width'] ! movie_h = self.videodescr['height'] ! movie_rect = (0, 0, movie_w, movie_h) ! self.gworld = Qdoffs.NewGWorld(32, movie_rect, None, None, QDOffscreen.keepLocal) ! self.pixmap = self.gworld.GetGWorldPixMap() ! Qdoffs.LockPixels(self.pixmap) ! Qdoffs.SetGWorld(self.gworld.as_GrafPtr(), None) ! Qd.EraseRect(movie_rect) ! self.movie.SetMovieGWorld(self.gworld.as_GrafPtr(), None) ! self.movie.SetMovieBox(movie_rect) ! self.movie.SetMovieActive(1) ! self.movie.MoviesTask(0) ! self.movie.SetMoviePlayHints(QuickTime.hintsHighQuality, QuickTime.hintsHighQuality) ! # XXXX framerate ! finally: ! Qdoffs.SetGWorld(old_port, old_dev) ! ! def _gettrackduration_ms(self, track): ! tracktime = track.GetTrackDuration() ! return self._movietime_to_ms(tracktime) ! ! def _movietime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000) ! return value ! ! def _videotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000) ! return value ! ! def _audiotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000) ! return value ! ! def _videotime_to_movietime(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), ! self.movietimescale) ! return value ! ! def HasAudio(self): ! return not self.audiotrack is None ! ! def HasVideo(self): ! return not self.videotrack is None ! ! def GetAudioDuration(self): ! if not self.audiotrack: ! return 0 ! return self._gettrackduration_ms(self.audiotrack) ! def GetVideoDuration(self): ! if not self.videotrack: ! return 0 ! return self._gettrackduration_ms(self.videotrack) ! ! def GetAudioFormat(self): ! if not self.audiodescr: ! return None, None, None, None, None ! bps = self.audiodescr['sampleSize'] ! nch = self.audiodescr['numChannels'] ! if nch == 1: ! channels = ['mono'] ! elif nch == 2: ! channels = ['left', 'right'] ! else: ! channels = map(lambda x: str(x+1), range(nch)) ! if bps % 8: ! # Funny bits-per sample. We pretend not to understand ! blocksize = 0 ! fpb = 0 ! else: ! # QuickTime is easy (for as far as we support it): samples are always a whole ! # number of bytes, so frames are nchannels*samplesize, and there's one frame per block. ! blocksize = (bps/8)*nch ! fpb = 1 ! if self.audiodescr['dataFormat'] == 'raw ': ! encoding = 'linear-excess' ! elif self.audiodescr['dataFormat'] == 'twos': ! encoding = 'linear-signed' ! else: ! encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat'] ! ## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', ! ## channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps) ! return channels, encoding, blocksize, fpb, bps ! ! def GetAudioFrameRate(self): ! if not self.audiodescr: ! return None ! return int(self.audiodescr['sampleRate']) ! ! def GetVideoFormat(self): ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb) ! ! def GetVideoFrameRate(self): ! tv = self.videocurtime ! if tv == None: ! tv = 0 ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) ! dur = self._videotime_to_ms(dur) ! return int((1000.0/dur)+0.5) ! ! def ReadAudio(self, nframes, time=None): ! if not time is None: ! self.audiocurtime = time ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! if self.audiocurtime == None: ! self.audiocurtime = 0 ! tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0) ! if tv < 0 or (self.audiocurtime and tv < self.audiocurtime): ! return self._audiotime_to_ms(self.audiocurtime), None ! h = Res.Handle('') ! desc_h = Res.Handle('') ! size, actualtime, sampleduration, desc_index, actualcount, flags = \ ! self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes) ! self.audiocurtime = actualtime + actualcount*sampleduration ! return self._audiotime_to_ms(actualtime), h.data ! ! def ReadVideo(self, time=None): ! if not time is None: ! self.videocurtime = time ! flags = QuickTime.nextTimeStep ! if self.videocurtime == None: ! flags = flags | QuickTime.nextTimeEdgeOK ! self.videocurtime = 0 ! tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0) ! if tv < 0 or (self.videocurtime and tv <= self.videocurtime): ! return self._videotime_to_ms(self.videocurtime), None ! self.videocurtime = tv ! moviecurtime = self._videotime_to_movietime(self.videocurtime) ! self.movie.SetMovieTimeValue(moviecurtime) ! self.movie.MoviesTask(0) ! return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent() ! ! def _getpixmapcontent(self): ! """Shuffle the offscreen PixMap data, because it may have funny stride values""" ! rowbytes = Qdoffs.GetPixRowBytes(self.pixmap) ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! start = 0 ! rv = '' ! for i in range(height): ! nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) ! start = start + rowbytes ! rv = rv + nextline ! return rv def reader(url): ! try: ! rdr = _Reader(url) ! except IOError: ! return None ! return rdr def _test(): ! import EasyDialogs ! try: ! import img ! except ImportError: ! img = None ! import MacOS ! Qt.EnterMovies() ! path = EasyDialogs.AskFileForOpen(message='Video to convert') ! if not path: sys.exit(0) ! rdr = reader(path) ! if not rdr: ! sys.exit(1) ! dstdir = EasyDialogs.AskFileForSave(message='Name for output folder') ! if not dstdir: sys.exit(0) ! num = 0 ! os.mkdir(dstdir) ! videofmt = rdr.GetVideoFormat() ! imgfmt = videofmt.getformat() ! imgw, imgh = videofmt.getsize() ! timestamp, data = rdr.ReadVideo() ! while data: ! fname = 'frame%04.4d.jpg'%num ! num = num+1 ! pname = os.path.join(dstdir, fname) ! if not img: print 'Not', ! print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) ! if img: ! wrt = img.writer(imgfmt, pname) ! wrt.width = imgw ! wrt.height = imgh ! wrt.write(data) ! timestamp, data = rdr.ReadVideo() ! MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') ! if num > 20: ! print 'stopping at 20 frames so your disk does not fill up:-)' ! break ! print 'Total frames:', num ! if __name__ == '__main__': ! _test() ! sys.exit(1) ! From jackjansen@users.sourceforge.net Wed Apr 9 16:12:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 09 Apr 2003 08:12:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac using.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv9666 Modified Files: using.tex Log Message: Created a minimal MacOSX section. Index: using.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/using.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** using.tex 12 Feb 2003 09:58:33 -0000 1.6 --- using.tex 9 Apr 2003 15:12:38 -0000 1.7 *************** *** 2,19 **** \sectionauthor{Bob Savage}{bobsavage@mac.com} ! Using Python on a Mac OS 9 Macintosh can seem like something completely different than using it on a \UNIX-like or Windows system. Most of the ! Python documentation, both the ``official'' documentation and ! published books, describe only how Python is used on these systems, ! causing confusion for the new user of MacPython-OS9. This chapter gives a ! brief introduction to the specifics of using Python on a Macintosh. - Note that this chapter is mainly relevant to Mac OS 9: MacPython-OSX - is a superset of a normal unix Python. While MacPython-OS9 runs fine - on Mac OS X it is a better choice to use MacPython-OSX there. The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX too. \section{Getting and Installing MacPython-OS9 \label{getting}} --- 2,99 ---- \sectionauthor{Bob Savage}{bobsavage@mac.com} ! Using Python on a Macintosh, especially on Mac OS 9 (MacPython-OSX ! includes a complete unix Python) can seem like something completely different than using it on a \UNIX-like or Windows system. Most of the ! Python documentation, both the ``official'' documentation and published ! books, describe only how Python is used on these systems, causing ! confusion for the new user of MacPython-OS9. This chapter gives a brief ! introduction to the specifics of using Python on a Macintosh. The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX too. + \section{Getting and Installing MacPython-OSX \label{getting-OSX}} + + As of Python 2.3a2 the only sure way of getting MacPython-OSX on your machine + is getting a source distribution and building what is called a "framework Python". + The details are in the file \file{Mac/OSX/README}. + + As binary installers become available the details will be posted to + \url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. + + + What you get after installing is a number of things: + + \begin{itemize} + \item A \file{MacPython-2.3} folder in your \file{Applications} + folder. In here you find the PythonIDE Integrated Development Environment; + PythonLauncher, which handles double-clicking Python scripts from the Finder; and + the Package Manager. + + \item A fairly standard unix commandline Python interpreter in + \file{/usr/local/bin/python}, but without the usual \file{/usr/local/lib/python}. + + \item A framework \file{/Library/Frameworks/Python.framework}, where + all the action really is, but which you usually do not have to be aware of. + \end{itemize} + + To uninstall MacPython you can simply remove these three things. + + PythonIDE contains an Apple Help Viewer book called "MacPython Help" + which you can access through its help menu. If you are completely new to + Python you should start reading the IDE introduction in that document. + + If you are familiar with Python on other unix platforms you should read the + section on running Python scripts from the unix shell. + + \subsection{How to run a Python script} + + Your best way to get started with Python on Mac OS X is through the PythonIDE + integrated development environment, see section \ref{IDE} and use the Help + menu when the IDE is running. + + If you want to run Python scripts from the Terminal window command line + or from the Finder you first need an editor to create your script. + Mac OS X comes with a number of standard unix command line editors, + \program{vi} and \program{emacs} among them. If you want a more Mac-like + editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software + (see \url{http://www.barebones.com}) are good choices. Their freeware + \program{BBEdit Lite} is officially discontinued but still available. + \program{AppleWorks} or any other word processor that can save files + in ASCII is also a possibility, but \program{TextEdit} is not: it saves in .rtf + format only. + + To run your script from the Terminal window you must make sure that + \file{/usr/local/bin} is in your shell search path before \file{/usr/bin}, + where the Apple-supplied Python lives (which is version 2.2, as of Mac OS X + 10.2.4). There is one Mac OS X quirk that you need to be aware of: programs + that talk to the window manager (in other words, anything that has a GUI) + need to be run in a special way. Use \program{pythonw} in stead of \program{python} + to start such scripts. + + To run your script from the Finder you have two options: + \begin{itemize} + \item Drag it to \program{PythonLauncher} + \item Select \program{PythonLauncher} as the default application + to open your script (or any .py script) through the finder Info window + and double-click it. + \end{itemize} + + PythonLauncher has various preferences to control how your script is launched. + Option-dragging allows you to change these for one invocation, or use its + Preferences menu to change things globally. + + \subsection{configuration} + + MacPython honours all standard unix environment variables such as \envvar{PYTHONPATH}, + but setting these variables for programs started from the Finder is non-standard + as the Finder does not read your \file{.profile} or \file{.cshrc} at startup. + You need to create a file \file{\textasciitilde /.MacOSX/environment.plist}. + See Apple's Technical Document QA1067 for details. + + Installing additional Python packages is most easily done through the + Package Manager, see the MacPython Help Book for details. + \section{Getting and Installing MacPython-OS9 \label{getting}} *************** *** 22,31 **** Jansen: \url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. - Please refer to the \file{README} included with your distribution for the most up-to-date instructions. ! \section{Entering the interactive Interpreter \label{interpreter}} --- 102,115 ---- Jansen: \url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. Please refer to the \file{README} included with your distribution for the most up-to-date instructions. + Note that MacPython-OS9 runs fine on Mac OS X, and it runs in native + mode, not in the Classic environment. Unless you have specific + requirements for a CFM-based Python there is no reason not to + use MacPython-OSX, though. ! ! \subsection{Entering the interactive Interpreter \label{interpreter}} *************** *** 38,42 **** ! \section{How to run a Python script} There are several ways to run an existing Python script; two common --- 122,126 ---- ! \subsection{How to run a Python script} There are several ways to run an existing Python script; two common *************** *** 46,50 **** ! \subsection{Drag and drop} One of the easiest ways to launch a Python script is via ``Drag and --- 130,134 ---- ! \subsubsection{Drag and drop} One of the easiest ways to launch a Python script is via ``Drag and *************** *** 75,79 **** ! \subsection{Set Creator and Double Click \label{creator-code}} If the script that you want to launch has the appropriate Creator Code --- 159,163 ---- ! \subsubsection{Set Creator and Double Click \label{creator-code}} If the script that you want to launch has the appropriate Creator Code *************** *** 112,116 **** ! \section{Simulating command line arguments \label{argv}} --- 196,200 ---- ! \subsection{Simulating command line arguments \label{argv}} *************** *** 140,144 **** ! \section{Creating a Python script} Since Python scripts are simply text files, they can be created in any --- 224,228 ---- ! \subsection{Creating a Python script} Since Python scripts are simply text files, they can be created in any *************** *** 147,151 **** ! \subsection{In an editor} You can create a text file with any word processing program such as --- 231,235 ---- ! \subsubsection{In an editor} You can create a text file with any word processing program such as *************** *** 191,194 **** --- 275,354 ---- % **NEED INFO HERE** + \subsection{Configuration \label{configuration}} + + The MacPython distribution comes with \program{EditPythonPrefs}, an + applet which will help you to customize the MacPython environment for + your working habits. + + \subsubsection{EditPythonPrefs\label{EditPythonPrefs}} + + \program{EditPythonPrefs} gives you the capability to configure Python + to behave the way you want it to. There are two ways to use + \program{EditPythonPrefs}, you can use it to set the preferences in + general, or you can drop a particular Python engine onto it to + customize only that version. The latter can be handy if, for example, + you want to have a second copy of the \program{PythonInterpreter} that + keeps the output window open on a normal exit even though you prefer + to normally not work that way. + + To change the default preferences, simply double-click on + \program{EditPythonPrefs}. To change the preferences only for one copy + of the Interpreter, drop the icon for that copy onto + \program{EditPythonPrefs}. You can also use \program{EditPythonPrefs} + in this fashion to set the preferences of the \program{Python IDE} and + any applets you create -- see section %s \ref{BuildApplet} and + \ref{IDEapplet}. + + \subsubsection{Adding modules to the Module Search Path + \label{search-path}} + + When executing an \keyword{import} statement, Python looks for modules + in places defined by the \member{sys.path} To edit the + \member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and + enter them into the largish field at the top (one per line). + + Since MacPython defines a main Python directory, the easiest thing is + to add folders to search within the main Python directory. To add a + folder of scripts that you created called ``My Folder'' located in the + main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line. + + To add the Desktop under OS 9 or below, add + \samp{StartupDriveName:Desktop Folder} on a new line. + + \subsubsection{Default startup options \label{defaults}} + + % I'm assuming that there exists some other documentation on the + % rest of the options so I only go over a couple here. + + The ``Default startup options...'' button in the + \program{EditPythonPrefs} dialog box gives you many options including + the ability to keep the ``Output'' window open after the script + terminates, and the ability to enter interactive mode after the + termination of the run script. The latter can be very helpful if you + want to examine the objects that were created during your script. + + %\section{Nifty Tools} + %There are many other tools included with the MacPython + %distribution. In addition to those discussed here, make + %sure to check the \file{Mac} directory. + + %\subsection{BuildApplet \label{BuildApplet}} + % **NEED INFO HERE** + + %\subsection{BuildApplication} + % **NEED INFO HERE** + + %\section{TKInter on the Mac \label{TKInter}} + + %TKinter is installed by default with the MacPython distribution, but + %you may need to add the \file{lib-tk} folder to the Python Path (see + %section \ref{search-path}). Also, it is important that you do not + %try to launch Tk from within the \program{Python IDE} because the two + %event loops will collide -- always run a script which uses Tkinter + %with the \program{PythonInterpreter} instead -- see section + %\ref{interpreter}. + + %\section{CGI on the Mac with Python \label{CGI}} + %**NEED INFO HERE** \section{The IDE\label{IDE}} *************** *** 283,360 **** % **NEED INFO HERE** - \section{Configuration \label{configuration}} - - The MacPython distribution comes with \program{EditPythonPrefs}, an - applet which will help you to customize the MacPython environment for - your working habits. - - \subsection{EditPythonPrefs\label{EditPythonPrefs}} - - \program{EditPythonPrefs} gives you the capability to configure Python - to behave the way you want it to. There are two ways to use - \program{EditPythonPrefs}, you can use it to set the preferences in - general, or you can drop a particular Python engine onto it to - customize only that version. The latter can be handy if, for example, - you want to have a second copy of the \program{PythonInterpreter} that - keeps the output window open on a normal exit even though you prefer - to normally not work that way. - - To change the default preferences, simply double-click on - \program{EditPythonPrefs}. To change the preferences only for one copy - of the Interpreter, drop the icon for that copy onto - \program{EditPythonPrefs}. You can also use \program{EditPythonPrefs} - in this fashion to set the preferences of the \program{Python IDE} and - any applets you create -- see section %s \ref{BuildApplet} and - \ref{IDEapplet}. - - \subsection{Adding modules to the Module Search Path - \label{search-path}} - - When executing an \keyword{import} statement, Python looks for modules - in places defined by the \member{sys.path} To edit the - \member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and - enter them into the largish field at the top (one per line). - - Since MacPython defines a main Python directory, the easiest thing is - to add folders to search within the main Python directory. To add a - folder of scripts that you created called ``My Folder'' located in the - main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line. - - To add the Desktop under OS 9 or below, add - \samp{StartupDriveName:Desktop Folder} on a new line. - - \subsection{Default startup options \label{defaults}} - - % I'm assuming that there exists some other documentation on the - % rest of the options so I only go over a couple here. - - The ``Default startup options...'' button in the - \program{EditPythonPrefs} dialog box gives you many options including - the ability to keep the ``Output'' window open after the script - terminates, and the ability to enter interactive mode after the - termination of the run script. The latter can be very helpful if you - want to examine the objects that were created during your script. - - %\section{Nifty Tools} - %There are many other tools included with the MacPython - %distribution. In addition to those discussed here, make - %sure to check the \file{Mac} directory. - - %\subsection{BuildApplet \label{BuildApplet}} - % **NEED INFO HERE** - - %\subsection{BuildApplication} - % **NEED INFO HERE** - - %\section{TKInter on the Mac \label{TKInter}} - - %TKinter is installed by default with the MacPython distribution, but - %you may need to add the \file{lib-tk} folder to the Python Path (see - %section \ref{search-path}). Also, it is important that you do not - %try to launch Tk from within the \program{Python IDE} because the two - %event loops will collide -- always run a script which uses Tkinter - %with the \program{PythonInterpreter} instead -- see section - %\ref{interpreter}. - - %\section{CGI on the Mac with Python \label{CGI}} - %**NEED INFO HERE** --- 443,444 ---- From jlt63@users.sourceforge.net Wed Apr 9 17:04:01 2003 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Wed, 09 Apr 2003 09:04:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv31414 Modified Files: cygwinccompiler.py Log Message: Patch #709178: remove -static option from cygwinccompiler Currently, the cygwinccompiler.py compiler handling in distutils is invoking the cygwin and mingw compilers with the -static option. Logically, this means that the linker should choose to link to static libraries instead of shared/dynamically linked libraries. Current win32 binutils expect import libraries to have a .dll.a suffix and static libraries to have .a suffix. If -static is passed, it will skip the .dll.a libraries. This is pain if one has a tree with both static and dynamic libraries using this naming convention, and wish to use the dynamic libraries. The -static option being passed in distutils is to get around a bug in old versions of binutils where it would get confused when it found the DLLs themselves. The decision to use static or shared libraries is site or package specific, and should be left to the setup script or to command line options. Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** cygwinccompiler.py 19 Nov 2002 13:12:27 -0000 1.21 --- cygwinccompiler.py 9 Apr 2003 16:03:57 -0000 1.22 *************** *** 34,43 **** # - its dllwrap doesn't work, there is a bug in binutils 2.10.90 # see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html - # - using gcc -mdll instead dllwrap doesn't work without -static because - # it tries to link against dlls instead their import libraries. (If - # it finds the dll first.) - # By specifying -static we force ld to link against the import libraries, - # this is windows standard and there are normally not the necessary symbols - # in the dlls. # *** only the version of June 2000 shows these problems --- 34,37 ---- *************** *** 99,103 **** compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', ! linker_so=('%s -mcygwin -mdll -static' % self.linker_dll)) --- 93,97 ---- compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', ! linker_so=('%s -mcygwin -mdll' % self.linker_dll)) *************** *** 279,283 **** compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', ! linker_so='%s -mno-cygwin -mdll -static %s' % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished --- 273,277 ---- compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', ! linker_so='%s -mno-cygwin -mdll %s' % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished From gvanrossum@users.sourceforge.net Wed Apr 9 18:05:40 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:05:40 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25501 Modified Files: descrobject.c Log Message: property_traverse() should also traverse into prop_doc -- there's no typecheck that guarantees it's a string, and BTW string subclasses could hide references. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** descrobject.c 11 Feb 2003 18:44:39 -0000 2.34 --- descrobject.c 9 Apr 2003 17:05:33 -0000 2.35 *************** *** 1202,1205 **** --- 1202,1206 ---- VISIT(prop_set); VISIT(prop_del); + VISIT(prop_doc); return 0; From gvanrossum@users.sourceforge.net Wed Apr 9 18:06:35 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:06:35 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.22,2.22.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26156 Modified Files: Tag: release22-maint descrobject.c Log Message: Backport from trunk: property_traverse() should also traverse into prop_doc -- there's no typecheck that guarantees it's a string, and BTW string subclasses could hide references. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.22 retrieving revision 2.22.4.1 diff -C2 -d -r2.22 -r2.22.4.1 *** descrobject.c 15 Dec 2001 05:00:30 -0000 2.22 --- descrobject.c 9 Apr 2003 17:06:31 -0000 2.22.4.1 *************** *** 1062,1065 **** --- 1062,1066 ---- VISIT(prop_set); VISIT(prop_del); + VISIT(prop_doc); return 0; From akuchling@users.sourceforge.net Wed Apr 9 18:26:41 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:26:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv4774 Modified Files: whatsnew23.tex Log Message: Re-indent example; fix typo Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** whatsnew23.tex 21 Mar 2003 18:32:43 -0000 1.133 --- whatsnew23.tex 9 Apr 2003 17:26:38 -0000 1.134 *************** *** 739,744 **** } ! if ( hasattr(core, 'setup_keywords') and ! 'classifiers' in core.setup_keywords): kw['classifiers'] = \ ['Topic :: Internet :: WWW/HTTP :: Dynamic Content', --- 739,744 ---- } ! if (hasattr(core, 'setup_keywords') and ! 'classifiers' in core.setup_keywords): kw['classifiers'] = \ ['Topic :: Internet :: WWW/HTTP :: Dynamic Content', *************** *** 889,893 **** The \module{pickle} and \module{cPickle} modules received some attention during the 2.3 development cycle. In 2.2, new-style classes ! could be pickled without difficult, but they weren't pickled very compactly; \pep{307} quotes a trivial example where a new-style class results in a pickled string three times longer than that for a classic --- 889,893 ---- The \module{pickle} and \module{cPickle} modules received some attention during the 2.3 development cycle. In 2.2, new-style classes ! could be pickled without difficulty, but they weren't pickled very compactly; \pep{307} quotes a trivial example where a new-style class results in a pickled string three times longer than that for a classic *************** *** 2253,2257 **** The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Simon Brunning, Michael Chermside, Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo --- 2253,2257 ---- The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Jeff Bauer, Simon Brunning, Michael Chermside, Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo From gvanrossum@users.sourceforge.net Wed Apr 9 18:53:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:53:25 -0700 Subject: [Python-checkins] python/dist/src/Modules parsermodule.c,2.78,2.79 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16531 Modified Files: parsermodule.c Log Message: Don't use (PyObject *)PyObject_Type(x). It is a leaky and verbose way of saying x->ob_type. Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -d -r2.78 -r2.79 *** parsermodule.c 10 Feb 2003 01:08:50 -0000 2.78 --- parsermodule.c 9 Apr 2003 17:53:22 -0000 2.79 *************** *** 682,686 **** "second item in terminal node must be a string," " found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(temp); return 0; --- 682,686 ---- "second item in terminal node must be a string," " found %s", ! temp->ob_type->tp_name); Py_DECREF(temp); return 0; *************** *** 695,699 **** "third item in terminal node must be an" " integer, found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(o); Py_DECREF(temp); --- 695,699 ---- "third item in terminal node must be an" " integer, found %s", ! temp->ob_type->tp_name); Py_DECREF(o); Py_DECREF(temp); From gvanrossum@users.sourceforge.net Wed Apr 9 19:02:27 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:02:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv20455 Modified Files: abstract.tex Log Message: Try to discourage use of PyObject_Type(). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** abstract.tex 25 Jan 2003 07:48:13 -0000 1.23 --- abstract.tex 9 Apr 2003 18:02:23 -0000 1.24 *************** *** 320,323 **** --- 320,328 ---- \exception{SystemError} and returns \NULL. This is equivalent to the Python expression \code{type(\var{o})}. + This function increments the reference count of the return value. + There's really no reason to use this function instead of the + common expression \code{\var{o}->ob_type}, which returns a pointer + of type \code{PyTypeObject *}, except when the incremented reference + count is needed. \bifuncindex{type} \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 9 19:16:01 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:16:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv26979 Modified Files: abstract.tex Log Message: Minor markup adjustments. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** abstract.tex 9 Apr 2003 18:02:23 -0000 1.24 --- abstract.tex 9 Apr 2003 18:15:57 -0000 1.25 *************** *** 319,329 **** the object type of object \var{o}. On failure, raises \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}. This function increments the reference count of the return value. There's really no reason to use this function instead of the common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \code{PyTypeObject *}, except when the incremented reference count is needed. - \bifuncindex{type} \end{cfuncdesc} --- 319,328 ---- the object type of object \var{o}. On failure, raises \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}.\bifuncindex{type} This function increments the reference count of the return value. There's really no reason to use this function instead of the common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \ctype{PyTypeObject*}, except when the incremented reference count is needed. \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 9 19:17:20 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:17:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.8.6.8,1.8.6.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv27605 Modified Files: Tag: release22-maint abstract.tex Log Message: Backport comments about PyObject_Type() (HEAD revisions 1.24, 1.25). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.8.6.8 retrieving revision 1.8.6.9 diff -C2 -d -r1.8.6.8 -r1.8.6.9 *** abstract.tex 6 Dec 2002 10:17:35 -0000 1.8.6.8 --- abstract.tex 9 Apr 2003 18:17:18 -0000 1.8.6.9 *************** *** 297,303 **** When \var{o} is non-\NULL, returns a type object corresponding to the object type of object \var{o}. On failure, raises ! \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}. ! \bifuncindex{type} \end{cfuncdesc} --- 297,307 ---- When \var{o} is non-\NULL, returns a type object corresponding to the object type of object \var{o}. On failure, raises ! \exception{SystemError} and returns \NULL.\bifuncindex{type} ! This is equivalent to the Python expression \code{type(\var{o})}. ! This function increments the reference count of the return value. ! There's really no reason to use this function instead of the ! common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \ctype{PyTypeObject*}, except when the incremented reference ! count is needed. \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 9 19:19:28 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:19:28 -0700 Subject: [Python-checkins] python/dist/src/Modules parsermodule.c,2.68.6.2,2.68.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28583 Modified Files: Tag: release22-maint parsermodule.c Log Message: Backport reference leak fix from HEAD revision 1.79. Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.68.6.2 retrieving revision 2.68.6.3 diff -C2 -d -r2.68.6.2 -r2.68.6.3 *** parsermodule.c 10 Feb 2003 01:57:51 -0000 2.68.6.2 --- parsermodule.c 9 Apr 2003 18:19:24 -0000 2.68.6.3 *************** *** 682,686 **** "second item in terminal node must be a string," " found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(temp); return 0; --- 682,686 ---- "second item in terminal node must be a string," " found %s", ! temp->ob_type->tp_name); Py_DECREF(temp); return 0; *************** *** 695,699 **** "third item in terminal node must be an" " integer, found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(o); Py_DECREF(temp); --- 695,699 ---- "third item in terminal node must be an" " integer, found %s", ! temp->ob_type->tp_name); Py_DECREF(o); Py_DECREF(temp); From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:26 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:26 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Lib Modified Files: pdb.py Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** pdb.py 27 Feb 2003 20:14:37 -0000 1.62 --- pdb.py 9 Apr 2003 19:06:21 -0000 1.63 *************** *** 524,527 **** --- 524,554 ---- do_j = do_jump + def do_debug(self, arg): + sys.settrace(None) + globals = self.curframe.f_globals + locals = self.curframe.f_locals + p = Pdb() + p.prompt = "(%s) " % self.prompt.strip() + print "ENTERING RECURSIVE DEBUGGER" + sys.call_tracing(p.run, (arg, globals, locals)) + print "LEAVING RECURSIVE DEBUGGER" + sys.settrace(self.trace_dispatch) + self.lastcmd = p.lastcmd + + def dont_debug(self, arg): + locals = self.curframe.f_locals + globals = self.curframe.f_globals + try: + r = sys.call_tracing(eval, (arg, globals, locals)) + print "--- DEBUG RETURNED ---" + if r is not None: + print repr(r) + except: + t, v = sys.exc_info()[:2] + if type(t) == type(''): + exc_type_name = t + else: exc_type_name = t.__name__ + print '***', exc_type_name + ':', v + def do_quit(self, arg): self.set_quit() *************** *** 834,837 **** --- 861,870 ---- print """j(ump) lineno Set the next line that will be executed.""" + + def help_debug(self): + print """debug code + Enter a recursive debugger that steps through the code argument + (which is an arbitrary expression or statement to be executed + in the current environment).""" def help_list(self): From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.716,1.717 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Misc Modified Files: NEWS Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.716 retrieving revision 1.717 diff -C2 -d -r1.716 -r1.717 *** NEWS 8 Apr 2003 17:17:16 -0000 1.716 --- NEWS 9 Apr 2003 19:06:11 -0000 1.717 *************** *** 50,53 **** --- 50,56 ---- ----------------- + - New function sys.call_tracing() allows pdb to debug code + recursively. + - New function gc.get_referents(obj) returns a list of objects directly referenced by obj. In effect, it exposes what the object's *************** *** 86,89 **** --- 89,95 ---- Library ------- + + - pdb has a new command, "debug", which lets you step through + arbitrary code from the debugger's (pdb) prompt. - unittest.failUnlessEqual and its equivalent unittest.assertEqual now From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:49 -0700 Subject: [Python-checkins] python/dist/src/Include eval.h,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Include Modified Files: eval.h Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: eval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/eval.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** eval.h 12 Aug 2002 07:21:56 -0000 2.16 --- eval.h 9 Apr 2003 19:06:16 -0000 2.17 *************** *** 18,21 **** --- 18,23 ---- PyObject *closure); + PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); + #ifdef __cplusplus } From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:54 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.357,2.358 sysmodule.c,2.116,2.117 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Python Modified Files: ceval.c sysmodule.c Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.357 retrieving revision 2.358 diff -C2 -d -r2.357 -r2.358 *** ceval.c 16 Mar 2003 20:14:44 -0000 2.357 --- ceval.c 9 Apr 2003 19:06:17 -0000 2.358 *************** *** 3025,3028 **** --- 3025,3046 ---- } + PyObject * + _PyEval_CallTracing(PyObject *func, PyObject *args) + { + PyFrameObject *frame = PyEval_GetFrame(); + PyThreadState *tstate = frame->f_tstate; + int save_tracing = tstate->tracing; + int save_use_tracing = tstate->use_tracing; + PyObject *result; + + tstate->tracing = 0; + tstate->use_tracing = ((tstate->c_tracefunc != NULL) + || (tstate->c_profilefunc != NULL)); + result = PyObject_Call(func, args, NULL); + tstate->tracing = save_tracing; + tstate->use_tracing = save_use_tracing; + return result; + } + static int maybe_call_line_trace(Py_tracefunc func, PyObject *obj, Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -d -r2.116 -r2.117 *** sysmodule.c 5 Mar 2003 15:13:47 -0000 2.116 --- sysmodule.c 9 Apr 2003 19:06:19 -0000 2.117 *************** *** 18,21 **** --- 18,22 ---- #include "compile.h" #include "frameobject.h" + #include "eval.h" #include "osdefs.h" *************** *** 610,613 **** --- 611,631 ---- } + PyDoc_STRVAR(call_tracing_doc, + "call_tracing(func, args) -> object\n\ + \n\ + Call func(*args), while tracing is enabled. The tracing state is\n\ + saved, and restored afterwards. This is intended to be called from\n\ + a debugger from a checkpoint, to recursively debug some other code." + ); + + static PyObject * + sys_call_tracing(PyObject *self, PyObject *args) + { + PyObject *func, *funcargs; + if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs)) + return NULL; + return _PyEval_CallTracing(func, funcargs); + } + PyDoc_STRVAR(callstats_doc, "callstats() -> tuple of integers\n\ *************** *** 701,704 **** --- 719,723 ---- setrecursionlimit_doc}, {"settrace", sys_settrace, METH_O, settrace_doc}, + {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, {NULL, NULL} /* sentinel */ }; From gvanrossum@users.sourceforge.net Wed Apr 9 20:10:51 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:10:51 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts byext.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv23373 Modified Files: byext.py Log Message: Various improvements to the way the table is formatted, to deal with exceptionally large totals etc. Index: byext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/byext.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** byext.py 1 Jan 2003 14:41:25 -0000 1.1 --- byext.py 9 Apr 2003 19:10:46 -0000 1.2 *************** *** 31,34 **** --- 31,38 ---- names.sort() for name in names: + if name.startswith(".#"): + continue # Skip CVS temp files + if name.endswith("~"): + continue# Skip Emacs backup files full = os.path.join(dir, name) if os.path.islink(full): *************** *** 43,47 **** head, base = os.path.split(file) if ext == base: ! ext = "" # .cvsignore is deemed not to have an extension self.addstats(ext, "files", 1) try: --- 47,54 ---- head, base = os.path.split(file) if ext == base: ! ext = "" # E.g. .cvsignore is deemed not to have an extension ! ext = os.path.normcase(ext) ! if not ext: ! ext = "" self.addstats(ext, "files", 1) try: *************** *** 71,75 **** def report(self): - totals = {} exts = self.stats.keys() exts.sort() --- 78,81 ---- *************** *** 80,107 **** cols = columns.keys() cols.sort() ! minwidth = 7 ! extwidth = max([len(ext) for ext in exts]) ! print "%*s" % (extwidth, "ext"), for col in cols: ! width = max(len(col), minwidth) ! print "%*s" % (width, col), ! print ! for ext in exts: ! print "%*s" % (extwidth, ext), ! for col in cols: ! width = max(len(col), minwidth) value = self.stats[ext].get(col) if value is None: ! s = "" else: ! s = "%d" % value ! totals[col] = totals.get(col, 0) + value ! print "%*s" % (width, s), print ! print "%*s" % (extwidth, "TOTAL"), ! for col in cols: ! width = max(len(col), minwidth) ! print "%*s" % (width, totals[col]), ! print def main(): --- 86,122 ---- cols = columns.keys() cols.sort() ! colwidth = {} ! colwidth["ext"] = max([len(ext) for ext in exts]) ! minwidth = 6 ! self.stats["TOTAL"] = {} for col in cols: ! total = 0 ! cw = max(minwidth, len(col)) ! for ext in exts: value = self.stats[ext].get(col) if value is None: ! w = 0 else: ! w = len("%d" % value) ! total += value ! cw = max(cw, w) ! cw = max(cw, len(str(total))) ! colwidth[col] = cw ! self.stats["TOTAL"][col] = total ! exts.append("TOTAL") ! for ext in exts: ! self.stats[ext]["ext"] = ext ! cols.insert(0, "ext") ! def printheader(): ! for col in cols: ! print "%*s" % (colwidth[col], col), print ! printheader() ! for ext in exts: ! for col in cols: ! value = self.stats[ext].get(col, "") ! print "%*s" % (colwidth[col], value), ! print ! printheader() # Another header at the bottom def main(): From gvanrossum@users.sourceforge.net Wed Apr 9 20:31:06 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:31:06 -0700 Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c,2.43,2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv32370 Modified Files: mmapmodule.c Log Message: Fix two crashes on Windows: - CHECK_VALID() was checking the wrong value for a closed fd - fseek(&_iob[fileno], ...) doesn't work for fileno >= 20 Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** mmapmodule.c 7 Feb 2003 19:44:56 -0000 2.43 --- mmapmodule.c 9 Apr 2003 19:31:02 -0000 2.44 *************** *** 155,159 **** #define CHECK_VALID(err) \ do { \ ! if (!self->map_handle) { \ PyErr_SetString (PyExc_ValueError, "mmap closed or invalid"); \ return err; \ --- 155,159 ---- #define CHECK_VALID(err) \ do { \ ! if (self->map_handle == INVALID_HANDLE_VALUE) { \ PyErr_SetString (PyExc_ValueError, "mmap closed or invalid"); \ return err; \ *************** *** 975,979 **** } /* Win9x appears to need us seeked to zero */ ! fseek(&_iob[fileno], 0, SEEK_SET); } --- 975,979 ---- } /* Win9x appears to need us seeked to zero */ ! lseek(fileno, 0, SEEK_SET); } From gvanrossum@users.sourceforge.net Wed Apr 9 20:32:02 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:32:02 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.206,2.207 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv323 Modified Files: stringobject.c Log Message: Reformat a few docstrings that caused line wraps in help() output. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.206 retrieving revision 2.207 diff -C2 -d -r2.206 -r2.207 *** stringobject.c 31 Mar 2003 18:07:42 -0000 2.206 --- stringobject.c 9 Apr 2003 19:31:57 -0000 2.207 *************** *** 2382,2388 **** "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 2382,2388 ---- "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * *************** *** 2433,2439 **** "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 2433,2439 ---- "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * From gvanrossum@users.sourceforge.net Wed Apr 9 20:32:53 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:32:53 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.185,2.186 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv738 Modified Files: unicodeobject.c Log Message: Reformat a few docstrings that caused line wraps in help() output. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** unicodeobject.c 2 Apr 2003 16:37:23 -0000 2.185 --- unicodeobject.c 9 Apr 2003 19:32:45 -0000 2.186 *************** *** 5694,5700 **** "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 5694,5700 ---- "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * *************** *** 5725,5731 **** "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 5725,5731 ---- "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * From gvanrossum@users.sourceforge.net Wed Apr 9 20:35:20 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:35:20 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv1816 Modified Files: classobject.c Log Message: Make it possible to call instancemethod() with 2 arguments. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** classobject.c 7 Apr 2003 17:51:59 -0000 2.169 --- classobject.c 9 Apr 2003 19:35:08 -0000 2.170 *************** *** 2198,2204 **** PyObject *func; PyObject *self; ! PyObject *classObj; ! if (!PyArg_UnpackTuple(args, "instancemethod", 3, 3, &func, &self, &classObj)) return NULL; --- 2198,2204 ---- PyObject *func; PyObject *self; ! PyObject *classObj = NULL; ! if (!PyArg_UnpackTuple(args, "instancemethod", 2, 3, &func, &self, &classObj)) return NULL; From gvanrossum@users.sourceforge.net Wed Apr 9 20:36:40 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:36:40 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2359 Modified Files: pdb.py Log Message: Detabified. Removed dead code. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** pdb.py 9 Apr 2003 19:06:21 -0000 1.63 --- pdb.py 9 Apr 2003 19:36:34 -0000 1.64 *************** *** 528,553 **** globals = self.curframe.f_globals locals = self.curframe.f_locals ! p = Pdb() ! p.prompt = "(%s) " % self.prompt.strip() ! print "ENTERING RECURSIVE DEBUGGER" ! sys.call_tracing(p.run, (arg, globals, locals)) ! print "LEAVING RECURSIVE DEBUGGER" sys.settrace(self.trace_dispatch) self.lastcmd = p.lastcmd - - def dont_debug(self, arg): - locals = self.curframe.f_locals - globals = self.curframe.f_globals - try: - r = sys.call_tracing(eval, (arg, globals, locals)) - print "--- DEBUG RETURNED ---" - if r is not None: - print repr(r) - except: - t, v = sys.exc_info()[:2] - if type(t) == type(''): - exc_type_name = t - else: exc_type_name = t.__name__ - print '***', exc_type_name + ':', v def do_quit(self, arg): --- 528,538 ---- globals = self.curframe.f_globals locals = self.curframe.f_locals ! p = Pdb() ! p.prompt = "(%s) " % self.prompt.strip() ! print "ENTERING RECURSIVE DEBUGGER" ! sys.call_tracing(p.run, (arg, globals, locals)) ! print "LEAVING RECURSIVE DEBUGGER" sys.settrace(self.trace_dispatch) self.lastcmd = p.lastcmd def do_quit(self, arg): From gvanrossum@users.sourceforge.net Wed Apr 9 20:38:11 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:38:11 -0700 Subject: [Python-checkins] python/dist/src/PCbuild winsound.dsp,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv2905/PCbuild Modified Files: winsound.dsp Log Message: Add MessageBeep() API. Index: winsound.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/winsound.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** winsound.dsp 23 Jul 2002 06:31:15 -0000 1.8 --- winsound.dsp 9 Apr 2003 19:38:08 -0000 1.9 *************** *** 55,59 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 ! # ADD LINK32 kernel32.lib winmm.lib user32.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd" # SUBTRACT LINK32 /pdb:none *************** *** 83,87 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 83,87 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 user32.lib kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none From gvanrossum@users.sourceforge.net Wed Apr 9 20:38:11 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:38:11 -0700 Subject: [Python-checkins] python/dist/src/PC winsound.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv2905/PC Modified Files: winsound.c Log Message: Add MessageBeep() API. Index: winsound.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/winsound.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** winsound.c 22 Jul 2002 13:26:41 -0000 1.11 --- winsound.c 9 Apr 2003 19:38:08 -0000 1.12 *************** *** 57,60 **** --- 57,63 ---- "will work on all systems."); + PyDoc_STRVAR(sound_msgbeep_doc, + "MessageBeep(x) - call Windows MessageBeep(x). x defaults to MB_OK."); + PyDoc_STRVAR(sound_module_doc, "PlaySound(sound, flags) - play a sound\n" *************** *** 174,181 **** --- 177,196 ---- } + static PyObject * + sound_msgbeep(PyObject *self, PyObject *args) + { + int x = MB_OK; + if (!PyArg_ParseTuple(args, "|i:MessageBeep", &x)) + return NULL; + MessageBeep(x); + Py_INCREF(Py_None); + return Py_None; + } + static struct PyMethodDef sound_methods[] = { {"PlaySound", sound_playsound, METH_VARARGS, sound_playsound_doc}, {"Beep", sound_beep, METH_VARARGS, sound_beep_doc}, + {"MessageBeep", sound_msgbeep, METH_VARARGS, sound_msgbeep_doc}, {NULL, NULL} }; *************** *** 216,219 **** --- 231,240 ---- ADD_DEFINE(SND_LOOP); ADD_DEFINE(SND_APPLICATION); + + ADD_DEFINE(MB_OK); + ADD_DEFINE(MB_ICONASTERISK); + ADD_DEFINE(MB_ICONEXCLAMATION); + ADD_DEFINE(MB_ICONHAND); + ADD_DEFINE(MB_ICONQUESTION); version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); From gvanrossum@users.sourceforge.net Wed Apr 9 20:39:13 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:39:13 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.717,1.718 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv3582 Modified Files: NEWS Log Message: - New function winsound.MessageBeep() wraps the Win32 API MessageBeep(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.717 retrieving revision 1.718 diff -C2 -d -r1.717 -r1.718 *** NEWS 9 Apr 2003 19:06:11 -0000 1.717 --- NEWS 9 Apr 2003 19:39:06 -0000 1.718 *************** *** 160,164 **** ------- ! TBD Mac --- 160,165 ---- ------- ! - New function winsound.MessageBeep() wraps the Win32 API ! MessageBeep(). Mac From gvanrossum@users.sourceforge.net Wed Apr 9 20:57:10 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:57:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_winsound.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11843 Modified Files: test_winsound.py Log Message: Add test for MessageBeep() Index: test_winsound.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winsound.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_winsound.py 23 Oct 2000 17:22:08 -0000 1.3 --- test_winsound.py 9 Apr 2003 19:57:06 -0000 1.4 *************** *** 1,6 **** # Ridiculously simple test of the winsound module for Windows. ! import winsound for i in range(100, 2000, 100): winsound.Beep(i, 75) print "Hopefully you heard some sounds increasing in frequency!" --- 1,18 ---- # Ridiculously simple test of the winsound module for Windows. ! import winsound, time for i in range(100, 2000, 100): winsound.Beep(i, 75) print "Hopefully you heard some sounds increasing in frequency!" + winsound.MessageBeep() + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_OK) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONASTERISK) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONEXCLAMATION) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONHAND) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONQUESTION) + time.sleep(0.5) From gvanrossum@users.sourceforge.net Wed Apr 9 20:58:34 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:58:34 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv12437/sio Log Message: Directory /cvsroot/python/python/nondist/sandbox/sio added to the repository From jlt63@users.sourceforge.net Wed Apr 9 21:14:07 2003 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Wed, 09 Apr 2003 13:14:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv18318 Modified Files: cygwinccompiler.py Log Message: Patch #718551: cygwinccompiler.get_versions() patch The cygwinccompiler.get_versions() function only handles versions numbers of the form "x.y.z". The attached patch enhances get_versions() to handle "x.y" too (i.e., the ".z" is optional). This change causes the unnecessary "--entry _DllMain@12" link option to be suppressed for recent Cygwin and Mingw toolchains. Additionally, it directs recent Mingw toolchains to use gcc instead of dllwrap during linking. Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** cygwinccompiler.py 9 Apr 2003 16:03:57 -0000 1.22 --- cygwinccompiler.py 9 Apr 2003 20:13:59 -0000 1.23 *************** *** 358,362 **** out_string = out.read() out.close() ! result = re.search('(\d+\.\d+\.\d+)',out_string) if result: gcc_version = StrictVersion(result.group(1)) --- 358,362 ---- out_string = out.read() out.close() ! result = re.search('(\d+\.\d+(\.\d+)*)',out_string) if result: gcc_version = StrictVersion(result.group(1)) *************** *** 370,374 **** out_string = out.read() out.close() ! result = re.search('(\d+\.\d+\.\d+)',out_string) if result: ld_version = StrictVersion(result.group(1)) --- 370,374 ---- out_string = out.read() out.close() ! result = re.search('(\d+\.\d+(\.\d+)*)',out_string) if result: ld_version = StrictVersion(result.group(1)) *************** *** 382,386 **** out_string = out.read() out.close() ! result = re.search(' (\d+\.\d+\.\d+)',out_string) if result: dllwrap_version = StrictVersion(result.group(1)) --- 382,386 ---- out_string = out.read() out.close() ! result = re.search(' (\d+\.\d+(\.\d+)*)',out_string) if result: dllwrap_version = StrictVersion(result.group(1)) From jhylton@users.sourceforge.net Wed Apr 9 22:01:48 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:01:48 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.221,2.222 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8481 Modified Files: typeobject.c Log Message: Missing DECREF. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.221 retrieving revision 2.222 diff -C2 -d -r2.221 -r2.222 *** typeobject.c 6 Apr 2003 19:13:41 -0000 2.221 --- typeobject.c 9 Apr 2003 21:01:42 -0000 2.222 *************** *** 2620,2623 **** --- 2620,2624 ---- Py_XDECREF(args); Py_XDECREF(args2); + Py_XDECREF(slots); Py_XDECREF(state); Py_XDECREF(names); From jhylton@users.sourceforge.net Wed Apr 9 22:05:17 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:05:17 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.142,2.143 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv10315 Modified Files: cPickle.c Log Message: Make Picklers collectable. Bug fix candidate. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.142 retrieving revision 2.143 diff -C2 -d -r2.142 -r2.143 *** cPickle.c 20 Mar 2003 20:53:30 -0000 2.142 --- cPickle.c 9 Apr 2003 21:05:12 -0000 2.143 *************** *** 2725,2729 **** } ! self = PyObject_New(Picklerobject, &Picklertype); if (self == NULL) return NULL; --- 2725,2729 ---- } ! self = PyObject_GC_New(Picklerobject, &Picklertype); if (self == NULL) return NULL; *************** *** 2808,2811 **** --- 2808,2812 ---- Py_INCREF(dispatch_table); } + PyObject_GC_Track(self); return self; *************** *** 2843,2846 **** --- 2844,2848 ---- Pickler_dealloc(Picklerobject *self) { + PyObject_GC_UnTrack(self); Py_XDECREF(self->write); Py_XDECREF(self->memo); *************** *** 2852,2856 **** Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); ! PyObject_Del(self); } --- 2854,2896 ---- Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); ! PyObject_GC_Del(self); ! } ! ! static int ! Pickler_traverse(Picklerobject *self, visitproc visit, void *arg) ! { ! int err; ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->write); ! VISIT(self->memo); ! VISIT(self->fast_memo); ! VISIT(self->arg); ! VISIT(self->file); ! VISIT(self->pers_func); ! VISIT(self->inst_pers_func); ! VISIT(self->dispatch_table); ! #undef VISIT ! return 0; ! } ! ! static int ! Pickler_clear(Picklerobject *self) ! { ! #define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL; ! CLEAR(self->write); ! CLEAR(self->memo); ! CLEAR(self->fast_memo); ! CLEAR(self->arg); ! CLEAR(self->file); ! CLEAR(self->pers_func); ! CLEAR(self->inst_pers_func); ! CLEAR(self->dispatch_table); ! #undef CLEAR ! return 0; } *************** *** 2968,2975 **** PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ Picklertype__doc__, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 3008,3015 ---- PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, Picklertype__doc__, /* tp_doc */ ! (traverseproc)Pickler_traverse, /* tp_traverse */ ! (inquiry)Pickler_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ From gvanrossum@users.sourceforge.net Wed Apr 9 22:17:44 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:17:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,NONE,1.1 test_sio.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv14889 Added Files: sio.py test_sio.py Log Message: Experimental new standard I/O library. --- NEW FILE: sio.py --- """New standard I/O library. This code is still very young and experimental! There are fairly complete unit tests in test_sio.py. The design is simple: - A raw stream supports read(n), write(s), seek(offset, whence=0) and tell(). This is generally unbuffered. Raw streams may support Unicode. - A basis stream provides the raw stream API and builds on a much more low-level API, e.g. the os, mmap or socket modules. - A filtering stream is raw stream built on top of another raw stream. There are filtering streams for universal newline translation and for unicode translation. - A buffering stream supports the full classic Python I/O API: read(n=-1), readline(), readlines(sizehint=0), tell(), seek(offset, whence=0), write(s), writelines(lst), as well as __iter__() and next(). (There's also readall() but that's a synonym for read() without arguments.) This is a superset of the raw stream API. I haven't thought about fileno() and isatty() yet. We really need only one buffering stream implementation, which is a filtering stream. You typically take a basis stream, place zero or more filtering streams on top of it, and then top it off with a buffering stream. """ import os import mmap class BufferingInputStream(object): """Standard buffering input stream. This is typically the top of the stack. """ bigsize = 2**19 # Half a Meg bufsize = 2**13 # 8 K def __init__(self, base, bufsize=None): self.do_read = getattr(base, "read", None) # function to fill buffer some more self.do_tell = getattr(base, "tell", None) # None, or return a byte offset self.do_seek = getattr(base, "seek", None) # None, or seek to abyte offset if bufsize is None: # Get default from the class bufsize = self.bufsize self.bufsize = bufsize # buffer size (hint only) self.lines = [] # ready-made lines (sans "\n") self.buf = "" # raw data (may contain "\n") # Invariant: readahead == "\n".join(self.lines + [self.buf]) # self.lines contains no "\n" # self.buf may contain "\n" def tell(self): bytes = self.do_tell() # This may fail offset = len(self.buf) for line in self.lines: offset += len(line) + 1 assert bytes >= offset, (locals(), self.__dict__) return bytes - offset def seek(self, offset, whence=0): # This may fail on the do_seek() or do_tell() call. # But it won't call either on a relative forward seek. # Nor on a seek to the very end. if whence == 0 or (whence == 2 and self.do_seek is not None): self.do_seek(offset, whence) self.lines = [] self.buf = "" return if whence == 2: # Skip relative to EOF by reading and saving only just as # much as needed assert self.do_seek is None data = "\n".join(self.lines + [self.buf]) total = len(data) buffers = [data] self.lines = [] self.buf = "" while 1: data = self.do_read(self.bufsize) if not data: break buffers.append(data) total += len(data) while buffers and total >= len(buffers[0]) - offset: total -= len(buffers[0]) del buffers[0] cutoff = total + offset if cutoff < 0: raise TypeError, "cannot seek back" if buffers: buffers[0] = buffers[0][cutoff:] self.buf = "".join(buffers) self.lines = [] return if whence == 1: if offset < 0: self.do_seek(self.tell() + offset, 0) self.lines = [] self.buf = "" return while self.lines: line = self.lines[0] if offset <= len(line): self.lines[0] = line[offset:] return offset -= len(self.lines[0]) - 1 del self.lines[0] assert not self.lines if offset <= len(self.buf): self.buf = self.buf[offset:] return offset -= len(self.buf) self.buf = "" if self.do_seek is None: self.read(offset) else: self.do_seek(offset, 1) return raise ValueError, "whence should be 0, 1 or 2" def readall(self): self.lines.append(self.buf) more = ["\n".join(self.lines)] self.lines = [] self.buf = "" bufsize = self.bufsize while 1: data = self.do_read(bufsize) if not data: break more.append(data) bufsize = max(bufsize*2, self.bigsize) return "".join(more) def read(self, n=-1): if n < 0: return self.readall() if self.lines: # See if this can be satisfied from self.lines[0] line = self.lines[0] if len(line) >= n: self.lines[0] = line[n:] return line[:n] # See if this can be satisfied *without exhausting* self.lines k = 0 i = 0 for line in self.lines: k += len(line) if k >= n: lines = self.lines[:i] data = self.lines[i] cutoff = len(data) - (k-n) lines.append(data[:cutoff]) self.lines[:i+1] = [data[cutoff:]] return "\n".join(lines) k += 1 i += 1 # See if this can be satisfied from self.lines plus self.buf if k + len(self.buf) >= n: lines = self.lines self.lines = [] cutoff = n - k lines.append(self.buf[:cutoff]) self.buf = self.buf[cutoff:] return "\n".join(lines) else: # See if this can be satisfied from self.buf data = self.buf k = len(data) if k >= n: cutoff = len(data) - (k-n) self.buf = data[cutoff:] return data[:cutoff] lines = self.lines self.lines = [] lines.append(self.buf) self.buf = "" data = "\n".join(lines) more = [data] k = len(data) while k < n: data = self.do_read(max(self.bufsize, n-k)) k += len(data) more.append(data) if not data: break cutoff = len(data) - (k-n) self.buf = data[cutoff:] more[-1] = data[:cutoff] return "".join(more) def __iter__(self): return self def next(self): if self.lines: return self.lines.pop(0) + "\n" # This block is needed because read() can leave self.buf # containing newlines self.lines = self.buf.split("\n") self.buf = self.lines.pop() if self.lines: return self.lines.pop(0) + "\n" buf = self.buf and [self.buf] or [] while 1: self.buf = self.do_read(self.bufsize) self.lines = self.buf.split("\n") self.buf = self.lines.pop() if self.lines: buf.append(self.lines.pop(0)) buf.append("\n") break if not self.buf: break buf.append(self.buf) line = "".join(buf) if not line: raise StopIteration return line def readline(self): try: return self.next() except StopIteration: return "" def readlines(self, sizehint=0): return list(self) class CRLFFilter(object): """Filtering stream for universal newlines. TextInputFilter is more general, but this is faster when you don't need tell/seek. """ def __init__(self, base): self.do_read = base.read self.atcr = False def read(self, n): data = self.do_read(n) if self.atcr: if data.startswith("\n"): data = data[1:] # Very rare case: in the middle of "\r\n" self.atcr = False if "\r" in data: self.atcr = data.endswith("\r") # Test this before removing \r data = data.replace("\r\n", "\n") # Catch \r\n this first data = data.replace("\r", "\n") # Remaining \r are standalone return data class MMapFile(object): """Standard I/O basis stream using mmap.""" def __init__(self, filename, mode="r"): self.filename = filename self.mode = mode if mode == "r": flag = os.O_RDONLY self.access = mmap.ACCESS_READ else: if mode == "w": flag = os.O_RDWR | os.O_CREAT elif mode == "a": flag = os.O_RDWR else: raise ValueError, "mode should be 'r', 'w' or 'a'" self.access = mmap.ACCESS_WRITE if hasattr(os, "O_BINARY"): flag |= os.O_BINARY self.fd = os.open(filename, flag) self.mm = mmap.mmap(self.fd, 0, access=self.access) self.pos = 0 def __del__(self): self.close() def close(self): if self.mm is not None: self.mm.close() self.mm = None if self.fd is not None: os.close(self.fd) self.fd = None def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 0: self.pos = max(0, offset) elif whence == 1: self.pos = max(0, self.pos + offset) elif whence == 2: self.pos = max(0, self.mm.size() + offset) else: raise ValueError, "seek(): whence must be 0, 1 or 2" def readall(self): return self.read() def read(self, n=-1): if n >= 0: aim = self.pos + n else: aim = self.mm.size() # Actual file size, may be more than mapped n = aim - self.pos data = self.mm[self.pos:aim] if len(data) < n: del data # File grew since opened; remap to get the new data self.mm = mmap.mmap(self.fd, 0, access=self.access) data = self.mm[self.pos:aim] self.pos += len(data) return data def __iter__(self): return self def readline(self): hit = self.mm.find("\n", self.pos) + 1 if hit: data = self.mm[self.pos:hit] self.pos = hit return data # Remap the file just in case self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: # Got a whole line after remapping data = self.mm[self.pos:hit] self.pos = hit return data # Read whatever we've got -- may be empty data = self.mm[self.pos:self.mm.size()] self.pos += len(data) return data def next(self): hit = self.mm.find("\n", self.pos) + 1 if hit: data = self.mm[self.pos:hit] self.pos = hit return data # Remap the file just in case self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: # Got a whole line after remapping data = self.mm[self.pos:hit] self.pos = hit return data # Read whatever we've got -- may be empty data = self.mm[self.pos:self.mm.size()] if not data: raise StopIteration self.pos += len(data) return data def readlines(self, sizehint=0): return list(iter(self.readline, "")) def write(self, data): end = self.pos + len(data) try: self.mm[self.pos:end] = data except IndexError: self.mm.resize(end) self.mm[self.pos:end] = data self.pos = end def writelines(self, lines): filter(self.write, lines) class DiskFile(object): """Standard I/O basis stream using os.open/close/read/write/lseek""" def __init__(self, filename, mode="r"): self.filename = filename self.mode = mode if mode == "r": flag = os.O_RDONLY elif mode == "w": flag = os.O_RDWR | os.O_CREAT elif mode == "a": flag = os.O_RDWR else: raise ValueError, "mode should be 'r', 'w' or 'a'" if hasattr(os, "O_BINARY"): flag |= os.O_BINARY self.fd = os.open(filename, flag) def seek(self, offset, whence=0): os.lseek(self.fd, offset, whence) def tell(self): return os.lseek(self.fd, 0, 1) def read(self, n): return os.read(self.fd, n) def write(self, data): while data: n = os.write(self.fd, data) data = data[n:] def close(self): fd = self.fd if fd is not None: self.fd = None os.close(fd) def __del__(self): try: self.close() except: pass class TextInputFilter(object): """Filtering input stream for universal newline translation.""" def __init__(self, base): self.base = base # must implement read, may implement tell, seek self.atcr = False # Set when last char read was \r self.buf = "" # Optional one-character read-ahead buffer def read(self, n): """Read up to n bytes.""" if n <= 0: return "" if self.buf: assert not self.atcr data = self.buf self.buf = "" return data data = self.base.read(n) if self.atcr: if data.startswith("\n"): data = data[1:] if not data: data = self.base.read(n) self.atcr = False if "\r" in data: self.atcr = data.endswith("\r") data = data.replace("\r\n", "\n").replace("\r", "\n") return data def seek(self, offset, whence=0): self.base.seek(offset, whence) self.atcr = False self.buf = "" def tell(self): pos = self.base.tell() if self.atcr: # Must read the next byte to see if it's \n, # because then we must report the next position. assert not self.buf self.buf = self.base.read(1) pos += 1 self.atcr = False if self.buf == "\n": self.buf = "" return pos - len(self.buf) class TextOutputFilter(object): """Filtering output stream for universal newline translation.""" def __init__(self, base, linesep=os.linesep): assert linesep in ["\n", "\r\n", "\r"] self.base = base # must implement write, may implement seek, tell self.linesep = linesep def write(self, data): if self.linesep is not "\n" and "\n" in data: data = data.replace("\n", self.linesep) self.base.write(data) def seek(self, offset, whence=0): self.base.seek(offset, whence) def tell(self): return self.base.tell() class DecodingInputFilter(object): """Filtering input stream that decodes an encoded file.""" def __init__(self, base, encoding="utf8", errors="strict"): self.base = base self.encoding = encoding self.errors = errors self.tell = base.tell self.seek = base.seek def read(self, n): """Read *approximately* n bytes, then decode them. Under extreme circumstances, the return length could be longer than n! Always return a unicode string. This does *not* translate newlines; you can stack TextInputFilter. """ data = self.base.read(n) try: return data.decode(self.encoding, self.errors) except ValueError: # XXX Sigh. decode() doesn't handle incomplete strings well. # Use the retry strategy from codecs.StreamReader. for i in range(9): more = self.base.read(1) if not more: raise data += more try: return data.decode(self.encoding, self.errors) except ValueError: pass raise class EncodingOutputFilter(object): """Filtering output stream that writes to an encoded file.""" def __init__(self, base, encoding="utf8", errors="strict"): self.base = base self.encoding = encoding self.errors = errors self.tell = base.tell self.seek = base.seek def write(self, chars): if isinstance(chars, str): chars = unicode(chars) # Fail if it's not ASCII self.base.write(chars.encode(self.encoding, self.errors)) --- NEW FILE: test_sio.py --- """Unit tests for sio (new standard I/O).""" import time import tempfile import unittest from test import test_support import sio class TestSource(object): def __init__(self, packets): for x in packets: assert x self.orig_packets = list(packets) self.packets = list(packets) self.pos = 0 def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 1: offset += self.pos elif whence == 2: for packet in self.orig_packets: offset += len(packet) else: assert whence == 0 self.packets = list(self.orig_packets) self.pos = 0 while self.pos < offset: data = self.read(offset - self.pos) if not data: break assert self.pos == offset def read(self, n): try: data = self.packets.pop(0) except IndexError: return "" if len(data) > n: data, rest = data[:n], data[n:] self.packets.insert(0, rest) self.pos += len(data) return data class TestReader(object): def __init__(self, packets): for x in packets: assert x self.orig_packets = list(packets) self.packets = list(packets) self.pos = 0 def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 1: offset += self.pos elif whence == 2: for packet in self.orig_packets: offset += len(packet) else: assert whence == 0 self.packets = list(self.orig_packets) self.pos = 0 while self.pos < offset: data = self.read(offset - self.pos) if not data: break assert self.pos == offset def read(self, n): try: data = self.packets.pop(0) except IndexError: return "" if len(data) > n: data, rest = data[:n], data[n:] self.packets.insert(0, rest) self.pos += len(data) return data class TestWriter(object): def __init__(self): self.buf = "" self.pos = 0 def write(self, data): if self.pos >= len(self.buf): self.buf += "\0" * (self.pos - len(self.buf)) + data self.pos = len(self.buf) else: self.buf = (self.buf[:self.pos] + data + self.buf[self.pos + len(data):]) self.pos += len(data) def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 0: pass elif whence == 1: offset += self.pos elif whence == 2: offset += len(self.buf) else: raise ValueError, "whence should be 0, 1 or 2" if offset < 0: offset = 0 self.pos = offset class BufferingInputStreamTests(unittest.TestCase): packets = ["a", "b", "\n", "def", "\nxy\npq\nuv", "wx"] lines = ["ab\n", "def\n", "xy\n", "pq\n", "uvwx"] def setUp(self): pass def makeStream(self, tell=False, seek=False, bufsize=None): base = TestSource(self.packets) if not tell: base.tell = None if not seek: base.seek = None return sio.BufferingInputStream(base, bufsize) def test_readline(self): file = self.makeStream() self.assertEqual(list(iter(file.readline, "")), self.lines) def test_readlines(self): # This also tests next() and __iter__() file = self.makeStream() self.assertEqual(file.readlines(), self.lines) def test_readlines_small_bufsize(self): file = self.makeStream(bufsize=1) self.assertEqual(list(file), self.lines) def test_readall(self): file = self.makeStream() self.assertEqual(file.readall(), "".join(self.lines)) def test_readall_small_bufsize(self): file = self.makeStream(bufsize=1) self.assertEqual(file.readall(), "".join(self.lines)) def test_readall_after_readline(self): file = self.makeStream() self.assertEqual(file.readline(), self.lines[0]) self.assertEqual(file.readline(), self.lines[1]) self.assertEqual(file.readall(), "".join(self.lines[2:])) def test_read_1_after_readline(self): file = self.makeStream() self.assertEqual(file.readline(), "ab\n") self.assertEqual(file.readline(), "def\n") blocks = [] while 1: block = file.read(1) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, list("".join(self.lines)[7:])) def test_read_1(self): file = self.makeStream() blocks = [] while 1: block = file.read(1) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, list("".join(self.lines))) def test_read_2(self): file = self.makeStream() blocks = [] while 1: block = file.read(2) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, ["ab", "\nd", "ef", "\nx", "y\n", "pq", "\nu", "vw", "x"]) def test_read_4(self): file = self.makeStream() blocks = [] while 1: block = file.read(4) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, ["ab\nd", "ef\nx", "y\npq", "\nuvw", "x"]) def test_read_4_after_readline(self): file = self.makeStream() self.assertEqual(file.readline(), "ab\n") self.assertEqual(file.readline(), "def\n") blocks = [file.read(4)] while 1: block = file.read(4) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, ["xy\np", "q\nuv", "wx"]) def test_read_4_small_bufsize(self): file = self.makeStream(bufsize=1) blocks = [] while 1: block = file.read(4) if not block: break blocks.append(block) self.assertEqual(blocks, ["ab\nd", "ef\nx", "y\npq", "\nuvw", "x"]) def test_tell_1(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.read(1)) if not n: break pos += n def test_tell_1_after_readline(self): file = self.makeStream(tell=True) pos = 0 pos += len(file.readline()) self.assertEqual(file.tell(), pos) pos += len(file.readline()) self.assertEqual(file.tell(), pos) while 1: self.assertEqual(file.tell(), pos) n = len(file.read(1)) if not n: break pos += n def test_tell_2(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.read(2)) if not n: break pos += n def test_tell_4(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.read(4)) if not n: break pos += n def test_tell_readline(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.readline()) if not n: break pos += n def test_seek(self): file = self.makeStream(tell=True, seek=True) all = file.readall() end = len(all) for readto in range(0, end+1): for seekto in range(0, end+1): for whence in 0, 1, 2: file.seek(0) self.assertEqual(file.tell(), 0) head = file.read(readto) self.assertEqual(head, all[:readto]) if whence == 1: offset = seekto - readto elif whence == 2: offset = seekto - end else: offset = seekto file.seek(offset, whence) here = file.tell() self.assertEqual(here, seekto) rest = file.readall() self.assertEqual(rest, all[seekto:]) def test_seek_noseek(self): file = self.makeStream() all = file.readall() end = len(all) for readto in range(0, end+1): for seekto in range(readto, end+1): for whence in 1, 2: file = self.makeStream() head = file.read(readto) self.assertEqual(head, all[:readto]) if whence == 1: offset = seekto - readto elif whence == 2: offset = seekto - end file.seek(offset, whence) rest = file.readall() self.assertEqual(rest, all[seekto:]) class CRLFFilterTests(unittest.TestCase): def test_filter(self): packets = ["abc\ndef\rghi\r\nxyz\r", "123\r", "\n456"] expected = ["abc\ndef\nghi\nxyz\n", "123\n", "456"] crlf = sio.CRLFFilter(TestSource(packets)) blocks = [] while 1: block = crlf.read(100) if not block: break blocks.append(block) self.assertEqual(blocks, expected) class MMapFileTests(BufferingInputStreamTests): tfn = None def tearDown(self): tfn = self.tfn if tfn: self.tfn = None try: os.remove(self.tfn) except os.error, msg: print "can't remove %s: %s" % (tfn, msg) def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): self.tfn = tempfile.mktemp() f = open(tfn, "wb") f.writelines(self.packets) f.close() return sio.MMapFile(self.tfn, mode) def test_write(self): file = self.makeStream(mode="w") file.write("BooHoo\n") file.write("Barf\n") file.writelines(["a\n", "b\n", "c\n"]) self.assertEqual(file.tell(), len("BooHoo\nBarf\na\nb\nc\n")) file.seek(0) self.assertEqual(file.read(), "BooHoo\nBarf\na\nb\nc\n") file.seek(0) self.assertEqual(file.readlines(), ["BooHoo\n", "Barf\n", "a\n", "b\n", "c\n"]) self.assertEqual(file.tell(), len("BooHoo\nBarf\na\nb\nc\n")) class TextInputFilterTests(unittest.TestCase): packets = [ "foo\r", "bar\r", "\nfoo\r\n", "abc\ndef\rghi\r\nxyz", "\nuvw\npqr\r", "\n", "abc\n", ] expected = [ ("foo\n", 4), ("bar\n", 9), ("foo\n", 14), ("abc\ndef\nghi\nxyz", 30), ("\nuvw\npqr\n", 40), ("abc\n", 44), ("", 44), ("", 44), ] expected_with_tell = [ ("foo\n", 4), ("b", 5), ("ar\n", 9), ("foo\n", 14), ("abc\ndef\nghi\nxyz", 30), ("\nuvw\npqr\n", 40), ("abc\n", 44), ("", 44), ("", 44), ] def test_read(self): base = TestReader(self.packets) filter = sio.TextInputFilter(base) for data, pos in self.expected: self.assertEqual(filter.read(100), data) def test_read_tell(self): base = TestReader(self.packets) filter = sio.TextInputFilter(base) for data, pos in self.expected_with_tell: self.assertEqual(filter.read(100), data) self.assertEqual(filter.tell(), pos) self.assertEqual(filter.tell(), pos) # Repeat the tell() ! def test_seek(self): base = TestReader(self.packets) filter = sio.TextInputFilter(base) sofar = "" pairs = [] while True: pairs.append((sofar, filter.tell())) c = filter.read(1) if not c: break self.assertEqual(len(c), 1) sofar += c all = sofar for i in range(len(pairs)): sofar, pos = pairs[i] filter.seek(pos) self.assertEqual(filter.tell(), pos) self.assertEqual(filter.tell(), pos) bufs = [sofar] while True: data = filter.read(100) if not data: self.assertEqual(filter.read(100), "") break bufs.append(data) self.assertEqual("".join(bufs), all) class TextOutputFilterTests(unittest.TestCase): def test_write_nl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("abc") filter.write("def\npqr\nuvw") filter.write("\n123\n") self.assertEqual(base.buf, "abcdef\npqr\nuvw\n123\n") def test_write_cr(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r") filter.write("abc") filter.write("def\npqr\nuvw") filter.write("\n123\n") self.assertEqual(base.buf, "abcdef\rpqr\ruvw\r123\r") def test_write_crnl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r\n") filter.write("abc") filter.write("def\npqr\nuvw") filter.write("\n123\n") self.assertEqual(base.buf, "abcdef\r\npqr\r\nuvw\r\n123\r\n") def test_write_tell_nl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("xxx") self.assertEqual(filter.tell(), 3) filter.write("\nabc\n") self.assertEqual(filter.tell(), 8) def test_write_tell_cr(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r") filter.write("xxx") self.assertEqual(filter.tell(), 3) filter.write("\nabc\n") self.assertEqual(filter.tell(), 8) def test_write_tell_crnl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r\n") filter.write("xxx") self.assertEqual(filter.tell(), 3) filter.write("\nabc\n") self.assertEqual(filter.tell(), 10) def test_write_seek(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("x"*100) filter.seek(50) filter.write("y"*10) self.assertEqual(base.buf, "x"*50 + "y"*10 + "x"*40) class DecodingInputFilterTests(unittest.TestCase): def test_read(self): chars = u"abc\xff\u1234\u4321\x80xyz" data = chars.encode("utf8") base = TestReader([data]) filter = sio.DecodingInputFilter(base) bufs = [] for n in range(1, 11): while 1: c = filter.read(n) self.assertEqual(type(c), unicode) if not c: break bufs.append(c) self.assertEqual(u"".join(bufs), chars) class EncodingOutputFilterTests(unittest.TestCase): def test_write(self): chars = u"abc\xff\u1234\u4321\x80xyz" data = chars.encode("utf8") for n in range(1, 11): base = TestWriter() filter = sio.EncodingOutputFilter(base) pos = 0 while 1: c = chars[pos:pos+n] if not c: break pos += len(c) filter.write(c) self.assertEqual(base.buf, data) # Speed test FN = "BIG" def timeit(fn=FN): f = sio.MMapFile(fn, "r") lines = bytes = 0 t0 = time.clock() for line in f: lines += 1 bytes += len(line) t1 = time.clock() print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) def timeold(fn=FN): f = open(fn, "rb") lines = bytes = 0 t0 = time.clock() for line in f: lines += 1 bytes += len(line) t1 = time.clock() print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) # Functional test def main(): f = sio.DiskFile("sio.py") f = sio.DecodingInputFilter(f) f = sio.TextInputFilter(f) f = sio.BufferingInputStream(f) for i in range(10): print repr(f.readline()) # Unit test main program def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(BufferingInputStreamTests)) suite.addTest(unittest.makeSuite(CRLFFilterTests)) ##suite.addTest(unittest.makeSuite(MMapFileTests)) suite.addTest(unittest.makeSuite(TextInputFilterTests)) suite.addTest(unittest.makeSuite(TextOutputFilterTests)) suite.addTest(unittest.makeSuite(DecodingInputFilterTests)) suite.addTest(unittest.makeSuite(EncodingOutputFilterTests)) test_support.run_suite(suite) if __name__ == "__main__": test_main() From jhylton@users.sourceforge.net Wed Apr 9 22:25:34 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:25:34 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.143,2.144 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18000 Modified Files: cPickle.c Log Message: Make Unpickler objects colletable. Bugfix candidate. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.143 retrieving revision 2.144 diff -C2 -d -r2.143 -r2.144 *** cPickle.c 9 Apr 2003 21:05:12 -0000 2.143 --- cPickle.c 9 Apr 2003 21:25:30 -0000 2.144 *************** *** 5118,5122 **** Unpicklerobject *self; ! if (!( self = PyObject_New(Unpicklerobject, &Unpicklertype))) return NULL; --- 5118,5122 ---- Unpicklerobject *self; ! if (!( self = PyObject_GC_New(Unpicklerobject, &Unpicklertype))) return NULL; *************** *** 5171,5174 **** --- 5171,5175 ---- } } + PyObject_GC_Track(self); return self; *************** *** 5194,5197 **** --- 5195,5199 ---- Unpickler_dealloc(Unpicklerobject *self) { + PyObject_GC_UnTrack((PyObject *)self); Py_XDECREF(self->readline); Py_XDECREF(self->read); *************** *** 5211,5217 **** } ! PyObject_Del(self); } static PyObject * --- 5213,5257 ---- } ! PyObject_GC_Del(self); ! } ! ! static int ! Unpickler_traverse(Unpicklerobject *self, visitproc visit, void *arg) ! { ! int err; ! ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->readline); ! VISIT(self->read); ! VISIT(self->file); ! VISIT(self->memo); ! VISIT(self->stack); ! VISIT(self->pers_func); ! VISIT(self->arg); ! VISIT(self->last_string); ! #undef VISIT ! return 0; } + static int + Unpickler_clear(Unpicklerobject *self) + { + #define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL + CLEAR(self->readline); + CLEAR(self->read); + CLEAR(self->file); + CLEAR(self->memo); + CLEAR(self->stack); + CLEAR(self->pers_func); + CLEAR(self->arg); + CLEAR(self->last_string); + #undef CLEAR + return 0; + } static PyObject * *************** *** 5411,5435 **** static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cPickle.Unpickler", /*tp_name*/ ! sizeof(Unpicklerobject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ ! /* methods */ ! (destructor)Unpickler_dealloc, /*tp_dealloc*/ ! (printfunc)0, /*tp_print*/ ! (getattrfunc)Unpickler_getattr, /*tp_getattr*/ ! (setattrfunc)Unpickler_setattr, /*tp_setattr*/ ! (cmpfunc)0, /*tp_compare*/ ! (reprfunc)0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)0, /*tp_hash*/ ! (ternaryfunc)0, /*tp_call*/ ! (reprfunc)0, /*tp_str*/ ! ! /* Space for future expansion */ ! 0L,0L,0L,0L, ! Unpicklertype__doc__ /* Documentation string */ }; --- 5451,5477 ---- static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cPickle.Unpickler", /*tp_name*/ ! sizeof(Unpicklerobject), /*tp_basicsize*/ ! 0, ! (destructor)Unpickler_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! (getattrfunc)Unpickler_getattr, /* tp_getattr */ ! (setattrfunc)Unpickler_setattr, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, ! Unpicklertype__doc__, /* tp_doc */ ! (traverseproc)Unpickler_traverse, /* tp_traverse */ ! (inquiry)Unpickler_clear, /* tp_clear */ }; From gvanrossum@users.sourceforge.net Wed Apr 9 22:46:57 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:46:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv26834 Modified Files: sio.py Log Message: Make MMapFile work a bit better on Unix; this requires using fstat() to find out the size since specifying 0 for the initial size doesn't work. But writing to an file that starts out empty doesn't work on Unix, because the mmap module's test for writability fails if size==0. :-( Index: sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/sio.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sio.py 9 Apr 2003 21:17:41 -0000 1.1 --- sio.py 9 Apr 2003 21:46:54 -0000 1.2 *************** *** 292,296 **** flag |= os.O_BINARY self.fd = os.open(filename, flag) ! self.mm = mmap.mmap(self.fd, 0, access=self.access) self.pos = 0 --- 292,297 ---- flag |= os.O_BINARY self.fd = os.open(filename, flag) ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) self.pos = 0 *************** *** 332,336 **** del data # File grew since opened; remap to get the new data ! self.mm = mmap.mmap(self.fd, 0, access=self.access) data = self.mm[self.pos:aim] self.pos += len(data) --- 333,338 ---- del data # File grew since opened; remap to get the new data ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) data = self.mm[self.pos:aim] self.pos += len(data) *************** *** 347,351 **** return data # Remap the file just in case ! self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: --- 349,354 ---- return data # Remap the file just in case ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: *************** *** 366,370 **** return data # Remap the file just in case ! self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: --- 369,374 ---- return data # Remap the file just in case ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: *************** *** 387,391 **** try: self.mm[self.pos:end] = data ! except IndexError: self.mm.resize(end) self.mm[self.pos:end] = data --- 391,397 ---- try: self.mm[self.pos:end] = data ! # This can raise IndexError on Windows, ValueError on Unix ! except (IndexError, ValueError): ! # XXX On Unix, this resize() call doesn't work self.mm.resize(end) self.mm[self.pos:end] = data From gvanrossum@users.sourceforge.net Wed Apr 9 22:47:57 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:47:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio test_sio.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv27191 Modified Files: test_sio.py Log Message: MMapFileTests now works, except for writing on Unix. Index: test_sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/test_sio.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sio.py 9 Apr 2003 21:17:41 -0000 1.1 --- test_sio.py 9 Apr 2003 21:47:54 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- """Unit tests for sio (new standard I/O).""" + import os import time import tempfile *************** *** 122,128 **** lines = ["ab\n", "def\n", "xy\n", "pq\n", "uvwx"] - def setUp(self): - pass - def makeStream(self, tell=False, seek=False, bufsize=None): base = TestSource(self.packets) --- 123,126 ---- *************** *** 348,352 **** self.tfn = None try: ! os.remove(self.tfn) except os.error, msg: print "can't remove %s: %s" % (tfn, msg) --- 346,350 ---- self.tfn = None try: ! os.remove(tfn) except os.error, msg: print "can't remove %s: %s" % (tfn, msg) *************** *** 354,358 **** def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): self.tfn = tempfile.mktemp() ! f = open(tfn, "wb") f.writelines(self.packets) f.close() --- 352,356 ---- def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): self.tfn = tempfile.mktemp() ! f = open(self.tfn, "wb") f.writelines(self.packets) f.close() *************** *** 360,363 **** --- 358,363 ---- def test_write(self): + if os.name == "posix": + return # write() does't work on Unix :-( file = self.makeStream(mode="w") file.write("BooHoo\n") *************** *** 578,582 **** suite.addTest(unittest.makeSuite(BufferingInputStreamTests)) suite.addTest(unittest.makeSuite(CRLFFilterTests)) ! ##suite.addTest(unittest.makeSuite(MMapFileTests)) suite.addTest(unittest.makeSuite(TextInputFilterTests)) suite.addTest(unittest.makeSuite(TextOutputFilterTests)) --- 578,582 ---- suite.addTest(unittest.makeSuite(BufferingInputStreamTests)) suite.addTest(unittest.makeSuite(CRLFFilterTests)) ! suite.addTest(unittest.makeSuite(MMapFileTests)) suite.addTest(unittest.makeSuite(TextInputFilterTests)) suite.addTest(unittest.makeSuite(TextOutputFilterTests)) From gvanrossum@users.sourceforge.net Thu Apr 10 02:00:07 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 18:00:07 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv1321 Modified Files: sio.py Log Message: Add class variables mm and fd so that close() and hence __del__() will work even if __init__() failed. Index: sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/sio.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sio.py 9 Apr 2003 21:46:54 -0000 1.2 --- sio.py 10 Apr 2003 01:00:04 -0000 1.3 *************** *** 299,302 **** --- 299,304 ---- self.close() + mm = fd = None + def close(self): if self.mm is not None: From gvanrossum@users.sourceforge.net Thu Apr 10 02:00:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 18:00:55 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio test_sio.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv1683 Modified Files: test_sio.py Log Message: Improve the speed test. Index: test_sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/test_sio.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_sio.py 9 Apr 2003 21:47:54 -0000 1.2 --- test_sio.py 10 Apr 2003 01:00:53 -0000 1.3 *************** *** 542,547 **** FN = "BIG" ! def timeit(fn=FN): ! f = sio.MMapFile(fn, "r") lines = bytes = 0 t0 = time.clock() --- 542,547 ---- FN = "BIG" ! def timeit(fn=FN, opener=sio.MMapFile): ! f = opener(fn, "r") lines = bytes = 0 t0 = time.clock() *************** *** 550,568 **** bytes += len(line) t1 = time.clock() ! print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) ! def timeold(fn=FN): ! f = open(fn, "rb") ! lines = bytes = 0 ! t0 = time.clock() ! for line in f: ! lines += 1 ! bytes += len(line) ! t1 = time.clock() ! print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) # Functional test ! def main(): f = sio.DiskFile("sio.py") f = sio.DecodingInputFilter(f) --- 550,567 ---- bytes += len(line) t1 = time.clock() ! print "%d lines (%d bytes) in %.3f seconds for %s" % ( ! lines, bytes, t1-t0, opener.__name__) ! def speed_main(): ! def diskopen(fn, mode): ! base = sio.DiskFile(fn, mode) ! return sio.BufferingInputStream(base) ! timeit(opener=diskopen) ! timeit(opener=sio.MMapFile) ! timeit(opener=open) # Functional test ! def functional_main(): f = sio.DiskFile("sio.py") f = sio.DecodingInputFilter(f) From rhettinger@users.sourceforge.net Thu Apr 10 17:03:26 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 10 Apr 2003 09:03:26 -0700 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.135,2.136 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11764 Modified Files: timemodule.c Log Message: SF patch #718867: Fix reference leak for time.strptime (contributed by Brett Cannon) Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.135 retrieving revision 2.136 diff -C2 -d -r2.135 -r2.136 *** timemodule.c 14 Mar 2003 21:51:36 -0000 2.135 --- timemodule.c 10 Apr 2003 16:03:22 -0000 2.136 *************** *** 455,462 **** { PyObject *strptime_module = PyImport_ImportModule("_strptime"); if (!strptime_module) return NULL; ! return PyObject_CallMethod(strptime_module, "strptime", "O", args); } --- 455,465 ---- { PyObject *strptime_module = PyImport_ImportModule("_strptime"); + PyObject *strptime_result; if (!strptime_module) return NULL; ! strptime_result = PyObject_CallMethod(strptime_module, "strptime", "O", args); ! Py_DECREF(strptime_module); ! return strptime_result; } From montanaro@users.sourceforge.net Thu Apr 10 18:16:20 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 10 Apr 2003 10:16:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26542/test Modified Files: test_csv.py Log Message: hoist contents of csv submodule up to the package level Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_csv.py 21 Mar 2003 01:15:58 -0000 1.2 --- test_csv.py 10 Apr 2003 17:16:15 -0000 1.3 *************** *** 5,9 **** import unittest from StringIO import StringIO ! from csv import csv import gc from test.test_support import verbose --- 5,9 ---- import unittest from StringIO import StringIO ! import csv import gc from test.test_support import verbose From montanaro@users.sourceforge.net Thu Apr 10 18:16:20 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 10 Apr 2003 10:16:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/csv __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv In directory sc8-pr-cvs1:/tmp/cvs-serv26542/csv Modified Files: __init__.py Log Message: hoist contents of csv submodule up to the package level Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 20 Mar 2003 23:29:12 -0000 1.1 --- __init__.py 10 Apr 2003 17:16:14 -0000 1.2 *************** *** 1 **** --- 1,2 ---- + from csv import * From gvanrossum@users.sourceforge.net Thu Apr 10 21:29:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 10 Apr 2003 13:29:54 -0700 Subject: [Python-checkins] python/dist/src/Python errors.c,2.76,2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28485 Modified Files: errors.c Log Message: PyErr_NormalizeException(): in the type==NULL test, we should simply return. Setting an exception can mess with the exception state, and continuing is definitely wrong (since type is dereferenced later on). Some code that calls this seems to be prepared for a NULL exception type, so let's be safe rather than sorry and simply assume there's nothing to normalize in this case. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -d -r2.76 -r2.77 *** errors.c 19 Feb 2003 00:33:32 -0000 2.76 --- errors.c 10 Apr 2003 20:29:48 -0000 2.77 *************** *** 132,138 **** if (type == NULL) { ! /* This is a bug. Should never happen. Don't dump core. */ ! PyErr_SetString(PyExc_SystemError, ! "PyErr_NormalizeException() called without exception"); } --- 132,137 ---- if (type == NULL) { ! /* There was no exception, so nothing to do. */ ! return; } From gvanrossum@users.sourceforge.net Thu Apr 10 21:30:24 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 10 Apr 2003 13:30:24 -0700 Subject: [Python-checkins] python/dist/src/Python errors.c,2.66.10.1,2.66.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28810 Modified Files: Tag: release22-maint errors.c Log Message: Backport: PyErr_NormalizeException(): in the type==NULL test, we should simply return. Setting an exception can mess with the exception state, and continuing is definitely wrong (since type is dereferenced later on). Some code that calls this seems to be prepared for a NULL exception type, so let's be safe rather than sorry and simply assume there's nothing to normalize in this case. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.66.10.1 retrieving revision 2.66.10.2 diff -C2 -d -r2.66.10.1 -r2.66.10.2 *** errors.c 3 Mar 2002 21:32:01 -0000 2.66.10.1 --- errors.c 10 Apr 2003 20:30:18 -0000 2.66.10.2 *************** *** 132,138 **** if (type == NULL) { ! /* This is a bug. Should never happen. Don't dump core. */ ! PyErr_SetString(PyExc_SystemError, ! "PyErr_NormalizeException() called without exception"); } --- 132,137 ---- if (type == NULL) { ! /* There was no exception, so nothing to do. */ ! return; } From nnorwitz@users.sourceforge.net Thu Apr 10 22:51:32 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 14:51:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv20908/Doc/ref Modified Files: ref5.tex Log Message: Add a space after expression to be consistent Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** ref5.tex 16 Dec 2002 13:54:01 -0000 1.71 --- ref5.tex 10 Apr 2003 21:51:29 -0000 1.72 *************** *** 158,162 **** \production{listmaker} {\token{expression} ( \token{list_for} ! | ( "," \token{expression})* [","] )} \production{list_iter} {\token{list_for} | \token{list_if}} --- 158,162 ---- \production{listmaker} {\token{expression} ( \token{list_for} ! | ( "," \token{expression} )* [","] )} \production{list_iter} {\token{list_for} | \token{list_if}} From nnorwitz@users.sourceforge.net Thu Apr 10 22:53:16 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 14:53:16 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.182,2.183 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22457/Python Modified Files: pythonrun.c Log Message: Move declaration of enc to scope where it is used Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.182 retrieving revision 2.183 diff -C2 -d -r2.182 -r2.183 *** pythonrun.c 19 Mar 2003 00:35:36 -0000 2.182 --- pythonrun.c 10 Apr 2003 21:53:14 -0000 2.183 *************** *** 191,199 **** char *saved_locale = setlocale(LC_CTYPE, NULL); char *codeset; - PyObject *enc = NULL; setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); if (*codeset) { ! enc = PyCodec_Encoder(codeset); if (enc) { Py_FileSystemDefaultEncoding = strdup(codeset); --- 191,198 ---- char *saved_locale = setlocale(LC_CTYPE, NULL); char *codeset; setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); if (*codeset) { ! PyObject *enc = PyCodec_Encoder(codeset); if (enc) { Py_FileSystemDefaultEncoding = strdup(codeset); From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:33 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Doc/lib Modified Files: libstring.tex Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** libstring.tex 12 Sep 2002 14:16:07 -0000 1.48 --- libstring.tex 10 Apr 2003 22:35:29 -0000 1.49 *************** *** 244,247 **** --- 244,249 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 252,255 **** --- 254,259 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 260,263 **** --- 264,269 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in 2.2 or 2.2.1]{2.2.2} \end{funcdesc} From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:34 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Lib/test Modified Files: string_tests.py Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** string_tests.py 31 Mar 2003 18:07:50 -0000 1.30 --- string_tests.py 10 Apr 2003 22:35:31 -0000 1.31 *************** *** 196,199 **** --- 196,226 ---- self.checkequal('hello', 'hello', 'strip') + # strip/lstrip/rstrip with None arg + self.checkequal('hello', ' hello ', 'strip', None) + self.checkequal('hello ', ' hello ', 'lstrip', None) + self.checkequal(' hello', ' hello ', 'rstrip', None) + self.checkequal('hello', 'hello', 'strip', None) + + # strip/lstrip/rstrip with str arg + self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz') + self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz') + self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz') + self.checkequal('hello', 'hello', 'strip', 'xyz') + + # strip/lstrip/rstrip with unicode arg + if test_support.have_unicode: + self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', + 'strip', unicode('xyz', 'ascii')) + self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', + 'lstrip', unicode('xyz', 'ascii')) + self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', + 'rstrip', unicode('xyz', 'ascii')) + self.checkequal(unicode('hello', 'ascii'), 'hello', + 'strip', unicode('xyz', 'ascii')) + + self.checkraises(TypeError, 'hello', 'strip', 42, 42) + self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) + self.checkraises(TypeError, 'hello', 'rstrip', 42, 42) + def test_ljust(self): self.checkequal('abc ', 'abc', 'ljust', 10) *************** *** 432,463 **** self.checkraises(TypeError, 'hello', 'endswith') self.checkraises(TypeError, 'hello', 'endswith', 42) - - def test_strip_args(self): - # strip/lstrip/rstrip with None arg - self.checkequal('hello', ' hello ', 'strip', None) - self.checkequal('hello ', ' hello ', 'lstrip', None) - self.checkequal(' hello', ' hello ', 'rstrip', None) - self.checkequal('hello', 'hello', 'strip', None) - - # strip/lstrip/rstrip with str arg - self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz') - self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz') - self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz') - self.checkequal('hello', 'hello', 'strip', 'xyz') - - # strip/lstrip/rstrip with unicode arg - if test_support.have_unicode: - self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', - 'strip', unicode('xyz', 'ascii')) - self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', - 'lstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', - 'rstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('hello', 'ascii'), 'hello', - 'strip', unicode('xyz', 'ascii')) - - self.checkraises(TypeError, 'hello', 'strip', 42, 42) - self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) - self.checkraises(TypeError, 'hello', 'rstrip', 42, 42) def test___contains__(self): --- 459,462 ---- From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:34 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:34 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.16,1.17 string.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Lib Modified Files: UserString.py string.py Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UserString.py 18 Nov 2002 16:12:54 -0000 1.16 --- UserString.py 10 Apr 2003 22:35:31 -0000 1.17 *************** *** 100,104 **** def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, sep=None): return self.__class__(self.data.lstrip(sep)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) --- 100,104 ---- def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) *************** *** 108,112 **** return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, sep=None): return self.__class__(self.data.rstrip(sep)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) --- 108,112 ---- return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) *************** *** 114,118 **** def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, sep=None): return self.__class__(self.data.strip(sep)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) --- 114,118 ---- def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, chars=None): return self.__class__(self.data.strip(chars)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** string.py 14 Nov 2002 03:31:32 -0000 1.67 --- string.py 10 Apr 2003 22:35:31 -0000 1.68 *************** *** 80,84 **** Return a copy of the string s with leading and trailing whitespace removed. ! If chars is given and not None, remove characters in sep instead. If chars is unicode, S will be converted to unicode before stripping. --- 80,84 ---- Return a copy of the string s with leading and trailing whitespace removed. ! If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping. *************** *** 87,107 **** # Strip leading tabs and spaces ! def lstrip(s): ! """lstrip(s) -> string Return a copy of the string s with leading whitespace removed. """ ! return s.lstrip() # Strip trailing tabs and spaces ! def rstrip(s): ! """rstrip(s) -> string ! Return a copy of the string s with trailing whitespace ! removed. """ ! return s.rstrip() --- 87,108 ---- # Strip leading tabs and spaces ! def lstrip(s, chars=None): ! """lstrip(s [,chars]) -> string Return a copy of the string s with leading whitespace removed. + If chars is given and not None, remove characters in chars instead. """ ! return s.lstrip(chars) # Strip trailing tabs and spaces ! def rstrip(s, chars=None): ! """rstrip(s [,chars]) -> string ! Return a copy of the string s with trailing whitespace removed. ! If chars is given and not None, remove characters in chars instead. """ ! return s.rstrip(chars) From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:35 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:35 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.207,2.208 unicodeobject.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.207 retrieving revision 2.208 diff -C2 -d -r2.207 -r2.208 *** stringobject.c 9 Apr 2003 19:31:57 -0000 2.207 --- stringobject.c 10 Apr 2003 22:35:32 -0000 2.208 *************** *** 1771,1780 **** PyDoc_STRVAR(strip__doc__, ! "S.strip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"); static PyObject * --- 1771,1780 ---- PyDoc_STRVAR(strip__doc__, ! "S.strip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"); static PyObject * *************** *** 1789,1797 **** PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"); static PyObject * --- 1789,1797 ---- PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"); static PyObject * *************** *** 1806,1814 **** PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"); static PyObject * --- 1806,1814 ---- PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"); static PyObject * Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** unicodeobject.c 9 Apr 2003 19:32:45 -0000 2.186 --- unicodeobject.c 10 Apr 2003 22:35:32 -0000 2.187 *************** *** 5248,5257 **** PyDoc_STRVAR(strip__doc__, ! "S.strip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"); static PyObject * --- 5248,5257 ---- PyDoc_STRVAR(strip__doc__, ! "S.strip([chars]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"); static PyObject * *************** *** 5266,5274 **** PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"); static PyObject * --- 5266,5274 ---- PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([chars]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"); static PyObject * *************** *** 5283,5291 **** PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"); static PyObject * --- 5283,5291 ---- PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([chars]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"); static PyObject * From nnorwitz@users.sourceforge.net Fri Apr 11 04:05:58 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 20:05:58 -0700 Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11875/Lib Modified Files: tarfile.py Log Message: Fix test_tarfile failure when gzip is not available The module would exist, but be empty if already imported. This change ensures we have gzip available. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tarfile.py 7 Mar 2003 15:36:41 -0000 1.6 --- tarfile.py 11 Apr 2003 03:05:56 -0000 1.7 *************** *** 924,928 **** try: import gzip ! except ImportError: raise CompressionError, "gzip module is not available" --- 924,929 ---- try: import gzip ! gzip.GzipFile ! except (ImportError, AttributeError): raise CompressionError, "gzip module is not available" From gvanrossum@users.sourceforge.net Fri Apr 11 15:17:24 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 11 Apr 2003 07:17:24 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv22310 Modified Files: sio.py Log Message: Document more missing API aspects. Index: sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/sio.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sio.py 10 Apr 2003 01:00:04 -0000 1.3 --- sio.py 11 Apr 2003 14:17:20 -0000 1.4 *************** *** 23,29 **** next(). (There's also readall() but that's a synonym for read() without arguments.) This is a superset of the raw stream API. I ! haven't thought about fileno() and isatty() yet. We really need ! only one buffering stream implementation, which is a filtering ! stream. You typically take a basis stream, place zero or more filtering --- 23,30 ---- next(). (There's also readall() but that's a synonym for read() without arguments.) This is a superset of the raw stream API. I ! haven't thought about fileno() and isatty() yet, nor about ! truncate() or the various attributes like name and mode. Also, ! close() is not implemented right. We really need only one buffering ! stream implementation, which is a filtering stream. You typically take a basis stream, place zero or more filtering From fdrake@users.sourceforge.net Fri Apr 11 16:14:09 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:14:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_timeout.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19216 Modified Files: test_timeout.py Log Message: Avoid creating one of the TestSuite objects. Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_timeout.py 28 Feb 2003 19:53:34 -0000 1.12 --- test_timeout.py 11 Apr 2003 15:14:05 -0000 1.13 *************** *** 188,193 **** test_support.requires('network') ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(CreationTestCase)) suite.addTest(unittest.makeSuite(TimeoutTestCase)) test_support.run_suite(suite) --- 188,192 ---- test_support.requires('network') ! suite = unittest.makeSuite(CreationTestCase) suite.addTest(unittest.makeSuite(TimeoutTestCase)) test_support.run_suite(suite) From jackjansen@users.sourceforge.net Fri Apr 11 16:35:32 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:35:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libaetools.tex,NONE,1.1 libgensuitemodule.tex,NONE,1.1 scripting.tex,NONE,1.1 libaepack.tex,1.2,1.3 libaetypes.tex,1.1,1.2 mac.tex,1.10,1.11 using.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv30924/mac Modified Files: libaepack.tex libaetypes.tex mac.tex using.tex Added Files: libaetools.tex libgensuitemodule.tex scripting.tex Log Message: Moved all the scripting stuff to a separate section, added all the missing bits (well, all the bits I could think of) and updated the rest. --- NEW FILE: libaetools.tex --- \section{\module{aetools} --- OSA client support} \declaremodule{standard}{aetools} \platform{Mac} %\moduleauthor{Jack Jansen?}{email} \modulesynopsis{Basic support for sending Apple Events} \sectionauthor{Jack Jansen}{Jack.Jansen@cwi.nl} The \module{aetools} module contains the basic functionality on which Python AppleScript client support is built. It also imports and re-exports the core functionality of the \module{aetypes} and \module{aepack} modules. The stub packages generated by \module{gensuitemodule} import the relevant portions of \module{aetools}, so usually you do not need to import it yourself. The exception to this is when you cannot use a generated suite package and need lower-level access to scripting. The \module{aetools} module itself uses the AppleEvent support provided by the \module{Carbon.AE} module. This has one drawback: you need access to the window manager, see section \ref{osx-gui-scripts} for details. This restriction may be lifted in future releases. The \module{aetools} module defines the following functions: \begin{funcdesc}{packevent}{ae, parameters, attributes} Stores parameters and attributes in a pre-created \code{Carbon.AE.AEDesc} object. \code{parameters} and \code{attributes} are dictionaries mapping 4-character OSA parameter keys to Python objects. The objects are packed using \code{aepack.pack()}. \end{funcdesc} \begin{funcdesc}{unpackevent}{ae\optional{, formodulename}} Recursively unpacks a \code{Carbon.AE.AEDesc} event to Python objects. The function returns the parameter dictionary and the attribute dictionary. The \code{formodulename} argument is used by generated stub packages to control where AppleScript classes are looked up. \end{funcdesc} \begin{funcdesc}{keysubst}{arguments, keydict} Converts a Python keyword argument dictionary \code{arguments} to the format required by \code{packevent} by replacing the keys, which are Python identifiers, by the four-character OSA keys according to the mapping specified in \code{keydict}. Used by the generated suite packages. \end{funcdesc} \begin{funcdesc}{enumsubst}{arguments, key, edict} If the \code{arguments} dictionary contains an entry for \code{key} convert the value for that entry according to dictionary \code{edict}. This converts human-readable Python enumeration names to the OSA 4-character codes. Used by the generated suite packages. \end{funcdesc} The \module{aetools} module defines the following class: \begin{classdesc}{TalkTo}{\optional{signature=None, start=0, timeout=0}} Base class for the proxy used to talk to an application. \code{signature} overrides the class attribute \code{_signature} (which is usually set by subclasses) and is the 4-char creator code defining the application to talk to. \code{start} can be set to true to enable running the application on class instantiation. \code{timeout} can be specified to change the default timeout used while waiting for an AppleEvent reply. \end{classdesc} \begin{methoddesc}{_start}{} Test whether the application is running, and attempt to start it if not. \end{methoddesc} \begin{methoddesc}{send}{code, subcode\optional{, parameters, attributes}} Create the AppleEvent \code{Carbon.AE.AEDesc} for the verb with the OSA designation \code{code, subcode} (which are the usual 4-character strings), pack the \code{parameters} and \code{attributes} into it, send it to the target application, wait for the reply, unpack the reply with \code{unpackevent} and return the reply appleevent, the unpacked return values as a dictionary and the return attributes. \end{methoddesc} --- NEW FILE: libgensuitemodule.tex --- \section{\module{gensuitemodule} --- Generate OSA stub packages} \declaremodule{standard}{gensuitemodule} \platform{Mac} %\moduleauthor{Jack Jansen?}{email} \modulesynopsis{Create a stub package from an OSA dictionary} \sectionauthor{Jack Jansen}{Jack.Jansen@cwi.nl} The \module{gensuitemodule} module creates a Python package implementing stub code for the AppleScript suites that are implemented by a specific application, according to its AppleScript dictionary. It is usually invoked by the user through the \program{PythonIDE}, but it can also be run as a script from the command line (pass \code{--help} for help on the options) or imported from Python code. For an example of its use see \file{Mac/scripts/genallsuites.py} in a source distribution, which generates the stub packages that are included in the standard library. It defines the following public functions: \begin{funcdesc}{is_scriptable}{application} Returns true if \code{application}, which should be passed as a pathname, appears to be scriptable. Take the return value with a grain of salt: \program{Internet Explorer} appears not to be scriptable but definitely is. \end{funcdesc} \begin{funcdesc}{processfile}{application\optional{, output, basepkgname, edit_modnames, creatorsignature, dump, verbose}} Create a stub package for \code{application}, which should be passed as a full pathname. For a \file{.app} bundle this is the pathname to the bundle, not to the executable inside the bundle; for an unbundled CFM application you pass the filename of the application binary. This function asks the application for its OSA terminology resources, decodes these resources and uses the resultant data to create the Python code for the package implementing the client stubs. \code{output} is the pathname where the resulting package is stored, if not specified a standard "save file as" dialog is presented to the user. \code{basepkgname} is the base package on which this package will build, and defaults to \module{StdSuites}. Only when generating \module{StdSuites} itself do you need to specify this. \code{edit_modnames} is a dictionary that can be used to change modulenames that are too ugly after name mangling. \code{creator_signature} can be used to override the 4-char creator code, which is normally obtained from the \file{PkgInfo} file in the package or from the CFM file creator signature. When \code{dump} is given it should refer to a file object, and \code{processfile} will stop after decoding the resources and dump the Python representation of the terminology resources to this file. \code{verbose} should also be a file object, and specifying it will cause \code{processfile} to tell you what it is doing. \end{funcdesc} \begin{funcdesc}{processfile_fromresource}{application\optional{, output, basepkgname, edit_modnames, creatorsignature, dump, verbose}} This function does the same as \code{processfile}, except that it uses a different method to get the terminology resources. It opens \code{application} as a resource file and reads all \code{"aete"} and \code{"aeut"} resources from this file. \end{funcdesc} --- NEW FILE: scripting.tex --- \chapter{MacPython OSA Modules \label{scripting}} Python has a fairly complete implementation of the Open Scripting Architecure (OSA, also commonly referred to as AppleScript), allowing you to control scriptable applications from your Python program, and with a fairly pythonic interface. For a description of the various components of AppleScript and OSA, and to get an understanding of the architecture and terminology, you should read Apple's documentation. The "Applescript Language Guide" explains the conceptual model and the terminology, and documents the standard suite. The "Open Scripting Architecture" document explains how to use OSA from an application programmers point of view. In the Apple Help Viewer these book sare located in the Developer Documentation, Core Technologies section. As an example of scripting an application, the following piece of AppleScript will get the name of the frontmost \program{Finder} window and print it: \begin{verbatim} tell application "Finder" get name of window 1 end tell \end{verbatim} In Python, the following code fragment will do the same: \begin{verbatim} import Finder f = Finder.Finder() print f.get(Finder.window(1).name) \end{verbatim} As distributed the Python library includes packages that implement the standard suites, plus packages that interface to a small number of common applications. To send AppleEvents to an application you must first create the Python package interfacing to the terminology of the application (what \program{Script Editor} calls the "Dictionary"). This can be done from within the \program{PythonIDE} or by running the \file{gensuitemodule.py} module as a standalone program from the command line. The generated output is a package with a number of modules, one for every suite used in the program plus an \module{__init__} module to glue it all together. The Python inheritance graph follows the AppleScript inheritance graph, so if a programs dictionary specifies that it includes support for the Standard Suite, but extends one or two verbs with extra arguments then the output suite will contain a module \module{Standard_Suite} that imports and re-exports everything from \module{StdSuites.Standard_Suite} but overrides the methods that have extra functionality. The output of \module{gensuitemodule} is pretty readable, and contains the documentation that was in the original AppleScript dictionary in Python docstrings, so reading it is a good source of documentation. The output package implements a main class with the same name as the package which contains all the AppleScript verbs as methods, with the direct object as the first argument and all optional parameters as keyword arguments. AppleScript classes are also implemented as Python classes, as are comparisons and all the other thingies. Note that in the current release there is no coupling between the main Python class implementing the verbs and the Python classes implementing the AppleScript classes. Hence, in the example above we need to use \code{f.get(Finder.window(1).name)} in stead of the more Pythonic \code{f.window(1).name.get()}. If an AppleScript identifier is not a Python identifier the name is mangled according to a small number of rules: \begin{itemize} \item spaces are replaced with underscores \item other non-alphanumeric characters are replaced with \code{_xx_} where \code{xx} is the hexadecimal character value \item any Python reserved word gets an underscore appended \end{itemize} Python also has support for creating scriptable applications in Python, but The following modules are relevant to MacPython AppleScript support: \localmoduletable In addition, support modules have been pre-generated for \module{Finder}, \module{Terminal}, \module{Explorer}, \module{Netscape}, \module{CodeWarrior}, \module{SystemEvents} and \module{StdSuites}. \input{libgensuitemodule} \input{libaetools} \input{libaepack} \input{libaetypes} \input{libminiae} Index: libaepack.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libaepack.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libaepack.tex 12 Feb 2003 09:58:33 -0000 1.2 --- libaepack.tex 11 Apr 2003 15:35:26 -0000 1.3 *************** *** 46,50 **** \end{funcdesc} ! \begin{funcdesc}{unpack}{x} \var{x} must be an object of type \class{AEDesc}. This function returns a Python object representation of the data in the Apple --- 46,50 ---- \end{funcdesc} ! \begin{funcdesc}{unpack}{x\optional{, formodulename}} \var{x} must be an object of type \class{AEDesc}. This function returns a Python object representation of the data in the Apple *************** *** 54,67 **** elements are recursively unpacked. Object references (ex. \code{line 3 of document 1}) are returned as instances of ! \class{aetypes.ObjectSpecifier}. AppleEvent descriptors with descriptor type typeFSS are returned as \class{FSSpec} objects. AppleEvent record descriptors are returned as Python ! dictionaries, with keys of type \class{?} and elements recursively unpacked. \end{funcdesc} \begin{seealso} ! \seemodule{AE}{Built-in access to Apple Event Manager routines.} \seemodule{aetypes}{Python definitions of codes for Apple Event descriptor types.} --- 54,77 ---- elements are recursively unpacked. Object references (ex. \code{line 3 of document 1}) are returned as instances of ! \class{aetypes.ObjectSpecifier}, unless \code{formodulename} ! is specified. AppleEvent descriptors with descriptor type typeFSS are returned as \class{FSSpec} objects. AppleEvent record descriptors are returned as Python ! dictionaries, with 4-character string keys and elements recursively unpacked. + + The optional \code{formodulename} argument is used by the stub packages + generated by \module{gensuitemodule}, and ensures that the OSA classes + for object specifiers are looked up in the correct module. This ensures + that if, say, the Finder returns an object specifier for a window + you get an instance of \code{Finder.Window} and not a generic + \code{aetypes.Window}. The former knows about all the properties + and elements a window has in the Finder, while the latter knows + no such things. \end{funcdesc} \begin{seealso} ! \seemodule{Carbon.AE}{Built-in access to Apple Event Manager routines.} \seemodule{aetypes}{Python definitions of codes for Apple Event descriptor types.} Index: libaetypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libaetypes.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libaetypes.tex 14 Oct 2000 05:06:24 -0000 1.1 --- libaetypes.tex 11 Apr 2003 15:35:27 -0000 1.2 *************** *** 9,39 **** ! The \module{aetypes} defines classes used to represent Apple Event ! object specifiers. An object specifier is essentially an address of an ! object implemented in a Apple Event server. An Apple Event specifier ! is used as the direct object for an Apple Event or as the argument of ! an optional parameter. In AppleScript an object specifier is ! represented by a phrase such as: ! \code{character 23 of document "Semprini"}. The classes defined in ! this module allow this specifier to be represented by a Python object ! which is initialized as follows: ! \code{res = Document(1).Character(23)} ! The \module{AEObjects} module defines the following class: ! \begin{classdesc}{ObjectSpecifier}{want, form, seld, from} ! This is the base class for representing object specifiers and is ! generally not constructed directly by the user. Its important ! functionality is to define an \function{__aepack__()} function, ! which returns the Apple Event descriptor containing the object ! specifier. Its data members, set directly from the constructor ! arguments, are: \end{classdesc} - \begin{memberdesc}{want} - A four character string representing the class code of the - object. These class codes are specified in Apple Event Suites; for - example the standard code for a character object is the 4 bytes - \samp{char}. - \end{memberdesc} --- 9,135 ---- ! The \module{aetypes} defines classes used to represent Apple Event data ! descriptors and Apple Event object specifiers. + Apple Event data is is contained in descriptors, and these descriptors + are typed. For many descriptors the Python representation is simply the + corresponding Python type: \code{typeText} in OSA is a Python string, + \code{typeFloat} is a float, etc. For OSA types that have no direct + Python counterpart this module declares classes. Packing and unpacking + instances of these classes is handled automatically by \module{aepack}. ! An object specifier is essentially an address of an object implemented ! in a Apple Event server. An Apple Event specifier is used as the direct ! object for an Apple Event or as the argument of an optional parameter. ! The \module{aetypes} module contains the base classes for OSA classes ! and properties, which are used by the packages generated by ! \module{gensuitemodule} to populate the classes and properties in a ! given suite. ! For reasons of backward compatibility, and for cases where you need to ! script an application for which you have not generated the stub package ! this module also contains object specifiers for a number of common OSA ! classes such as \code{Document}, \code{Window}, \code{Character}, etc. ! ! ! ! The \module{AEObjects} module defines the following classes to represent ! Apple Event descriptor data: ! ! \begin{classdesc}{Unknown}{type, data} ! The representation of OSA descriptor data for which the \module{aepack} ! and \module{aetypes} modules have no support, i.e. anything that is not ! represented by the other classes here and that is not equivalent to a ! simple Python value. ! \end{classdesc} ! ! \begin{classdesc}{Enum}{enum} ! An enumeration value with the given 4-character string value. ! \end{classdesc} ! ! \begin{classdesc}{InsertionLoc}{of, pos} ! Position \code{pos} in object \code{of}. ! \end{classdesc} ! ! \begin{classdesc}{Boolean}{bool} ! A boolean. ! \end{classdesc} ! ! \begin{classdesc}{StyledText}{style, text} ! Text with style information (font, face, etc) included. ! \end{classdesc} ! ! \begin{classdesc}{AEText}{script, style, text} ! Text with script system and style information included. ! \end{classdesc} ! ! \begin{classdesc}{IntlText}{script, language, text} ! Text with script system and language information included. ! \end{classdesc} ! ! \begin{classdesc}{IntlWritingCode}{script, language} ! Script system and language information. ! \end{classdesc} ! ! \begin{classdesc}{QDPoint}{v, h} ! A quickdraw point. ! \end{classdesc} ! ! \begin{classdesc}{QDRectangle}{v0, h0, v1, h1} ! A quickdraw rectangle. ! \end{classdesc} ! ! \begin{classdesc}{RGBColor}{r, g, b} ! A color. ! \end{classdesc} ! ! \begin{classdesc}{Type}{type} ! An OSA type value with the given 4-character name. ! \end{classdesc} ! ! \begin{classdesc}{Keyword}{name} ! An OSA keyword with the given 4-character name. ! \end{classdesc} ! ! \begin{classdesc}{Range}{start, stop} ! A range. ! \end{classdesc} ! ! \begin{classdesc}{Ordinal}{abso} ! Non-numeric absolute positions, such as \code{"firs"}, first, or \code{"midd"}, ! middle. ! \end{classdesc} ! ! \begin{classdesc}{Logical}{logc, term} ! The logical expression of applying operator \code{logc} to ! \code{term}. ! \end{classdesc} ! ! \begin{classdesc}{Comparison}{obj1, relo, obj2} ! The comparison \code{relo} of \code{obj1} to \code{obj2}. ! \end{classdesc} ! ! The following classes are used as base classes by the generated stub ! packages to represent AppleScript classes and properties in Python: ! ! \begin{classdesc}{ComponentItem}{which\optional{, fr}} ! Abstract baseclass for an OSA class. The subclass should set the class ! attribute \code{want} to the 4-character OSA class code. Instances of ! subclasses of this class are equivalent to AppleScript Object ! Specifiers. Upon instantiation you should pass a selector in ! \code{which}, and optionally a parent object in \code{fr}. ! \end{classdesc} ! ! \begin{classdesc}{NProperty}{fr} ! Abstract basclass for an OSA property. The subclass should set the class ! attributes \code{want} and \code{which} to designate which property we ! are talking about. Instances of subclasses of this class are Object ! Specifiers. ! \end{classdesc} ! ! \begin{classdesc}{ObjectSpecifier}{want, form, seld\optional{, fr}} ! Base class of \code{ComponentItem} and \code{NProperty}, a general ! OSA Object Specifier. See the Apple Open Scripting Architecture ! documentation for the parameters. Note that this class is not abstract. \end{classdesc} Index: mac.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/mac.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mac.tex 12 Feb 2003 09:58:33 -0000 1.10 --- mac.tex 11 Apr 2003 15:35:27 -0000 1.11 *************** *** 58,64 **** \input{libmacui} \input{libframework} ! \input{libminiae} ! \input{libaepack} ! \input{libaetypes} \input{toolbox} % MacOS Toolbox Modules --- 58,63 ---- \input{libmacui} \input{libframework} ! ! \input{scripting} \input{toolbox} % MacOS Toolbox Modules Index: using.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/using.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** using.tex 9 Apr 2003 15:12:38 -0000 1.7 --- using.tex 11 Apr 2003 15:35:28 -0000 1.8 *************** *** 68,75 **** \file{/usr/local/bin} is in your shell search path before \file{/usr/bin}, where the Apple-supplied Python lives (which is version 2.2, as of Mac OS X ! 10.2.4). There is one Mac OS X quirk that you need to be aware of: programs ! that talk to the window manager (in other words, anything that has a GUI) ! need to be run in a special way. Use \program{pythonw} in stead of \program{python} ! to start such scripts. To run your script from the Finder you have two options: --- 68,72 ---- \file{/usr/local/bin} is in your shell search path before \file{/usr/bin}, where the Apple-supplied Python lives (which is version 2.2, as of Mac OS X ! 10.2.4). To run your script from the Finder you have two options: *************** *** 84,87 **** --- 81,91 ---- Option-dragging allows you to change these for one invocation, or use its Preferences menu to change things globally. + + \subsection{Running scripts with a GUI \label{osx-gui-scripts}} + + There is one Mac OS X quirk that you need to be aware of: programs + that talk to the Aqua window manager (in other words, anything that has a GUI) + need to be run in a special way. Use \program{pythonw} in stead of \program{python} + to start such scripts. \subsection{configuration} From jackjansen@users.sourceforge.net Fri Apr 11 16:35:58 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:35:58 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.104,1.105 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv30924 Modified Files: Makefile.deps Log Message: Moved all the scripting stuff to a separate section, added all the missing bits (well, all the bits I could think of) and updated the rest. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** Makefile.deps 9 Apr 2003 03:25:07 -0000 1.104 --- Makefile.deps 11 Apr 2003 15:35:25 -0000 1.105 *************** *** 346,353 **** --- 346,356 ---- mac/mac.tex \ mac/using.tex \ + mac/scripting.tex \ mac/toolbox.tex \ mac/undoc.tex \ mac/libcolorpicker.tex \ mac/libmac.tex \ + mac/libgensuitemodule.tex \ + mac/libaetools.tex \ mac/libaepack.tex \ mac/libaetypes.tex \ From nnorwitz@users.sourceforge.net Fri Apr 11 16:35:57 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:35:57 -0700 Subject: [Python-checkins] python/dist/src configure,1.389,1.390 configure.in,1.400,1.401 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv30921 Modified Files: configure configure.in Log Message: SF patch #706707, time.tzset standards compliance update by Stuart Bishop Update configure and test to use proper timezone specifications Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.389 retrieving revision 1.390 diff -C2 -d -r1.389 -r1.390 *** configure 31 Mar 2003 15:53:30 -0000 1.389 --- configure 11 Apr 2003 15:35:40 -0000 1.390 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.398 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.400 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 16742,16749 **** time_t now; now = time((time_t*)NULL); ! putenv("TZ=GMT"); tzset(); gmt_hour = localtime(&now)->tm_hour; ! putenv("TZ=US/Eastern"); tzset(); eastern_hour = localtime(&now)->tm_hour; --- 16742,16749 ---- time_t now; now = time((time_t*)NULL); ! putenv("TZ=UTC+0"); tzset(); gmt_hour = localtime(&now)->tm_hour; ! putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); tzset(); eastern_hour = localtime(&now)->tm_hour; *************** *** 17829,17833 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 17829,17833 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.400 retrieving revision 1.401 diff -C2 -d -r1.400 -r1.401 *** configure.in 31 Mar 2003 15:53:49 -0000 1.400 --- configure.in 11 Apr 2003 15:35:52 -0000 1.401 *************** *** 2553,2560 **** time_t now; now = time((time_t*)NULL); ! putenv("TZ=GMT"); tzset(); gmt_hour = localtime(&now)->tm_hour; ! putenv("TZ=US/Eastern"); tzset(); eastern_hour = localtime(&now)->tm_hour; --- 2553,2560 ---- time_t now; now = time((time_t*)NULL); ! putenv("TZ=UTC+0"); tzset(); gmt_hour = localtime(&now)->tm_hour; ! putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); tzset(); eastern_hour = localtime(&now)->tm_hour; From nnorwitz@users.sourceforge.net Fri Apr 11 16:35:57 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:35:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_time.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30921/Lib/test Modified Files: test_time.py Log Message: SF patch #706707, time.tzset standards compliance update by Stuart Bishop Update configure and test to use proper timezone specifications Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_time.py 15 Mar 2003 12:01:52 -0000 1.13 --- test_time.py 11 Apr 2003 15:35:53 -0000 1.14 *************** *** 63,133 **** xmas2002 = 1040774400.0 org_TZ = environ.get('TZ',None) try: - # Make sure we can switch to UTC time and results are correct # Note that unknown timezones default to UTC. ! for tz in ('UTC','GMT','Luna/Tycho'): ! environ['TZ'] = 'US/Eastern' ! time.tzset() ! environ['TZ'] = tz ! time.tzset() ! self.failUnlessEqual( ! time.gmtime(xmas2002),time.localtime(xmas2002) ! ) ! self.failUnlessEqual(time.timezone,time.altzone) ! self.failUnlessEqual(time.daylight,0) ! self.failUnlessEqual(time.timezone,0) ! self.failUnlessEqual(time.altzone,0) ! self.failUnlessEqual(time.localtime(xmas2002).tm_isdst,0) ! ! # Make sure we can switch to US/Eastern ! environ['TZ'] = 'US/Eastern' time.tzset() ! self.failIfEqual(time.gmtime(xmas2002),time.localtime(xmas2002)) ! self.failUnlessEqual(time.tzname,('EST','EDT')) ! self.failUnlessEqual(len(time.tzname),2) ! self.failUnlessEqual(time.daylight,1) ! self.failUnlessEqual(time.timezone,18000) ! self.failUnlessEqual(time.altzone,14400) ! self.failUnlessEqual(time.localtime(xmas2002).tm_isdst,0) ! self.failUnlessEqual(len(time.tzname),2) ! ! # Now go to the southern hemisphere. We want somewhere all OS's ! # know about that has DST. ! environ['TZ'] = 'Australia/Melbourne' time.tzset() ! self.failIfEqual(time.gmtime(xmas2002),time.localtime(xmas2002)) ! self.failUnless(time.tzname[0] in ('EST','AEST')) ! self.failUnless(time.tzname[1] in ('EST','EDT','AEDT')) ! self.failUnlessEqual(len(time.tzname),2) ! self.failUnlessEqual(time.daylight,1) ! self.failUnlessEqual(time.timezone,-36000) ! self.failUnlessEqual(time.altzone,-39600) ! self.failUnlessEqual(time.localtime(xmas2002).tm_isdst,1) ! # Get some times from a timezone that isn't wallclock timezone ! del environ['TZ'] ! time.tzset() ! if time.timezone == 0: ! environ['TZ'] = 'US/Eastern' ! else: ! environ['TZ'] = 'UTC' time.tzset() ! nonlocal = time.localtime(xmas2002) ! # Then the same time in wallclock timezone ! del environ['TZ'] time.tzset() ! local = time.localtime(xmas2002) ! ! # And make sure they arn't the same ! self.failIfEqual(local,nonlocal) - # Do some basic sanity checking after wallclock time set - self.failUnlessEqual(len(time.tzname),2) - time.daylight - time.timezone - time.altzone finally: # Repair TZ environment variable in case any other tests --- 63,115 ---- xmas2002 = 1040774400.0 + # These formats are correct for 2002, and possibly future years + # This format is the 'standard' as documented at: + # http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html + # They are also documented in the tzset(3) man page on most Unix + # systems. + eastern = 'EST+05EDT,M4.1.0,M10.5.0' + victoria = 'AEST-10AEDT-11,M10.5.0,M3.5.0' + utc='UTC+0' + org_TZ = environ.get('TZ',None) try: # Make sure we can switch to UTC time and results are correct # Note that unknown timezones default to UTC. ! # Note that altzone is undefined in UTC, as there is no DST ! environ['TZ'] = eastern time.tzset() ! environ['TZ'] = utc time.tzset() ! self.failUnlessEqual( ! time.gmtime(xmas2002), time.localtime(xmas2002) ! ) ! self.failUnlessEqual(time.daylight, 0) ! self.failUnlessEqual(time.timezone, 0) ! self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0) ! # Make sure we can switch to US/Eastern ! environ['TZ'] = eastern time.tzset() ! self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) ! self.failUnlessEqual(time.tzname, ('EST', 'EDT')) ! self.failUnlessEqual(len(time.tzname), 2) ! self.failUnlessEqual(time.daylight, 1) ! self.failUnlessEqual(time.timezone, 18000) ! self.failUnlessEqual(time.altzone, 14400) ! self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0) ! self.failUnlessEqual(len(time.tzname), 2) ! # Now go to the southern hemisphere. ! environ['TZ'] = victoria time.tzset() ! self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) ! self.failUnless(time.tzname[0] == 'AEST', str(time.tzname[0])) ! self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1])) ! self.failUnlessEqual(len(time.tzname), 2) ! self.failUnlessEqual(time.daylight, 1) ! self.failUnlessEqual(time.timezone, -36000) ! self.failUnlessEqual(time.altzone, -39600) ! self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 1) finally: # Repair TZ environment variable in case any other tests *************** *** 137,140 **** --- 119,123 ---- elif environ.has_key('TZ'): del environ['TZ'] + time.tzset() From jackjansen@users.sourceforge.net Fri Apr 11 16:37:28 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:37:28 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.718,1.719 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv32531 Modified Files: NEWS Log Message: Added a note that the Mac OSA modules are documented. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.718 retrieving revision 1.719 diff -C2 -d -r1.718 -r1.719 *** NEWS 9 Apr 2003 19:39:06 -0000 1.718 --- NEWS 11 Apr 2003 15:37:20 -0000 1.719 *************** *** 177,181 **** - OSA Scripting support has improved a lot, and gensuitemodule.py can now ! be used by mere mortals. - The IDE (in a framework build) now includes introductory documentation --- 177,182 ---- - OSA Scripting support has improved a lot, and gensuitemodule.py can now ! be used by mere mortals. The documentation is now also more or less ! complete. - The IDE (in a framework build) now includes introductory documentation From nnorwitz@users.sourceforge.net Fri Apr 11 19:21:29 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:21:29 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.147.6.12,2.147.6.13 unicodeobject.c,2.124.6.20,2.124.6.21 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv16801/Objects Modified Files: Tag: release22-maint stringobject.c unicodeobject.c Log Message: Backport: Fix SF bug #697220, string.strip implementation/doc mismatch Attempt to make all the various string/unicode *strip methods the same. * Doc - add doc for when functions were added * UserString * string/unicode object methods * string module functions 'chars' is used for the last parameter everywhere. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.12 retrieving revision 2.147.6.13 diff -C2 -d -r2.147.6.12 -r2.147.6.13 *** stringobject.c 2 Jan 2003 22:08:34 -0000 2.147.6.12 --- stringobject.c 11 Apr 2003 18:21:13 -0000 2.147.6.13 *************** *** 1524,1533 **** static char strip__doc__[] = ! "S.strip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * --- 1524,1533 ---- static char strip__doc__[] = ! "S.strip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"; static PyObject * *************** *** 1542,1550 **** static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * --- 1542,1550 ---- static char lstrip__doc__[] = ! "S.lstrip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"; static PyObject * *************** *** 1559,1567 **** static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * --- 1559,1567 ---- static char rstrip__doc__[] = ! "S.rstrip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"; static PyObject * Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.20 retrieving revision 2.124.6.21 diff -C2 -d -r2.124.6.20 -r2.124.6.21 *** unicodeobject.c 11 Feb 2003 23:19:29 -0000 2.124.6.20 --- unicodeobject.c 11 Apr 2003 18:21:22 -0000 2.124.6.21 *************** *** 4570,4579 **** static char strip__doc__[] = ! "S.strip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; static PyObject * --- 4570,4579 ---- static char strip__doc__[] = ! "S.strip([chars]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"; static PyObject * *************** *** 4588,4596 **** static char lstrip__doc__[] = ! "S.lstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; static PyObject * --- 4588,4596 ---- static char lstrip__doc__[] = ! "S.lstrip([chars]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"; static PyObject * *************** *** 4605,4613 **** static char rstrip__doc__[] = ! "S.rstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; static PyObject * --- 4605,4613 ---- static char rstrip__doc__[] = ! "S.rstrip([chars]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"; static PyObject * From nnorwitz@users.sourceforge.net Fri Apr 11 19:21:47 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:21:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.45.8.4,1.45.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16801/Doc/lib Modified Files: Tag: release22-maint libstring.tex Log Message: Backport: Fix SF bug #697220, string.strip implementation/doc mismatch Attempt to make all the various string/unicode *strip methods the same. * Doc - add doc for when functions were added * UserString * string/unicode object methods * string module functions 'chars' is used for the last parameter everywhere. Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.45.8.4 retrieving revision 1.45.8.5 diff -C2 -d -r1.45.8.4 -r1.45.8.5 *** libstring.tex 4 Mar 2003 17:44:34 -0000 1.45.8.4 --- libstring.tex 11 Apr 2003 18:21:09 -0000 1.45.8.5 *************** *** 244,247 **** --- 244,249 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 252,255 **** --- 254,259 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 261,265 **** the both ends of the string this method is called on. \versionchanged[The \var{chars} parameter was added. The \var{chars} ! parameter cannot be passed in 2.2 or 2.2.1]{2.2.2} \end{funcdesc} --- 265,269 ---- the both ends of the string this method is called on. \versionchanged[The \var{chars} parameter was added. The \var{chars} ! parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} From nnorwitz@users.sourceforge.net Fri Apr 11 19:21:46 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:21:46 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.72,1.337.2.4.2.73 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv16801/Misc Modified Files: Tag: release22-maint NEWS Log Message: Backport: Fix SF bug #697220, string.strip implementation/doc mismatch Attempt to make all the various string/unicode *strip methods the same. * Doc - add doc for when functions were added * UserString * string/unicode object methods * string module functions 'chars' is used for the last parameter everywhere. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.72 retrieving revision 1.337.2.4.2.73 diff -C2 -d -r1.337.2.4.2.72 -r1.337.2.4.2.73 *** NEWS 8 Apr 2003 20:32:58 -0000 1.337.2.4.2.72 --- NEWS 11 Apr 2003 18:21:03 -0000 1.337.2.4.2.73 *************** *** 3,6 **** --- 3,11 ---- ============================ + - Make all the strip, lstrip, rstrip functions/methods on + string/unicode/UserString consistent by adding and/or + documenting the chars parameter. The chars parameter + specifies which characters to strip. + - Some horridly obscure problems were fixed involving interaction between garbage collection and classes with "ambitious" getattr hooks. From nnorwitz@users.sourceforge.net Fri Apr 11 19:21:52 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:21:52 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.10.18.2,1.10.18.3 string.py,1.60.16.4,1.60.16.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16801/Lib Modified Files: Tag: release22-maint UserString.py string.py Log Message: Backport: Fix SF bug #697220, string.strip implementation/doc mismatch Attempt to make all the various string/unicode *strip methods the same. * Doc - add doc for when functions were added * UserString * string/unicode object methods * string module functions 'chars' is used for the last parameter everywhere. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.10.18.2 retrieving revision 1.10.18.3 diff -C2 -d -r1.10.18.2 -r1.10.18.3 *** UserString.py 22 Apr 2002 11:57:04 -0000 1.10.18.2 --- UserString.py 11 Apr 2003 18:21:11 -0000 1.10.18.3 *************** *** 109,113 **** def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, sep=None): return self.__class__(self.data.lstrip(sep)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) --- 109,113 ---- def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) *************** *** 117,121 **** return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, sep=None): return self.__class__(self.data.rstrip(sep)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) --- 117,121 ---- return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) *************** *** 123,127 **** def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, sep=None): return self.__class__(self.data.strip(sep)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) --- 123,127 ---- def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, chars=None): return self.__class__(self.data.strip(chars)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.60.16.4 retrieving revision 1.60.16.5 diff -C2 -d -r1.60.16.4 -r1.60.16.5 *** string.py 14 Nov 2002 03:32:08 -0000 1.60.16.4 --- string.py 11 Apr 2003 18:21:12 -0000 1.60.16.5 *************** *** 79,83 **** Return a copy of the string s with leading and trailing whitespace removed. ! If chars is given and not None, remove characters in sep instead. If chars is unicode, S will be converted to unicode before stripping. --- 79,83 ---- Return a copy of the string s with leading and trailing whitespace removed. ! If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping. *************** *** 86,106 **** # Strip leading tabs and spaces ! def lstrip(s): ! """lstrip(s) -> string Return a copy of the string s with leading whitespace removed. """ ! return s.lstrip() # Strip trailing tabs and spaces ! def rstrip(s): ! """rstrip(s) -> string ! Return a copy of the string s with trailing whitespace ! removed. """ ! return s.rstrip() --- 86,109 ---- # Strip leading tabs and spaces ! def lstrip(s, chars=None): ! """lstrip(s [,chars]) -> string Return a copy of the string s with leading whitespace removed. + If chars is given and not None, remove characters in chars instead. + If chars is unicode, S will be converted to unicode before stripping. """ ! return s.lstrip(chars) # Strip trailing tabs and spaces ! def rstrip(s, chars=None): ! """rstrip(s [,chars]) -> string ! Return a copy of the string s with trailing whitespace removed. ! If chars is given and not None, remove characters in chars instead. ! If chars is unicode, S will be converted to unicode before stripping. """ ! return s.rstrip(chars) From bwarsaw@users.sourceforge.net Fri Apr 11 19:36:07 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:36:07 -0700 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24888 Modified Files: gettext.py Log Message: >From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html - Expose NullTranslations and GNUTranslations to __all__ - Set the default charset to iso-8859-1. It used to be None, which would cause problems with .ugettext() if the file had no charset parameter. Arguably, the po/mo file would be broken, but I still think iso-8859-1 is a reasonable default. - Add a "coerce" default argument to GNUTranslations's constructor. The reason for this is that in Zope, we want all msgids and msgstrs to be Unicode. For the latter, we could use .ugettext() but there isn't currently a mechanism for Unicode-ifying msgids. The plan then is that the charset parameter specifies the encoding for both the msgids and msgstrs, and both are decoded to Unicode when read. For example, we might encode po files with utf-8. I think the GNU gettext tools don't care. Since this could potentially break code [*] that wants to use the encoded interface .gettext(), the constructor flag is added, defaulting to False. Most code I suspect will want to set this to True and use .ugettext(). - A few other minor changes from the Zope project, including asserting that a zero-length msgid must have a Project-ID-Version header for it to be counted as the metadata record. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gettext.py 10 Mar 2003 16:01:43 -0000 1.17 --- gettext.py 11 Apr 2003 18:36:04 -0000 1.18 *************** *** 51,56 **** ! __all__ = ["bindtextdomain","textdomain","gettext","dgettext", ! "find","translation","install","Catalog"] _default_localedir = os.path.join(sys.prefix, 'share', 'locale') --- 51,58 ---- ! __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog', ! 'find', 'translation', 'install', 'textdomain', 'bindtextdomain', ! 'dgettext', 'dngettext', 'gettext', 'ngettext', ! ] _default_localedir = os.path.join(sys.prefix, 'share', 'locale') *************** *** 171,175 **** def __init__(self, fp=None): self._info = {} ! self._charset = None self._fallback = None if fp is not None: --- 173,177 ---- def __init__(self, fp=None): self._info = {} ! self._charset = 'iso-8859-1' self._fallback = None if fp is not None: *************** *** 227,230 **** --- 229,238 ---- BE_MAGIC = 0xde120495L + def __init__(self, fp=None, coerce=False): + # Set this attribute before calling the base class constructor, since + # the latter calls _parse() which depends on self._coerce. + self._coerce = coerce + NullTranslations.__init__(self, fp) + def _parse(self, fp): """Override this method to support alternative .mo formats.""" *************** *** 261,274 **** msgid1, msgid2 = msg.split('\x00') tmsg = tmsg.split('\x00') for i in range(len(tmsg)): catalog[(msgid1, i)] = tmsg[i] else: catalog[msg] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata ! if mlen == 0: # Catalog description ! for item in tmsg.split('\n'): item = item.strip() if not item: --- 269,288 ---- msgid1, msgid2 = msg.split('\x00') tmsg = tmsg.split('\x00') + if self._coerce: + msgid1 = unicode(msgid1, self._charset) + tmsg = [unicode(x, self._charset) for x in tmsg] for i in range(len(tmsg)): catalog[(msgid1, i)] = tmsg[i] else: + if self._coerce: + msg = unicode(msg, self._charset) + tmsg = unicode(tmsg, self._charset) catalog[msg] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata ! if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description ! for item in tmsg.splitlines(): item = item.strip() if not item: *************** *** 298,302 **** return message - def ngettext(self, msgid1, msgid2, n): try: --- 312,315 ---- *************** *** 310,323 **** return msgid2 - def ugettext(self, message): ! try: ! tmsg = self._catalog[message] ! except KeyError: if self._fallback: return self._fallback.ugettext(message) tmsg = message ! return unicode(tmsg, self._charset) ! def ungettext(self, msgid1, msgid2, n): --- 323,337 ---- return msgid2 def ugettext(self, message): ! missing = object() ! tmsg = self._catalog.get(message, missing) ! if tmsg is missing: if self._fallback: return self._fallback.ugettext(message) tmsg = message ! if not self._coerce: ! return unicode(tmsg, self._charset) ! # The msgstr is already coerced to Unicode ! return tmsg def ungettext(self, msgid1, msgid2, n): *************** *** 331,335 **** else: tmsg = msgid2 ! return unicode(tmsg, self._charset) --- 345,352 ---- else: tmsg = msgid2 ! if not self._coerce: ! return unicode(tmsg, self._charset) ! # The msgstr is already coerced to Unicode ! return tmsg From bwarsaw@users.sourceforge.net Fri Apr 11 19:36:25 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:36:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gettext.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25046 Modified Files: test_gettext.py Log Message: >From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html - Expose NullTranslations and GNUTranslations to __all__ - Set the default charset to iso-8859-1. It used to be None, which would cause problems with .ugettext() if the file had no charset parameter. Arguably, the po/mo file would be broken, but I still think iso-8859-1 is a reasonable default. - Add a "coerce" default argument to GNUTranslations's constructor. The reason for this is that in Zope, we want all msgids and msgstrs to be Unicode. For the latter, we could use .ugettext() but there isn't currently a mechanism for Unicode-ifying msgids. The plan then is that the charset parameter specifies the encoding for both the msgids and msgstrs, and both are decoded to Unicode when read. For example, we might encode po files with utf-8. I think the GNU gettext tools don't care. Since this could potentially break code [*] that wants to use the encoded interface .gettext(), the constructor flag is added, defaulting to False. Most code I suspect will want to set this to True and use .ugettext(). - A few other minor changes from the Zope project, including asserting that a zero-length msgid must have a Project-ID-Version header for it to be counted as the metadata record. Index: test_gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gettext.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_gettext.py 21 Nov 2002 21:45:32 -0000 1.11 --- test_gettext.py 11 Apr 2003 18:36:22 -0000 1.12 *************** *** 1,8 **** import os import base64 import gettext - import unittest ! from unittest import TestCase # TODO: --- 1,10 ---- import os import base64 + import shutil import gettext import unittest ! ! from test.test_support import run_suite ! # TODO: *************** *** 12,16 **** # - Tests should have only one assert. - GNU_MO_DATA = '''\ 3hIElQAAAAAGAAAAHAAAAEwAAAALAAAAfAAAAAAAAACoAAAAFQAAAKkAAAAjAAAAvwAAAKEAAADj --- 14,17 ---- *************** *** 33,280 **** ''' LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') - def setup(): - os.makedirs(LOCALEDIR) - fp = open(MOFILE, 'wb') - fp.write(base64.decodestring(GNU_MO_DATA)) - fp.close() - os.environ['LANGUAGE'] = 'xx' ! def teardown(): ! os.environ['LANGUAGE'] = 'en' ! os.unlink(MOFILE) ! os.removedirs(LOCALEDIR) ! class GettextTestCase1(TestCase): def setUp(self): self.localedir = os.curdir self.mofile = MOFILE - gettext.install('gettext', self.localedir) - def test_some_translations(self): # test some translations ! assert _('albatross') == 'albatross' ! assert _(u'mullusk') == 'bacon' ! assert _(r'Raymond Luxury Yach-t') == 'Throatwobbler Mangrove' ! assert _(ur'nudge nudge') == 'wink wink' ! def test_double_quotes(self): # double quotes ! assert _("albatross") == 'albatross' ! assert _(u"mullusk") == 'bacon' ! assert _(r"Raymond Luxury Yach-t") == 'Throatwobbler Mangrove' ! assert _(ur"nudge nudge") == 'wink wink' ! def test_triple_single_quotes(self): # triple single quotes ! assert _('''albatross''') == 'albatross' ! assert _(u'''mullusk''') == 'bacon' ! assert _(r'''Raymond Luxury Yach-t''') == 'Throatwobbler Mangrove' ! assert _(ur'''nudge nudge''') == 'wink wink' ! def test_triple_double_quotes(self): # triple double quotes ! assert _("""albatross""") == 'albatross' ! assert _(u"""mullusk""") == 'bacon' ! assert _(r"""Raymond Luxury Yach-t""") == 'Throatwobbler Mangrove' ! assert _(ur"""nudge nudge""") == 'wink wink' ! def test_multiline_strings(self): # multiline strings ! assert _('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.''') == '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH ! trggrkg zrffntr pngnybt yvoenel.''' ! def test_the_alternative_interface(self): # test the alternative interface ! fp = open(os.path.join(self.mofile), 'rb') t = gettext.GNUTranslations(fp) fp.close() ! t.install() ! ! assert _('nudge nudge') == 'wink wink' ! ! # try unicode return type ! t.install(unicode=1) ! ! assert _('mullusk') == 'bacon' ! class GettextTestCase2(TestCase): def setUp(self): self.localedir = os.curdir ! gettext.bindtextdomain('gettext', self.localedir) gettext.textdomain('gettext') ! self._ = gettext.gettext - def test_bindtextdomain(self): ! assert gettext.bindtextdomain('gettext') == self.localedir ! def test_textdomain(self): ! assert gettext.textdomain() == 'gettext' ! def test_some_translations(self): # test some translations ! assert self._('albatross') == 'albatross' ! assert self._(u'mullusk') == 'bacon' ! assert self._(r'Raymond Luxury Yach-t') == 'Throatwobbler Mangrove' ! assert self._(ur'nudge nudge') == 'wink wink' ! def test_double_quotes(self): # double quotes ! assert self._("albatross") == 'albatross' ! assert self._(u"mullusk") == 'bacon' ! assert self._(r"Raymond Luxury Yach-t") == 'Throatwobbler Mangrove' ! assert self._(ur"nudge nudge") == 'wink wink' ! def test_triple_single_quotes(self): # triple single quotes ! assert self._('''albatross''') == 'albatross' ! assert self._(u'''mullusk''') == 'bacon' ! assert self._(r'''Raymond Luxury Yach-t''') == 'Throatwobbler Mangrove' ! assert self._(ur'''nudge nudge''') == 'wink wink' ! def test_triple_double_quotes(self): # triple double quotes ! assert self._("""albatross""") == 'albatross' ! assert self._(u"""mullusk""") == 'bacon' ! assert self._(r"""Raymond Luxury Yach-t""") == 'Throatwobbler Mangrove' ! assert self._(ur"""nudge nudge""") == 'wink wink' ! def test_multiline_strings(self): # multiline strings ! assert self._('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.''') == '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH ! trggrkg zrffntr pngnybt yvoenel.''' ! ! ! class PluralFormsTestCase(TestCase): def setUp(self): self.mofile = MOFILE def test_plural_forms1(self): x = gettext.ngettext('There is %s file', 'There are %s files', 1) ! assert x == 'Hay %s fichero' ! x = gettext.ngettext('There is %s file', 'There are %s files', 2) ! assert x == 'Hay %s ficheros' ! def test_plural_forms2(self): ! fp = open(os.path.join(self.mofile), 'rb') t = gettext.GNUTranslations(fp) fp.close() - x = t.ngettext('There is %s file', 'There are %s files', 1) ! assert x == 'Hay %s fichero' ! x = t.ngettext('There is %s file', 'There are %s files', 2) ! assert x == 'Hay %s ficheros' ! def test_hu(self): f = gettext.c2py('0') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ! def test_de(self): f = gettext.c2py('n != 1') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" ! def test_fr(self): f = gettext.c2py('n>1') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" ! def test_gd(self): f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" ! def test_gd2(self): # Tests the combination of parentheses and "?:" f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" ! def test_lt(self): f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111" ! def test_ru(self): f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222" ! def test_pl(self): f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222" ! def test_sl(self): f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3') s = ''.join([ str(f(x)) for x in range(200) ]) ! assert s == "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" ! def test_security(self): # Test for a dangerous expression try: ! gettext.c2py("os.chmod('/etc/passwd',0777)") ! except ValueError: ! pass ! else: ! raise AssertionError ! if __name__ == '__main__': ! try: ! setup() ! unittest.main() ! finally: ! teardown() ! # For reference, here's the .po file used to created the .mo data above. # # The original version was automatically generated from the sources with --- 34,311 ---- ''' + UMO_DATA = '''\ + 3hIElQAAAAACAAAAHAAAACwAAAAFAAAAPAAAAAAAAABQAAAABAAAAFEAAAAPAQAAVgAAAAQAAABm + AQAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAYWLDngBQcm9qZWN0LUlkLVZlcnNpb246IDIuMApQTy1S + ZXZpc2lvbi1EYXRlOiAyMDAzLTA0LTExIDEyOjQyLTA0MDAKTGFzdC1UcmFuc2xhdG9yOiBCYXJy + eSBBLiBXQXJzYXcgPGJhcnJ5QHB5dGhvbi5vcmc+Ckxhbmd1YWdlLVRlYW06IFhYIDxweXRob24t + ZGV2QHB5dGhvbi5vcmc+Ck1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFp + bjsgY2hhcnNldD11dGYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CkdlbmVyYXRl + ZC1CeTogbWFudWFsbHkKAMKkeXoA + ''' LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') + UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo') ! class GettextBaseTest(unittest.TestCase): ! def setUp(self): ! os.makedirs(LOCALEDIR) ! fp = open(MOFILE, 'wb') ! fp.write(base64.decodestring(GNU_MO_DATA)) ! fp.close() ! fp = open(UMOFILE, 'wb') ! fp.write(base64.decodestring(UMO_DATA)) ! fp.close() ! os.environ['LANGUAGE'] = 'xx' + def tearDown(self): + os.environ['LANGUAGE'] = 'en' + shutil.rmtree(LOCALEDIR) ! ! class GettextTestCase1(GettextBaseTest): def setUp(self): + GettextBaseTest.setUp(self) self.localedir = os.curdir self.mofile = MOFILE gettext.install('gettext', self.localedir) def test_some_translations(self): + eq = self.assertEqual # test some translations ! eq(_('albatross'), 'albatross') ! eq(_(u'mullusk'), 'bacon') ! eq(_(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove') ! eq(_(ur'nudge nudge'), 'wink wink') def test_double_quotes(self): + eq = self.assertEqual # double quotes ! eq(_("albatross"), 'albatross') ! eq(_(u"mullusk"), 'bacon') ! eq(_(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove') ! eq(_(ur"nudge nudge"), 'wink wink') def test_triple_single_quotes(self): + eq = self.assertEqual # triple single quotes ! eq(_('''albatross'''), 'albatross') ! eq(_(u'''mullusk'''), 'bacon') ! eq(_(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove') ! eq(_(ur'''nudge nudge'''), 'wink wink') def test_triple_double_quotes(self): + eq = self.assertEqual # triple double quotes ! eq(_("""albatross"""), 'albatross') ! eq(_(u"""mullusk"""), 'bacon') ! eq(_(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove') ! eq(_(ur"""nudge nudge"""), 'wink wink') def test_multiline_strings(self): + eq = self.assertEqual # multiline strings ! eq(_('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.'''), ! '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH ! trggrkg zrffntr pngnybt yvoenel.''') def test_the_alternative_interface(self): + eq = self.assertEqual # test the alternative interface ! fp = open(self.mofile, 'rb') t = gettext.GNUTranslations(fp) fp.close() ! # Install the translation object t.install() ! eq(_('nudge nudge'), 'wink wink') ! # Try unicode return type ! t.install(unicode=True) ! eq(_('mullusk'), 'bacon') ! class GettextTestCase2(GettextBaseTest): def setUp(self): + GettextBaseTest.setUp(self) self.localedir = os.curdir ! # Set up the bindings gettext.bindtextdomain('gettext', self.localedir) gettext.textdomain('gettext') ! # For convenience self._ = gettext.gettext def test_bindtextdomain(self): ! self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir) def test_textdomain(self): ! self.assertEqual(gettext.textdomain(), 'gettext') def test_some_translations(self): + eq = self.assertEqual # test some translations ! eq(self._('albatross'), 'albatross') ! eq(self._(u'mullusk'), 'bacon') ! eq(self._(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove') ! eq(self._(ur'nudge nudge'), 'wink wink') def test_double_quotes(self): + eq = self.assertEqual # double quotes ! eq(self._("albatross"), 'albatross') ! eq(self._(u"mullusk"), 'bacon') ! eq(self._(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove') ! eq(self._(ur"nudge nudge"), 'wink wink') def test_triple_single_quotes(self): + eq = self.assertEqual # triple single quotes ! eq(self._('''albatross'''), 'albatross') ! eq(self._(u'''mullusk'''), 'bacon') ! eq(self._(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove') ! eq(self._(ur'''nudge nudge'''), 'wink wink') def test_triple_double_quotes(self): + eq = self.assertEqual # triple double quotes ! eq(self._("""albatross"""), 'albatross') ! eq(self._(u"""mullusk"""), 'bacon') ! eq(self._(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove') ! eq(self._(ur"""nudge nudge"""), 'wink wink') def test_multiline_strings(self): + eq = self.assertEqual # multiline strings ! eq(self._('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.'''), ! '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH ! trggrkg zrffntr pngnybt yvoenel.''') ! class PluralFormsTestCase(GettextBaseTest): def setUp(self): + GettextBaseTest.setUp(self) self.mofile = MOFILE def test_plural_forms1(self): + eq = self.assertEqual x = gettext.ngettext('There is %s file', 'There are %s files', 1) ! eq(x, 'Hay %s fichero') x = gettext.ngettext('There is %s file', 'There are %s files', 2) ! eq(x, 'Hay %s ficheros') def test_plural_forms2(self): ! eq = self.assertEqual ! fp = open(self.mofile, 'rb') t = gettext.GNUTranslations(fp) fp.close() x = t.ngettext('There is %s file', 'There are %s files', 1) ! eq(x, 'Hay %s fichero') x = t.ngettext('There is %s file', 'There are %s files', 2) ! eq(x, 'Hay %s ficheros') def test_hu(self): + eq = self.assertEqual f = gettext.c2py('0') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") def test_de(self): + eq = self.assertEqual f = gettext.c2py('n != 1') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") def test_fr(self): + eq = self.assertEqual f = gettext.c2py('n>1') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") def test_gd(self): + eq = self.assertEqual f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222") def test_gd2(self): + eq = self.assertEqual # Tests the combination of parentheses and "?:" f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222") def test_lt(self): + eq = self.assertEqual f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111") def test_ru(self): + eq = self.assertEqual f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222") def test_pl(self): + eq = self.assertEqual f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222") def test_sl(self): + eq = self.assertEqual f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3') s = ''.join([ str(f(x)) for x in range(200) ]) ! eq(s, "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333") def test_security(self): + raises = self.assertRaises # Test for a dangerous expression + raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)") + + + class UnicodeTranslationsTest(GettextBaseTest): + def setUp(self): + GettextBaseTest.setUp(self) + fp = open(UMOFILE, 'rb') try: ! self.t = gettext.GNUTranslations(fp, coerce=True) ! finally: ! fp.close() ! self._ = self.t.ugettext + def test_unicode_msgid(self): + unless = self.failUnless + unless(isinstance(self._(''), unicode)) + unless(isinstance(self._(u''), unicode)) + def test_unicode_msgstr(self): + eq = self.assertEqual + eq(self._(u'ab\xde'), u'\xa4yz') ! ! def suite(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(GettextTestCase1)) ! suite.addTest(unittest.makeSuite(GettextTestCase2)) ! suite.addTest(unittest.makeSuite(PluralFormsTestCase)) ! suite.addTest(unittest.makeSuite(UnicodeTranslationsTest)) ! return suite ! ! ! def test_main(): ! run_suite(suite()) + if __name__ == '__main__': + test_main() ! # For reference, here's the .po file used to created the GNU_MO_DATA above. # # The original version was automatically generated from the sources with *************** *** 282,286 **** ''' ! # Dummy translation for Python's test_gettext.py module. # Copyright (C) 2001 Python Software Foundation # Barry Warsaw , 2000. --- 313,317 ---- ''' ! # Dummy translation for the Python test_gettext.py module. # Copyright (C) 2001 Python Software Foundation # Barry Warsaw , 2000. *************** *** 289,293 **** msgstr "" "Project-Id-Version: 2.0\n" ! "PO-Revision-Date: 2000-08-29 12:19-04:00\n" "Last-Translator: J. David Ibanez \n" "Language-Team: XX \n" --- 320,324 ---- msgstr "" "Project-Id-Version: 2.0\n" ! "PO-Revision-Date: 2003-04-11 14:32-0400\n" "Last-Translator: J. David Ibanez \n" "Language-Team: XX \n" *************** *** 336,338 **** --- 367,393 ---- msgstr[0] "Hay %s fichero" msgstr[1] "Hay %s ficheros" + ''' + + # Here's the second example po file example, used to generate the UMO_DATA + # containing utf-8 encoded Unicode strings + + ''' + # Dummy translation for the Python test_gettext.py module. + # Copyright (C) 2001 Python Software Foundation + # Barry Warsaw , 2000. + # + msgid "" + msgstr "" + "Project-Id-Version: 2.0\n" + "PO-Revision-Date: 2003-04-11 12:42-0400\n" + "Last-Translator: Barry A. WArsaw \n" + "Language-Team: XX \n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=utf-8\n" + "Content-Transfer-Encoding: 7bit\n" + "Generated-By: manually\n" + + #: nofile:0 + msgid "ab\xc3\x9e" + msgstr "\xc2\xa4yz" ''' From bwarsaw@users.sourceforge.net Fri Apr 11 19:36:46 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:36:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgettext.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25282 Modified Files: libgettext.tex Log Message: >From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html - Expose NullTranslations and GNUTranslations to __all__ - Set the default charset to iso-8859-1. It used to be None, which would cause problems with .ugettext() if the file had no charset parameter. Arguably, the po/mo file would be broken, but I still think iso-8859-1 is a reasonable default. - Add a "coerce" default argument to GNUTranslations's constructor. The reason for this is that in Zope, we want all msgids and msgstrs to be Unicode. For the latter, we could use .ugettext() but there isn't currently a mechanism for Unicode-ifying msgids. The plan then is that the charset parameter specifies the encoding for both the msgids and msgstrs, and both are decoded to Unicode when read. For example, we might encode po files with utf-8. I think the GNU gettext tools don't care. Since this could potentially break code [*] that wants to use the encoded interface .gettext(), the constructor flag is added, defaulting to False. Most code I suspect will want to set this to True and use .ugettext(). - A few other minor changes from the Zope project, including asserting that a zero-length msgid must have a Project-ID-Version header for it to be counted as the metadata record. Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libgettext.tex 22 Nov 2002 14:28:53 -0000 1.14 --- libgettext.tex 11 Apr 2003 18:36:43 -0000 1.15 *************** *** 286,296 **** overrides \method{_parse()} to enable reading GNU \program{gettext} format \file{.mo} files in both big-endian and little-endian format. ! It also parses optional meta-data out of the translation catalog. It ! is convention with GNU \program{gettext} to include meta-data as the ! translation for the empty string. This meta-data is in \rfc{822}-style ! \code{key: value} pairs. If the key \code{Content-Type} is found, ! then the \code{charset} property is used to initialize the ! ``protected'' \member{_charset} instance variable. The entire set of key/value pairs are placed into a dictionary and set as the ``protected'' \member{_info} instance variable. --- 286,300 ---- overrides \method{_parse()} to enable reading GNU \program{gettext} format \file{.mo} files in both big-endian and little-endian format. + It also adds the ability to coerce both message ids and message + strings to Unicode. ! \class{GNUTranslations} parses optional meta-data out of the ! translation catalog. It is convention with GNU \program{gettext} to ! include meta-data as the translation for the empty string. This ! meta-data is in \rfc{822}-style \code{key: value} pairs, and must ! contain the \code{Project-Id-Version}. If the key ! \code{Content-Type} is found, then the \code{charset} property is used ! to initialize the ``protected'' \member{_charset} instance variable, ! defaulting to \code{iso-8859-1} if not found. The entire set of key/value pairs are placed into a dictionary and set as the ``protected'' \member{_info} instance variable. *************** *** 303,310 **** returns a Unicode string by passing both the translated message string and the value of the ``protected'' \member{_charset} variable to the ! builtin \function{unicode()} function. To facilitate plural forms, the methods \method{ngettext} and \method{ungettext} are overridden as well. \subsubsection{Solaris message catalog support} --- 307,330 ---- returns a Unicode string by passing both the translated message string and the value of the ``protected'' \member{_charset} variable to the ! builtin \function{unicode()} function. Note that if you use ! \method{ugettext()} you probably also want your message ids to be ! Unicode. To do this, set the variable \var{coerce} to \code{True} in ! the \class{GNUTranslations} constructor. This ensures that both the ! message ids and message strings are decoded to Unicode when the file ! is read, using the file's \code{charset} value. If you do this, you ! will not want to use the \method{gettext()} method -- always use ! \method{ugettext()} instead. To facilitate plural forms, the methods \method{ngettext} and \method{ungettext} are overridden as well. + + \begin{methoddesc}[GNUTranslations]{__init__}{ + \optional{fp\optional{, coerce}} + Constructs and parses a translation catalog in GNU gettext format. + \var{fp} is passed to the base class (\class{NullTranslations}) + constructor. \var{coerce} is a flag specifying whether message ids + and message strings should be converted to Unicode when the file is + parsed. It defaults to \code{False} for backward compatibility. + \end{methoddesc} \subsubsection{Solaris message catalog support} From gvanrossum@users.sourceforge.net Fri Apr 11 19:43:07 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:43:07 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.719,1.720 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28123/Misc Modified Files: NEWS Log Message: Patch by Chad Netzer (with significant change): - range() now works even if the arguments are longs with magnitude larger than sys.maxint, as long as the total length of the sequence fits. E.g., range(2**100, 2**101, 2**100) is the following list: [1267650600228229401496703205376L]. (SF patch #707427.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.719 retrieving revision 1.720 diff -C2 -d -r1.719 -r1.720 *** NEWS 11 Apr 2003 15:37:20 -0000 1.719 --- NEWS 11 Apr 2003 18:43:03 -0000 1.720 *************** *** 13,16 **** --- 13,21 ---- ----------------- + - range() now works even if the arguments are longs with magnitude + larger than sys.maxint, as long as the total length of the sequence + fits. E.g., range(2**100, 2**101, 2**100) is the following list: + [1267650600228229401496703205376L]. (SF patch #707427.) + - Some horridly obscure problems were fixed involving interaction between garbage collection and old-style classes with "ambitious" From gvanrossum@users.sourceforge.net Fri Apr 11 19:43:08 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:43:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28123/Lib/test Modified Files: test_builtin.py Log Message: Patch by Chad Netzer (with significant change): - range() now works even if the arguments are longs with magnitude larger than sys.maxint, as long as the total length of the sequence fits. E.g., range(2**100, 2**101, 2**100) is the following list: [1267650600228229401496703205376L]. (SF patch #707427.) Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_builtin.py 19 Feb 2003 02:35:05 -0000 1.14 --- test_builtin.py 11 Apr 2003 18:43:05 -0000 1.15 *************** *** 7,10 **** --- 7,12 ---- warnings.filterwarnings("ignore", "hex../oct.. of negative int", FutureWarning, __name__) + warnings.filterwarnings("ignore", "integer argument expected", + DeprecationWarning, "unittest") class Squares: *************** *** 926,932 **** --- 928,967 ---- self.assertEqual(range(5, -5, -3), [5, 2, -1, -4]) + # Now test range() with longs + self.assertEqual(range(-2**100), []) + self.assertEqual(range(0, -2**100), []) + self.assertEqual(range(0, 2**100, -1), []) + self.assertEqual(range(0, 2**100, -1), []) + + a = long(10 * sys.maxint) + b = long(100 * sys.maxint) + c = long(50 * sys.maxint) + + self.assertEqual(range(a, a+2), [a, a+1]) + self.assertEqual(range(a+2, a, -1L), [a+2, a+1]) + self.assertEqual(range(a+4, a, -2), [a+4, a+2]) + + seq = range(a, b, c) + self.assert_(a in seq) + self.assert_(b not in seq) + self.assertEqual(len(seq), 2) + + seq = range(b, a, -c) + self.assert_(b in seq) + self.assert_(a not in seq) + self.assertEqual(len(seq), 2) + + seq = range(-a, -b, -c) + self.assert_(-a in seq) + self.assert_(-b not in seq) + self.assertEqual(len(seq), 2) + self.assertRaises(TypeError, range) self.assertRaises(TypeError, range, 1, 2, 3, 4) self.assertRaises(ValueError, range, 1, 2, 0) + + # Reject floats when it would require PyLongs to represent. + # (smaller floats still accepted, but deprecated) + self.assertRaises(ValueError, range, 1e100, 1e101, 1e101) def test_input_and_raw_input(self): From gvanrossum@users.sourceforge.net Fri Apr 11 19:43:09 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:43:09 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.284,2.285 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28123/Python Modified Files: bltinmodule.c Log Message: Patch by Chad Netzer (with significant change): - range() now works even if the arguments are longs with magnitude larger than sys.maxint, as long as the total length of the sequence fits. E.g., range(2**100, 2**101, 2**100) is the following list: [1267650600228229401496703205376L]. (SF patch #707427.) Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.284 retrieving revision 2.285 diff -C2 -d -r2.284 -r2.285 *** bltinmodule.c 6 Apr 2003 09:01:11 -0000 2.284 --- bltinmodule.c 11 Apr 2003 18:43:06 -0000 2.285 *************** *** 1253,1256 **** --- 1253,1436 ---- + + /* Return number of items in range (lo, hi, step), when arguments are + * PyInt or PyLong objects. step > 0 required. Return a value < 0 if + * & only if the true value is too large to fit in a signed long. + * Arguments MUST return 1 with either PyInt_Check() or + * PyLong_Check(). Return -1 when there is an error. + */ + static long + get_len_of_range_longs(PyObject *lo, PyObject *hi, PyObject *step) + { + /* ------------------------------------------------------------- + Algorithm is equal to that of get_len_of_range(), but it operates + on PyObjects (which are assumed to be PyLong or PyInt objects). + ---------------------------------------------------------------*/ + long n; + PyObject *diff = NULL; + PyObject *one = NULL; + PyObject *tmp1 = NULL, *tmp2 = NULL, *tmp3 = NULL; + /* holds sub-expression evaluations */ + + /* if (lo >= hi), return length of 0. */ + if (PyObject_Compare(lo, hi) >= 0) + return 0; + + if ((one = PyLong_FromLong(1L)) == NULL) + goto Fail; + + if ((tmp1 = PyNumber_Subtract(hi, lo)) == NULL) + goto Fail; + + if ((diff = PyNumber_Subtract(tmp1, one)) == NULL) + goto Fail; + + if ((tmp2 = PyNumber_FloorDivide(diff, step)) == NULL) + goto Fail; + + if ((tmp3 = PyNumber_Add(tmp2, one)) == NULL) + goto Fail; + + n = PyLong_AsLong(tmp3); + if (PyErr_Occurred()) { /* Check for Overflow */ + PyErr_Clear(); + goto Fail; + } + + Py_DECREF(tmp3); + Py_DECREF(tmp2); + Py_DECREF(diff); + Py_DECREF(tmp1); + Py_DECREF(one); + return n; + + Fail: + Py_XDECREF(tmp3); + Py_XDECREF(tmp2); + Py_XDECREF(diff); + Py_XDECREF(tmp1); + Py_XDECREF(one); + return -1; + } + + /* An extension of builtin_range() that handles the case when PyLong + * arguments are given. */ + static PyObject * + handle_range_longs(PyObject *self, PyObject *args) + { + PyObject *ilow; + PyObject *ihigh; + PyObject *zero = NULL; + PyObject *istep = NULL; + PyObject *curnum = NULL; + PyObject *v = NULL; + long bign; + int i, n; + int cmp_result; + + zero = PyLong_FromLong(0L); + if (zero == NULL) + return NULL; + + ilow = zero; /* Default lower bound */ + if (!PyArg_ParseTuple(args, "O", &ihigh, &istep)) { + PyErr_Clear(); + if (!PyArg_ParseTuple(args, + "OO|O;range() requires 1-3 int arguments", + &ilow, &ihigh, &istep)) + goto Fail; + } + + if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { + PyErr_SetString(PyExc_ValueError, + "integer start argument expected, got float."); + goto Fail; + return NULL; + } + + if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { + PyErr_SetString(PyExc_ValueError, + "integer end argument expected, got float."); + goto Fail; + return NULL; + } + + /* If no istep was supplied, default to 1. */ + if (istep == NULL) { + istep = PyLong_FromLong(1L); + if (istep == NULL) + goto Fail; + } + else { + if (!PyInt_Check(istep) && !PyLong_Check(istep)) { + PyErr_SetString(PyExc_ValueError, + "integer step argument expected, got float."); + goto Fail; + } + Py_INCREF(istep); + } + + if (PyObject_Cmp(istep, zero, &cmp_result) == -1) { + goto Fail; + } + + if (cmp_result == 0) { + PyErr_SetString(PyExc_ValueError, + "range() arg 3 must not be zero"); + goto Fail; + } + + if (cmp_result > 0) + bign = get_len_of_range_longs(ilow, ihigh, istep); + else { + PyObject *neg_istep = PyNumber_Negative(istep); + if (neg_istep == NULL) + goto Fail; + bign = get_len_of_range_longs(ihigh, ilow, neg_istep); + Py_DECREF(neg_istep); + } + + n = (int)bign; + if (bign < 0 || (long)n != bign) { + PyErr_SetString(PyExc_OverflowError, + "range() result has too many items"); + goto Fail; + } + + v = PyList_New(n); + if (v == NULL) + goto Fail; + + curnum = ilow; + Py_INCREF(curnum); + + for (i = 0; i < n; i++) { + PyObject *w = PyNumber_Long(curnum); + PyObject *tmp_num; + if (w == NULL) + goto Fail; + + PyList_SET_ITEM(v, i, w); + + tmp_num = PyNumber_Add(curnum, istep); + if (tmp_num == NULL) + goto Fail; + + Py_DECREF(curnum); + curnum = tmp_num; + } + Py_DECREF(curnum); + Py_DECREF(istep); + Py_DECREF(zero); + return v; + + Fail: + Py_XDECREF(curnum); + Py_XDECREF(istep); + Py_XDECREF(zero); + Py_XDECREF(v); + return NULL; + } + /* Return number of items in range/xrange (lo, hi, step). step > 0 * required. Return a value < 0 if & only if the true value is too *************** *** 1294,1308 **** if (!PyArg_ParseTuple(args, "l;range() requires 1-3 int arguments", ! &ihigh)) ! return NULL; } else { if (!PyArg_ParseTuple(args, "ll|l;range() requires 1-3 int arguments", ! &ilow, &ihigh, &istep)) ! return NULL; } if (istep == 0) { ! PyErr_SetString(PyExc_ValueError, "range() arg 3 must not be zero"); return NULL; } --- 1474,1493 ---- if (!PyArg_ParseTuple(args, "l;range() requires 1-3 int arguments", ! &ihigh)) { ! PyErr_Clear(); ! return handle_range_longs(self, args); ! } } else { if (!PyArg_ParseTuple(args, "ll|l;range() requires 1-3 int arguments", ! &ilow, &ihigh, &istep)) { ! PyErr_Clear(); ! return handle_range_longs(self, args); ! } } if (istep == 0) { ! PyErr_SetString(PyExc_ValueError, ! "range() arg 3 must not be zero"); return NULL; } From nnorwitz@users.sourceforge.net Fri Apr 11 19:48:05 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 11 Apr 2003 11:48:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgettext.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30690/Doc/lib Modified Files: libgettext.tex Log Message: Fix markup Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libgettext.tex 11 Apr 2003 18:36:43 -0000 1.15 --- libgettext.tex 11 Apr 2003 18:48:03 -0000 1.16 *************** *** 320,324 **** \begin{methoddesc}[GNUTranslations]{__init__}{ ! \optional{fp\optional{, coerce}} Constructs and parses a translation catalog in GNU gettext format. \var{fp} is passed to the base class (\class{NullTranslations}) --- 320,324 ---- \begin{methoddesc}[GNUTranslations]{__init__}{ ! \optional{fp\optional{, coerce}}} Constructs and parses a translation catalog in GNU gettext format. \var{fp} is passed to the base class (\class{NullTranslations}) From montanaro@users.sourceforge.net Fri Apr 11 20:33:58 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 11 Apr 2003 12:33:58 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv19130 Modified Files: _csv.c Log Message: zap commented out bit of code Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _csv.c 23 Mar 2003 14:32:54 -0000 1.3 --- _csv.c 11 Apr 2003 19:33:55 -0000 1.4 *************** *** 8,12 **** **** For people modifying this code, please note that as of this writing ! **** (2003-03-23), it is intended that this code should work with Python **** 2.2. --- 8,12 ---- **** For people modifying this code, please note that as of this writing ! **** (2003-03-23), it is intended t hat this code should work with Python **** 2.2. *************** *** 271,275 **** { Py_XDECREF(self->lineterminator); - /*PyMem_DEL(self);*/ self->ob_type->tp_free((PyObject *)self); } --- 271,274 ---- From bwarsaw@users.sourceforge.net Fri Apr 11 21:26:49 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 11 Apr 2003 13:26:49 -0700 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8084 Modified Files: gettext.py Log Message: NullTranslations.__init__(): Back out of setting the default charset to iso-8859-1. GNUTranslations._parse(): Back out the addition of a test for Project-ID-Version in the metadata. This was deliberately removed in response to SF patch #700839. Also, re-organize the code in _parse() so we parse the metadata header containing the charset parameter before we try to decode any strings using charset. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** gettext.py 11 Apr 2003 18:36:04 -0000 1.18 --- gettext.py 11 Apr 2003 20:26:47 -0000 1.19 *************** *** 173,177 **** def __init__(self, fp=None): self._info = {} ! self._charset = 'iso-8859-1' self._fallback = None if fp is not None: --- 173,177 ---- def __init__(self, fp=None): self._info = {} ! self._charset = None self._fallback = None if fp is not None: *************** *** 265,286 **** msg = buf[moff:mend] tmsg = buf[toff:tend] - if msg.find('\x00') >= 0: - # Plural forms - msgid1, msgid2 = msg.split('\x00') - tmsg = tmsg.split('\x00') - if self._coerce: - msgid1 = unicode(msgid1, self._charset) - tmsg = [unicode(x, self._charset) for x in tmsg] - for i in range(len(tmsg)): - catalog[(msgid1, i)] = tmsg[i] - else: - if self._coerce: - msg = unicode(msg, self._charset) - tmsg = unicode(tmsg, self._charset) - catalog[msg] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata ! if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.splitlines(): --- 265,272 ---- msg = buf[moff:mend] tmsg = buf[toff:tend] else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata ! if mlen == 0: # Catalog description for item in tmsg.splitlines(): *************** *** 300,303 **** --- 286,303 ---- plural = v[1].split('plural=')[1] self.plural = c2py(plural) + if msg.find('\x00') >= 0: + # Plural forms + msgid1, msgid2 = msg.split('\x00') + tmsg = tmsg.split('\x00') + if self._coerce: + msgid1 = unicode(msgid1, self._charset) + tmsg = [unicode(x, self._charset) for x in tmsg] + for i in range(len(tmsg)): + catalog[(msgid1, i)] = tmsg[i] + else: + if self._coerce: + msg = unicode(msg, self._charset) + tmsg = unicode(tmsg, self._charset) + catalog[msg] = tmsg # advance to next entry in the seek tables masteridx += 8 From bwarsaw@users.sourceforge.net Fri Apr 11 22:28:13 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 11 Apr 2003 14:28:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgettext.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5808 Modified Files: libgettext.tex Log Message: Back out of setting the default charset to iso-8859-1. Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libgettext.tex 11 Apr 2003 18:48:03 -0000 1.16 --- libgettext.tex 11 Apr 2003 21:28:10 -0000 1.17 *************** *** 296,300 **** \code{Content-Type} is found, then the \code{charset} property is used to initialize the ``protected'' \member{_charset} instance variable, ! defaulting to \code{iso-8859-1} if not found. The entire set of key/value pairs are placed into a dictionary and set as the ``protected'' \member{_info} instance variable. --- 296,300 ---- \code{Content-Type} is found, then the \code{charset} property is used to initialize the ``protected'' \member{_charset} instance variable, ! defaulting to \code{None} if not found. The entire set of key/value pairs are placed into a dictionary and set as the ``protected'' \member{_info} instance variable. From montanaro@users.sourceforge.net Fri Apr 11 22:40:04 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 11 Apr 2003 14:40:04 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv12297 Modified Files: _csv.c Log Message: typo Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _csv.c 11 Apr 2003 19:33:55 -0000 1.4 --- _csv.c 11 Apr 2003 21:40:01 -0000 1.5 *************** *** 8,12 **** **** For people modifying this code, please note that as of this writing ! **** (2003-03-23), it is intended t hat this code should work with Python **** 2.2. --- 8,12 ---- **** For people modifying this code, please note that as of this writing ! **** (2003-03-23), it is intended that this code should work with Python **** 2.2. From montanaro@users.sourceforge.net Sat Apr 12 00:10:17 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 11 Apr 2003 16:10:17 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24486 Modified Files: _csv.c Log Message: typo Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _csv.c 11 Apr 2003 21:40:01 -0000 1.5 --- _csv.c 11 Apr 2003 23:10:13 -0000 1.6 *************** *** 1097,1101 **** if (row_iter == NULL) { PyErr_SetString(PyExc_TypeError, ! "writerows() argument must be iteratable"); return NULL; } --- 1097,1101 ---- if (row_iter == NULL) { PyErr_SetString(PyExc_TypeError, ! "writerows() argument must be iterable"); return NULL; } From goodger@users.sourceforge.net Sat Apr 12 14:39:36 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 12 Apr 2003 06:39:36 -0700 Subject: [Python-checkins] python/nondist/peps pep-0754.txt,NONE,1.1 pep-0000.txt,1.235,1.236 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27973 Modified Files: pep-0000.txt Added Files: pep-0754.txt Log Message: added PEP 754, "IEEE 754 Floating Point Special Values", by Gregory R. Warnes (spell-checked & edited) --- NEW FILE: pep-0754.txt --- PEP: 754 Title: IEEE 754 Floating Point Special Values Version: $Revision: 1.1 $ Last-Modified: $Date: 2003/04/12 13:39:34 $ Author: Gregory R. Warnes Status: Draft Type: Standard Track Content-Type: text/x-rst Created: 28-Mar-2003 Python-Version: 2.3 Post-History: Abstract ======== This PEP proposes an API and a provides a reference module that generates and tests for IEEE 754 double-precision special values: positive infinity (Inf), negative infinity (-Inf), and not-a-number (NaN). Rationale ========= The IEEE 754 standard defines a set of binary representations and algorithmic rules for floating point arithmetic. Included in the standard is a set of constants for representing special values, including positive infinity (Inf), negative infinity (-Inf), and indeterminate or non-numeric results (NaN). Most modern CPUs implement the IEEE 754 standard, including the (Ultra)SPARC, PowerPC, and x86 processor series. Currently, the handling of IEEE 754 special values in Python depends on the underlying C library. Unfortunately, there is little consistency between C libraries in how or whether these values are handled. For instance, on some systems "float('Inf')" will properly return the IEEE 754 constant for positive infinity. On many systems, however, this expression will instead generate an error message. The output string representation for an IEEE 754 special value also varies by platform. For example, the expression "float(1e3000)", which is large enough to generate an overflow, should return a string representation corresponding to IEEE 754 positive infinity. Python 2.1.3 on x86 Debian Linux returns "inf". On Sparc Solaris 8 with Python 2.2.1, this same expression returns "Infinity", and on MS-Windows 2000 with Active Python 2.2.1, it returns "1.#INF". Adding to the confusion, some platforms generate one string on conversion from floating point and accept a different string for conversion to floating point. On these systems :: float(str(x)) will generate an error when "x" is an IEEE special value. In the past, some have recommended that programmers use expressions like:: Inf = 1e300**2 NaN = Inf/Inf to obtain positive infinity and not-a-number constants. However, the first expression generates an error on current Python interpreters. A possible alternative is to use:: Inf = 1e300000 NaN = Inf/Inf While this does not generate an error with current Python interpreters, it is still an ugly and potentially non-portable hack. In addition, defining NaN in this way does solve the problem of detecting such values. First, the IEEE 754 standard provides for an entire set of constant values for Not-a-Number. Second, the standard requires that :: NaN != X for all possible values of X, including NaN. As a consequence :: NaN == NaN should always evaluate to false. However, this behavior also is not consistently implemented. [e.g. Cygwin Python 2.2.2] Due to the many platform and library inconsistencies in handling IEEE special values, it is impossible to consistently set or detect IEEE 754 floating point values in normal Python code without resorting to directly manipulating bit-patterns. This PEP proposes a standard Python API and provides a reference module implementation which allows for consistent handling of IEEE 754 special values on all supported platforms. API Definition ============== Constants --------- NaN IEEE 754 "Not a Number" value Inf, PosInf IEEE 754 Positive Infinity value NegInf IEEE 754 Negative Infinity value Functions --------- is_NaN(value) Determine if the argument is a IEEE 754 NaN (Not a Number) value. is_Inf(value), is_PosInf(value) Determine if the argument is a IEEE 754 positive infinity value is_NegInf(value) Determine if the argument is a IEEE 754 negative infinity value is_Finite(value) Determine if the argument is an finite IEEE 754 value (i.e., is not NaN, positive or negative infinity) is_Infinite(value) Determine if the argument is an infinite IEEE 754 value (positive or negative infinity) Example ------- (Run under Python 2.2.1 on Solaris 8.) >>> import fpconst >>> val = 1e30000 # should be cause overflow and result in "Inf" >>> val Infinity >>> fpconst.is_Inf(val) 1 >>> fpconst.Inf Infinity >>> nval = val/val # should result in NaN >>> nval NaN >>> fpconst.is_NaN(nval) 1 >>> fpconst.is_NaN(val) 0 Implementation -------------- The reference implementation is provided in the module "fpconst" [1]_, which is written in pure Python by taking advantage of the "struct" standard module to directly set or test for the bit patterns that define IEEE 754 special values. Care has been taken to generate proper results on both big-endian and little-endian machines. The current implementation is pure Python, but some efficiency could be gained by translating the core routines into C. References ========== See http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html for reference material on the IEEE 754 floating point standard. .. [1] Further information on the reference package is available at http://software.biostat.washington.edu/statsoft/snake/fpconst. Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.235 retrieving revision 1.236 diff -C2 -d -r1.235 -r1.236 *** pep-0000.txt 1 Apr 2003 17:37:46 -0000 1.235 --- pep-0000.txt 12 Apr 2003 13:39:33 -0000 1.236 *************** *** 116,119 **** --- 116,120 ---- S 312 Simple Implicit Lambda Suzi, Martelli S 313 Adding Roman Numeral Literals to Python Meyer + S 754 IEEE 754 Floating Point Special Values Warnes Finished PEPs (done, implemented in CVS) *************** *** 320,323 **** --- 321,325 ---- S 313 Adding Roman Numeral Literals to Python Meyer SR 666 Reject Foolish Indentation Creighton + S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 397,400 **** --- 399,403 ---- Suzi, Roman rnd@onego.ru Tirosh, Oren oren at hishome.net + Warnes, Gregory R. warnes@users.sourceforge.net Warsaw, Barry barry@zope.com Wells, Cliff LogiplexSoftware@earthlink.net From montanaro@users.sourceforge.net Sat Apr 12 19:57:55 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 12 Apr 2003 11:57:55 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv6569 Modified Files: _csv.c Log Message: add writerows docstring conditionally exclude Unicode functions Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _csv.c 11 Apr 2003 23:10:13 -0000 1.6 --- _csv.c 12 Apr 2003 18:57:52 -0000 1.7 *************** *** 152,156 **** if (check_delattr(v) < 0) return -1; ! if (!PyString_Check(v) && !PyUnicode_Check(v)) { PyErr_BadArgument(); return -1; --- 152,160 ---- if (check_delattr(v) < 0) return -1; ! if (!PyString_Check(v) ! #ifdef Py_USING_UNICODE ! && !PyUnicode_Check(v) ! #endif ! ) { PyErr_BadArgument(); return -1; *************** *** 312,316 **** /* If dialect is a string, look it up in our registry */ ! if (PyString_Check(dialect) || PyUnicode_Check(dialect)) { PyObject * new_dia; new_dia = get_dialect_from_registry(dialect); --- 316,324 ---- /* If dialect is a string, look it up in our registry */ ! if (PyString_Check(dialect) ! #ifdef Py_USING_UNICODE ! || PyUnicode_Check(dialect) ! #endif ! ) { PyObject * new_dia; new_dia = get_dialect_from_registry(dialect); *************** *** 1011,1017 **** PyDoc_STRVAR(csv_writerow_doc, ! "join(sequence) -> string\n" "\n" ! "Construct a CSV record from a sequence of fields. Non-string\n" "elements will be converted to string."); --- 1019,1025 ---- PyDoc_STRVAR(csv_writerow_doc, ! "writerow(sequence)\n" "\n" ! "Construct and write a CSV record from a sequence of fields. Non-string\n" "elements will be converted to string."); *************** *** 1089,1092 **** --- 1097,1106 ---- } + PyDoc_STRVAR(csv_writerows_doc, + "writerows(sequence of sequences)\n" + "\n" + "Construct and write a series of sequences to a csv file. Non-string\n" + "elements will be converted to string."); + static PyObject * csv_writerows(WriterObj *self, PyObject *seqseq) *************** *** 1119,1123 **** static struct PyMethodDef Writer_methods[] = { { "writerow", (PyCFunction)csv_writerow, METH_O, csv_writerow_doc}, ! { "writerows", (PyCFunction)csv_writerows, METH_O}, { NULL, NULL } }; --- 1133,1137 ---- static struct PyMethodDef Writer_methods[] = { { "writerow", (PyCFunction)csv_writerow, METH_O, csv_writerow_doc}, ! { "writerows", (PyCFunction)csv_writerows, METH_O, csv_writerows_doc}, { NULL, NULL } }; *************** *** 1239,1243 **** if (!PyArg_ParseTuple(args, "OO", &name_obj, &dialect_obj)) return NULL; ! if (!PyString_Check(name_obj) && !PyUnicode_Check(name_obj)) { PyErr_SetString(PyExc_TypeError, "dialect name must be a string or unicode"); --- 1253,1261 ---- if (!PyArg_ParseTuple(args, "OO", &name_obj, &dialect_obj)) return NULL; ! if (!PyString_Check(name_obj) ! #ifdef Py_USING_UNICODE ! && !PyUnicode_Check(name_obj) ! #endif ! ) { PyErr_SetString(PyExc_TypeError, "dialect name must be a string or unicode"); From montanaro@users.sourceforge.net Sat Apr 12 20:17:17 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 12 Apr 2003 12:17:17 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16070 Modified Files: _csv.c Log Message: tighten up string checks make csv_{get,unregister}_dialect METH_O functions to avoid PyArg_ParseTuple Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _csv.c 12 Apr 2003 18:57:52 -0000 1.7 --- _csv.c 12 Apr 2003 19:17:14 -0000 1.8 *************** *** 188,193 **** return -1; } ! else ! *addr = PyString_AsString(v)[0]; return 0; } --- 188,197 ---- return -1; } ! else { ! char *s = PyString_AsString(v); ! if (s == NULL) ! return -1; ! *addr = s[0]; ! } return 0; } *************** *** 348,352 **** for (i = 0; i < PyList_GET_SIZE(dir_list); ++i) { name_obj = PyList_GET_ITEM(dir_list, i); ! if (PyString_AsString(name_obj)[0] == '_') continue; value_obj = PyObject_GetAttr(dialect, name_obj); --- 352,359 ---- for (i = 0; i < PyList_GET_SIZE(dir_list); ++i) { name_obj = PyList_GET_ITEM(dir_list, i); ! char *s = PyString_AsString(name_obj); ! if (s == NULL) ! return -1; ! if (s[0] == '_') continue; value_obj = PyObject_GetAttr(dialect, name_obj); *************** *** 1011,1014 **** --- 1018,1022 ---- memmove(self->rec + self->rec_len, + /* should not be NULL */ PyString_AsString(self->dialect->lineterminator), terminator_len); *************** *** 1064,1068 **** if (PyString_Check(field)) { ! append_ok = join_append(self, PyString_AsString(field), "ed, len == 1); Py_DECREF(field); --- 1072,1077 ---- if (PyString_Check(field)) { ! append_ok = join_append(self, ! PyString_AS_STRING(field), "ed, len == 1); Py_DECREF(field); *************** *** 1080,1084 **** return NULL; ! append_ok = join_append(self, PyString_AsString(str), "ed, len == 1); Py_DECREF(str); --- 1089,1093 ---- return NULL; ! append_ok = join_append(self, PyString_AS_STRING(str), "ed, len == 1); Py_DECREF(str); *************** *** 1292,1301 **** static PyObject * ! csv_unregister_dialect(PyObject *module, PyObject *args) { - PyObject *name_obj; - - if (!PyArg_ParseTuple(args, "O", &name_obj)) - return NULL; if (PyDict_DelItem(dialects, name_obj) < 0) return PyErr_Format(error_obj, "unknown dialect"); --- 1301,1306 ---- static PyObject * ! csv_unregister_dialect(PyObject *module, PyObject *name_obj) { if (PyDict_DelItem(dialects, name_obj) < 0) return PyErr_Format(error_obj, "unknown dialect"); *************** *** 1305,1314 **** static PyObject * ! csv_get_dialect(PyObject *module, PyObject *args) { - PyObject *name_obj; - - if (!PyArg_ParseTuple(args, "O", &name_obj)) - return NULL; return get_dialect_from_registry(name_obj); } --- 1310,1315 ---- static PyObject * ! csv_get_dialect(PyObject *module, PyObject *name_obj) { return get_dialect_from_registry(name_obj); } *************** *** 1430,1436 **** METH_VARARGS, csv_register_dialect_doc}, { "unregister_dialect", (PyCFunction)csv_unregister_dialect, ! METH_VARARGS, csv_unregister_dialect_doc}, { "get_dialect", (PyCFunction)csv_get_dialect, ! METH_VARARGS, csv_get_dialect_doc}, { NULL, NULL } }; --- 1431,1437 ---- METH_VARARGS, csv_register_dialect_doc}, { "unregister_dialect", (PyCFunction)csv_unregister_dialect, ! METH_O, csv_unregister_dialect_doc}, { "get_dialect", (PyCFunction)csv_get_dialect, ! METH_O, csv_get_dialect_doc}, { NULL, NULL } }; From montanaro@users.sourceforge.net Sat Apr 12 20:23:48 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 12 Apr 2003 12:23:48 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18705 Modified Files: _csv.c Log Message: use PyModule_Add{Int,String}Constant() where appropriate (thanks to Neal Norwitz for the code review, BTW) Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _csv.c 12 Apr 2003 19:17:14 -0000 1.8 --- _csv.c 12 Apr 2003 19:23:46 -0000 1.9 *************** *** 13,16 **** --- 13,18 ---- */ + #define MODULE_VERSION "1.0" + #include "Python.h" #include "structmember.h" *************** *** 1441,1447 **** { PyObject *module; - PyObject *rev; - PyObject *v; - int res; StyleDesc *style; --- 1443,1446 ---- *************** *** 1461,1468 **** /* Add version to the module. */ ! rev = PyString_FromString("1.0"); ! if (rev == NULL) ! return; ! if (PyModule_AddObject(module, "__version__", rev) < 0) return; --- 1460,1465 ---- /* Add version to the module. */ ! if (PyModule_AddStringConstant(module, "__version__", ! MODULE_VERSION) == -1) return; *************** *** 1476,1484 **** /* Add quote styles into dictionary */ for (style = quote_styles; style->name; style++) { ! v = PyInt_FromLong(style->style); ! if (v == NULL) ! return; ! res = PyModule_AddObject(module, style->name, v); ! if (res < 0) return; } --- 1473,1478 ---- /* Add quote styles into dictionary */ for (style = quote_styles; style->name; style++) { ! if (PyModule_AddIntConstant(module, style->name, ! style->style) == -1) return; } From akuchling@users.sourceforge.net Sat Apr 12 20:45:04 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 12 Apr 2003 12:45:04 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,NONE,1.1 pep-0000.txt,1.236,1.237 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27894 Modified Files: pep-0000.txt Added Files: pep-0314.txt Log Message: Create PEP 314, "Metadata for Python Software Packages v1.1" --- NEW FILE: pep-0314.txt --- PEP: 241 Title: Metadata for Python Software Packages Version: $Revision: 1.1 $ Author: A.M. Kuchling Type: Standards Track Created: 12-Mar-2001 Status: Final Post-History: 19-Mar-2001 Introduction This PEP describes a mechanism for adding metadata to Python packages. It includes specifics of the field names, and their semantics and usage. Including Metadata in Packages The Distutils 'sdist' command will be modified to extract the metadata fields from the arguments and write them to a file in the generated zipfile or tarball. This file will be named PKG-INFO and will be placed in the top directory of the source distribution (where the README, INSTALL, and other files usually go). Developers may not provide their own PKG-INFO file. The "sdist" command will, if it detects an existing PKG-INFO file, terminate with an appropriate error message. This should prevent confusion caused by the PKG-INFO and setup.py files being out of sync. The PKG-INFO file format is a single set of RFC-822 headers parseable by the rfc822.py module. The field names listed in the following section are used as the header names. There's no extension mechanism in this simple format; the Catalog and Distutils SIGs will aim at getting a more flexible format ready for Python 2.2. Fields This section specifies the names and semantics of each of the supported metadata fields. Fields marked with "(Multiple use)" may be specified multiple times in a single PKG-INFO file. Other fields may only occur once in a PKG-INFO file. Fields marked with "(optional)" are not required to appear in a valid PKG-INFO file, all other fields must be present. Metadata-Version Version of the file format; currently "1.0" is the only legal value here. Example: Metadata-Version: 1.0 Name The name of the package. Example: Name: BeagleVote Version A string containing the package's version number. This field should be parseable by one of the Version classes (StrictVersion or LooseVersion) in the distutils.version module. Example: Version: 1.0a2 Platform (multiple use) A comma-separated list of platform specifications, summarizing the operating systems supported by the package. The major supported platforms are listed below, but this list is necessarily incomplete. POSIX, MacOS, Windows, BeOS, PalmOS. Binary distributions will use the Supported-Platform field in their metadata to specify the OS and CPU for which the binary package was compiled. The semantics of the Supported-Platform are not specified in this PEP. Example: Platform: POSIX, Windows Summary A one-line summary of what the package does. Example: Summary: A module for collecting votes from beagles. Description (optional) A longer description of the package that can run to several paragraphs. (Software that deals with metadata should not assume any maximum size for this field, though one hopes that people won't include their instruction manual as the long-description.) Example: Description: This module collects votes from beagles in order to determine their electoral wishes. Do NOT try to use this module with basset hounds; it makes them grumpy. Keywords (optional) A list of additional keywords to be used to assist searching for the package in a larger catalog. Example: Keywords: dog puppy voting election Home-page (optional) A string containing the URL for the package's home page. Example: Home-page: http://www.example.com/~cschultz/bvote/ Author (optional) A string containing at a minimum the author's name. Contact information can also be added, separating each line with newlines. Example: Author: C. Schultz Universal Features Syndicate Los Angeles, CA Author-email A string containing the author's e-mail address. It can contain a name and e-mail address in the legal forms for a RFC-822 'From:' header. It's not optional because cataloging systems can use the e-mail portion of this field as a unique key representing the author. A catalog might provide authors the ability to store their GPG key, personal home page, and other additional metadata *about the author*, and optionally the ability to associate several e-mail addresses with the same person. Author-related metadata fields are not covered by this PEP. Example: Author-email: "C. Schultz" License A string selected from a short list of choices, specifying the license covering the package. Some licenses result in the software being freely redistributable, so packagers and resellers can automatically know that they're free to redistribute the software. Other licenses will require a careful reading by a human to determine the software can be repackaged and resold. The choices are: Artistic, BSD, DFSG, GNU GPL, GNU LGPL, "MIT", Mozilla PL, "public domain", Python, Qt PL, Zope PL, unknown, nocommercial, nosell, nosource, shareware, other Definitions of some of the licenses are: DFSG The license conforms to the Debian Free Software Guidelines, but does not use one of the other DFSG conforming licenses listed here. More information is available at: http://www.debian.org/social_contract#guidelines Python Python 1.6 or higher license. Version 1.5.2 and earlier are under the MIT license. public domain Software is public domain, not copyrighted. unknown Status is not known nocommercial Free private use but commercial use not permitted nosell Free use but distribution for profit by arrangement nosource Freely distributable but no source code shareware Payment is requested if software is used other General category for other non-DFSG licenses Some of these licenses can be interpreted to mean the software is freely redistributable. The list of redistributable licenses is: Artistic, BSD, DFSG, GNU GPL, GNU LGPL, "MIT", Mozilla PL, "public domain", Python, Qt PL, Zope PL, nosource, shareware Note that being redistributable does not mean a package qualifies as free software, 'nosource' and 'shareware' being examples. Example: License: MIT Acknowledgements Many changes and rewrites to this document were suggested by the readers of the Distutils SIG. In particular, Sean Reifschneider often contributed actual text for inclusion in this PEP. The list of licenses was compiled using the SourceForge license list and the CTAN license list compiled by Graham Williams; Carey Evans also offered several useful suggestions on this list. Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.236 retrieving revision 1.237 diff -C2 -d -r1.236 -r1.237 *** pep-0000.txt 12 Apr 2003 13:39:33 -0000 1.236 --- pep-0000.txt 12 Apr 2003 19:45:01 -0000 1.237 *************** *** 116,119 **** --- 116,120 ---- S 312 Simple Implicit Lambda Suzi, Martelli S 313 Adding Roman Numeral Literals to Python Meyer + S 314 Metadata for Python Software Packages v1.1 Kuchling S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 320,323 **** --- 321,325 ---- S 312 Simple Implicit Lambda Suzi, Martelli S 313 Adding Roman Numeral Literals to Python Meyer + S 314 Metadata for Python Software Packages v1.1 Kuchling SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes From akuchling@users.sourceforge.net Sat Apr 12 20:46:10 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 12 Apr 2003 12:46:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0241.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv28658 Modified Files: pep-0241.txt Log Message: Fix grammar glitch Index: pep-0241.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0241.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0241.txt 31 Oct 2002 01:35:08 -0000 1.12 --- pep-0241.txt 12 Apr 2003 19:46:07 -0000 1.13 *************** *** 169,173 **** resellers can automatically know that they're free to redistribute the software. Other licenses will require ! a careful reading by a human to determine the software can be repackaged and resold. --- 169,173 ---- resellers can automatically know that they're free to redistribute the software. Other licenses will require ! a careful reading by a human to determine how the software can be repackaged and resold. From akuchling@users.sourceforge.net Sat Apr 12 21:16:22 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 12 Apr 2003 13:16:22 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv10630 Modified Files: pep-0314.txt Log Message: Add Requires and Provides fields Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0314.txt 12 Apr 2003 19:45:01 -0000 1.1 --- pep-0314.txt 12 Apr 2003 20:16:20 -0000 1.2 *************** *** 1,10 **** ! PEP: 241 ! Title: Metadata for Python Software Packages Version: $Revision$ Author: A.M. Kuchling Type: Standards Track ! Created: 12-Mar-2001 ! Status: Final ! Post-History: 19-Mar-2001 Introduction --- 1,10 ---- ! PEP: 314 ! Title: Metadata for Python Software Packages v1.1 Version: $Revision$ Author: A.M. Kuchling Type: Standards Track ! Created: 12-Apr-2003 ! Status: Draft ! Post-History: Introduction *************** *** 14,17 **** --- 14,19 ---- semantics and usage. + This document specifies version 1.1 of the metadata format. + Version 1.0 is specified in PEP 241. Including Metadata in Packages *************** *** 49,58 **** Metadata-Version ! Version of the file format; currently "1.0" is the only ! legal value here. Example: ! Metadata-Version: 1.0 Name --- 51,60 ---- Metadata-Version ! Version of the file format; currently "1.0" and "1.1" are the ! only legal values here. Example: ! Metadata-Version: 1.1 Name *************** *** 169,173 **** resellers can automatically know that they're free to redistribute the software. Other licenses will require ! a careful reading by a human to determine the software can be repackaged and resold. --- 171,175 ---- resellers can automatically know that they're free to redistribute the software. Other licenses will require ! a careful reading by a human to determine how the software can be repackaged and resold. *************** *** 212,226 **** License: MIT ! Acknowledgements ! Many changes and rewrites to this document were suggested by the ! readers of the Distutils SIG. In particular, Sean Reifschneider ! often contributed actual text for inclusion in this PEP. ! ! The list of licenses was compiled using the SourceForge license ! list and the CTAN license list compiled by Graham Williams; Carey ! Evans also offered several useful suggestions on this list. Copyright --- 214,279 ---- License: MIT + Requires (multiple use) + + Each entry contains a string describing some other component or + module required by this package. ! The format of a requirement string is simple: an arbitrary ! sequence of characters, optionally followed by a version ! declaration within parentheses. Leading and trailing whitespace ! are ignored, and whitespace within the string is normalized to a ! single space. ! A version declaration is a series of conditional operators and ! version numbers, separated by commas. Conditional operators ! must be one of "<", ">", "<=", ">=", "=", and "!=". Version ! numbers must be in the format accepted by the ! distutils.version.StrictVersion class: two or three ! dot-separated numeric components, with an optional "pre-release" ! tag on the end consisting of the letter 'a' or 'b' followed by a ! number. Example version numbers are "1.0", "2.3a2", "1.3.99", ! ! XXX Do we really need = and !=? ! ! XXX Should it be == or =? ! ! XXX Should we support LooseVersion instead of StrictVersion? ! LooseVersions aren't comparable... ! ! Any number of conditional operators can be specified, e.g. ! ">1.0, !=1.3.4, <2.0". + All of the following are possible requirement strings: "rfc822", + "", "zlib (>=1.1.4)", "XML parser". + + There's no canonical list of what strings should be used; the + Python community is left to choose its own standards. + + Example: + + Requires: re + Requires: sys + Requires: zlib + Requires: pyexpat (>1.0) + Requires: DB-API 2.0 module + + Provides (multiple use) + + Each entry contains a string describing some other component or + module that will be provided by this package once it is + installed. These strings should match the ones used in + Requirements fields. Version declarations cannot be supplied; + instead the package's version number will be used. + + Example: + + Provides: xml + Provides: xml.utils + Provides: xml.utils.iso8601 + Provides: xml.dom + + Acknowledgements + + None yet. Copyright From akuchling@users.sourceforge.net Sat Apr 12 22:16:53 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 12 Apr 2003 14:16:53 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv1592 Modified Files: pep-0314.txt Log Message: Add Obsoletes and Conflicts; wording tweak Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0314.txt 12 Apr 2003 20:16:20 -0000 1.2 --- pep-0314.txt 12 Apr 2003 21:16:50 -0000 1.3 *************** *** 260,264 **** Provides (multiple use) ! Each entry contains a string describing some other component or module that will be provided by this package once it is installed. These strings should match the ones used in --- 260,264 ---- Provides (multiple use) ! Each entry contains a string describing a component or module that will be provided by this package once it is installed. These strings should match the ones used in *************** *** 273,279 **** --- 273,311 ---- Provides: xml.dom + Obsoletes (multiple use) + + Each entry contains a string describing a component or module + that this package renders obsolete, meaning that the two packages + should not be installed at the same time. Version declarations + cannot be supplied. (XXX Or are they needed for Obsoletes?) + + The most common use of this field will be in case a package name + changes, e.g. Gorgon 2.3 gets subsumed into Torqued Python 1.0. + When you install Torqued Python, the Gorgon package should be + removed. + + Example: + + Obsoletes: Gorgon + + Conflicts (multiple use) + + Each entry contains a string describing a component or module + that conflicts with this package, meaning that the two packages + should not be installed at the same time. Version declarations + cannot be supplied. + + Conflict resolution probably isn't very important for Python + programs, because few extensions will cause problems for other + extensions, unless they're using the same package name. This + field name is being defined here for future use. + + Conflicts: Gorgon + + Acknowledgements None yet. + Copyright From akuchling@users.sourceforge.net Sat Apr 12 22:31:31 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 12 Apr 2003 14:31:31 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv6957 Modified Files: pep-0314.txt Log Message: Add posting date Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0314.txt 12 Apr 2003 21:16:50 -0000 1.3 --- pep-0314.txt 12 Apr 2003 21:31:28 -0000 1.4 *************** *** 6,10 **** Created: 12-Apr-2003 Status: Draft ! Post-History: Introduction --- 6,10 ---- Created: 12-Apr-2003 Status: Draft ! Post-History: 12-Apr-2003 Introduction From jackjansen@users.sourceforge.net Sat Apr 12 23:27:14 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Standard_Suite.py,1.3,1.4 Terminal_Suite.py,1.6,1.7 Text_Suite.py,1.2,1.3 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/Terminal Modified Files: Standard_Suite.py Terminal_Suite.py Text_Suite.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 1 Apr 2003 22:05:10 -0000 1.3 --- Standard_Suite.py 12 Apr 2003 22:27:11 -0000 1.4 *************** *** 13,353 **** class Standard_Suite_Events: ! _argmap_close = { ! 'saving_in' : 'kfil', ! 'saving' : 'savo', ! } ! def close(self, _object, _attributes={}, **_arguments): ! """close: Close an object. ! Required argument: the object for the command [...1062 lines suppressed...] ! 'ptit' : _Prop_titled, ! 'pvis' : _Prop_visible, ! 'pzum' : _Prop_zoomed, ! 'vers' : _Prop_version, ! } ! ! _compdeclarations = { ! '< ' : _3c_, ! '<= ' : _b2_, ! '= ' : _3d_, ! '> ' : _3e_, ! '>= ' : _b3_, ! 'bgwt' : starts_with, ! 'cont' : contains, ! 'ends' : ends_with, ! } ! ! _enumdeclarations = { ! 'savo' : _Enum_savo, } Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Terminal_Suite.py 1 Apr 2003 22:05:12 -0000 1.6 --- Terminal_Suite.py 12 Apr 2003 22:27:11 -0000 1.7 *************** *** 13,76 **** class Terminal_Suite_Events: ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Opens a telnet: URL ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'GURL' ! _subcode = 'GURL' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_do_script = { ! 'in_' : 'kfil', ! 'with_command' : 'cmnd', ! } ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Run a UNIX shell script or command ! Required argument: the object for the command ! Keyword argument in_: the window in which to execute the command ! Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'core' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - The Terminal program """ ! want = 'capp' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'capp' class _Prop_properties(aetools.NProperty): ! """properties - every property of the Terminal program """ ! which = 'pALL' ! want = '****' # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] --- 13,76 ---- class Terminal_Suite_Events: ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Opens a telnet: URL ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'GURL' ! _subcode = 'GURL' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_do_script = { ! 'in_' : 'kfil', ! 'with_command' : 'cmnd', ! } ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Run a UNIX shell script or command ! Required argument: the object for the command ! Keyword argument in_: the window in which to execute the command ! Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'core' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - The Terminal program """ ! want = 'capp' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'capp' class _Prop_properties(aetools.NProperty): ! """properties - every property of the Terminal program """ ! which = 'pALL' ! want = '****' # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 79,172 **** class window(aetools.ComponentItem): ! """window - A Terminal window """ ! want = 'cwin' class _Prop_background_color(aetools.NProperty): ! """background color - the background color for the window """ ! which = 'pbcl' ! want = '****' class _Prop_bold_text_color(aetools.NProperty): ! """bold text color - the bold text color for the window """ ! which = 'pbtc' ! want = '****' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ ! which = 'pbnd' ! want = '****' class _Prop_busy(aetools.NProperty): ! """busy - Is the window busy running a process? """ ! which = 'busy' ! want = 'bool' class _Prop_contents(aetools.NProperty): ! """contents - the currently visible contents of the window """ ! which = 'pcnt' ! want = 'utxt' class _Prop_cursor_color(aetools.NProperty): ! """cursor color - the cursor color for the window """ ! which = 'pcuc' ! want = '****' class _Prop_custom_title(aetools.NProperty): ! """custom title - the custom title for the window """ ! which = 'titl' ! want = 'utxt' class _Prop_frame(aetools.NProperty): ! """frame - the origin and size of the window """ ! which = 'pfra' ! want = '****' class _Prop_frontmost(aetools.NProperty): ! """frontmost - Is the window in front of the other Terminal windows? """ ! which = 'pisf' ! want = 'bool' class _Prop_history(aetools.NProperty): ! """history - the contents of the entire scrolling buffer of the window """ ! which = 'hist' ! want = 'utxt' class _Prop_normal_text_color(aetools.NProperty): ! """normal text color - the normal text color for the window """ ! which = 'ptxc' ! want = '****' class _Prop_number_of_columns(aetools.NProperty): ! """number of columns - the number of columns in the window """ ! which = 'ccol' ! want = 'long' class _Prop_number_of_rows(aetools.NProperty): ! """number of rows - the number of rows in the window """ ! which = 'crow' ! want = 'long' class _Prop_origin(aetools.NProperty): ! """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ ! which = 'pori' ! want = '****' class _Prop_position(aetools.NProperty): ! """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ ! which = 'ppos' ! want = '****' class _Prop_processes(aetools.NProperty): ! """processes - a list of the currently running processes """ ! which = 'prcs' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - the width and height of the window """ ! which = 'psiz' ! want = '****' class _Prop_title_displays_custom_title(aetools.NProperty): ! """title displays custom title - Does the title for the window contain a custom title? """ ! which = 'tdct' ! want = 'bool' class _Prop_title_displays_device_name(aetools.NProperty): ! """title displays device name - Does the title for the window contain the device name? """ ! which = 'tddn' ! want = 'bool' class _Prop_title_displays_file_name(aetools.NProperty): ! """title displays file name - Does the title for the window contain the file name? """ ! which = 'tdfn' ! want = 'bool' class _Prop_title_displays_shell_path(aetools.NProperty): ! """title displays shell path - Does the title for the window contain the shell path? """ ! which = 'tdsp' ! want = 'bool' class _Prop_title_displays_window_size(aetools.NProperty): ! """title displays window size - Does the title for the window contain the window size? """ ! which = 'tdws' ! want = 'bool' windows = window --- 79,172 ---- class window(aetools.ComponentItem): ! """window - A Terminal window """ ! want = 'cwin' class _Prop_background_color(aetools.NProperty): ! """background color - the background color for the window """ ! which = 'pbcl' ! want = '****' class _Prop_bold_text_color(aetools.NProperty): ! """bold text color - the bold text color for the window """ ! which = 'pbtc' ! want = '****' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ ! which = 'pbnd' ! want = '****' class _Prop_busy(aetools.NProperty): ! """busy - Is the window busy running a process? """ ! which = 'busy' ! want = 'bool' class _Prop_contents(aetools.NProperty): ! """contents - the currently visible contents of the window """ ! which = 'pcnt' ! want = 'utxt' class _Prop_cursor_color(aetools.NProperty): ! """cursor color - the cursor color for the window """ ! which = 'pcuc' ! want = '****' class _Prop_custom_title(aetools.NProperty): ! """custom title - the custom title for the window """ ! which = 'titl' ! want = 'utxt' class _Prop_frame(aetools.NProperty): ! """frame - the origin and size of the window """ ! which = 'pfra' ! want = '****' class _Prop_frontmost(aetools.NProperty): ! """frontmost - Is the window in front of the other Terminal windows? """ ! which = 'pisf' ! want = 'bool' class _Prop_history(aetools.NProperty): ! """history - the contents of the entire scrolling buffer of the window """ ! which = 'hist' ! want = 'utxt' class _Prop_normal_text_color(aetools.NProperty): ! """normal text color - the normal text color for the window """ ! which = 'ptxc' ! want = '****' class _Prop_number_of_columns(aetools.NProperty): ! """number of columns - the number of columns in the window """ ! which = 'ccol' ! want = 'long' class _Prop_number_of_rows(aetools.NProperty): ! """number of rows - the number of rows in the window """ ! which = 'crow' ! want = 'long' class _Prop_origin(aetools.NProperty): ! """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ ! which = 'pori' ! want = '****' class _Prop_position(aetools.NProperty): ! """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ ! which = 'ppos' ! want = '****' class _Prop_processes(aetools.NProperty): ! """processes - a list of the currently running processes """ ! which = 'prcs' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - the width and height of the window """ ! which = 'psiz' ! want = '****' class _Prop_title_displays_custom_title(aetools.NProperty): ! """title displays custom title - Does the title for the window contain a custom title? """ ! which = 'tdct' ! want = 'bool' class _Prop_title_displays_device_name(aetools.NProperty): ! """title displays device name - Does the title for the window contain the device name? """ ! which = 'tddn' ! want = 'bool' class _Prop_title_displays_file_name(aetools.NProperty): ! """title displays file name - Does the title for the window contain the file name? """ ! which = 'tdfn' ! want = 'bool' class _Prop_title_displays_shell_path(aetools.NProperty): ! """title displays shell path - Does the title for the window contain the shell path? """ ! which = 'tdsp' ! want = 'bool' class _Prop_title_displays_window_size(aetools.NProperty): ! """title displays window size - Does the title for the window contain the window size? """ ! which = 'tdws' ! want = 'bool' windows = window *************** *** 174,210 **** import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } application._privelemdict = { ! 'document' : Standard_Suite.document, ! 'window' : window, } window._superclassnames = [] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'background_color' : _Prop_background_color, ! 'bold_text_color' : _Prop_bold_text_color, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'contents' : _Prop_contents, ! 'cursor_color' : _Prop_cursor_color, ! 'custom_title' : _Prop_custom_title, ! 'frame' : _Prop_frame, ! 'frontmost' : _Prop_frontmost, ! 'history' : _Prop_history, ! 'normal_text_color' : _Prop_normal_text_color, ! 'number_of_columns' : _Prop_number_of_columns, ! 'number_of_rows' : _Prop_number_of_rows, ! 'origin' : _Prop_origin, ! 'position' : _Prop_position, ! 'processes' : _Prop_processes, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'title_displays_custom_title' : _Prop_title_displays_custom_title, ! 'title_displays_device_name' : _Prop_title_displays_device_name, ! 'title_displays_file_name' : _Prop_title_displays_file_name, ! 'title_displays_shell_path' : _Prop_title_displays_shell_path, ! 'title_displays_window_size' : _Prop_title_displays_window_size, } window._privelemdict = { --- 174,210 ---- import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } application._privelemdict = { ! 'document' : Standard_Suite.document, ! 'window' : window, } window._superclassnames = [] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'background_color' : _Prop_background_color, ! 'bold_text_color' : _Prop_bold_text_color, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'contents' : _Prop_contents, ! 'cursor_color' : _Prop_cursor_color, ! 'custom_title' : _Prop_custom_title, ! 'frame' : _Prop_frame, ! 'frontmost' : _Prop_frontmost, ! 'history' : _Prop_history, ! 'normal_text_color' : _Prop_normal_text_color, ! 'number_of_columns' : _Prop_number_of_columns, ! 'number_of_rows' : _Prop_number_of_rows, ! 'origin' : _Prop_origin, ! 'position' : _Prop_position, ! 'processes' : _Prop_processes, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'title_displays_custom_title' : _Prop_title_displays_custom_title, ! 'title_displays_device_name' : _Prop_title_displays_device_name, ! 'title_displays_file_name' : _Prop_title_displays_file_name, ! 'title_displays_shell_path' : _Prop_title_displays_shell_path, ! 'title_displays_window_size' : _Prop_title_displays_window_size, } window._privelemdict = { *************** *** 215,219 **** # _classdeclarations = { ! 'capp' : application, ! 'cwin' : window, } --- 215,252 ---- # _classdeclarations = { ! 'capp' : application, ! 'cwin' : window, ! } ! ! _propdeclarations = { ! 'busy' : _Prop_busy, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'ccol' : _Prop_number_of_columns, ! 'crow' : _Prop_number_of_rows, ! 'hist' : _Prop_history, ! 'pALL' : _Prop_properties, ! 'pbcl' : _Prop_background_color, ! 'pbnd' : _Prop_bounds, ! 'pbtc' : _Prop_bold_text_color, ! 'pcnt' : _Prop_contents, ! 'pcuc' : _Prop_cursor_color, ! 'pfra' : _Prop_frame, ! 'pisf' : _Prop_frontmost, ! 'pori' : _Prop_origin, ! 'ppos' : _Prop_position, ! 'prcs' : _Prop_processes, ! 'psiz' : _Prop_size, ! 'ptxc' : _Prop_normal_text_color, ! 'tdct' : _Prop_title_displays_custom_title, ! 'tddn' : _Prop_title_displays_device_name, ! 'tdfn' : _Prop_title_displays_file_name, ! 'tdsp' : _Prop_title_displays_shell_path, ! 'tdws' : _Prop_title_displays_window_size, ! 'titl' : _Prop_custom_title, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Text_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Text_Suite.py 1 Apr 2003 22:05:13 -0000 1.2 --- Text_Suite.py 12 Apr 2003 22:27:11 -0000 1.3 *************** *** 13,30 **** class Text_Suite_Events: ! pass class attachment(aetools.ComponentItem): ! """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ ! want = 'atts' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'ctxt' class _Prop_file_name(aetools.NProperty): ! """file name - The path to the file for the attachment """ ! which = 'atfn' ! want = 'utxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 13,30 ---- class Text_Suite_Events: ! pass class attachment(aetools.ComponentItem): ! """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ ! want = 'atts' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'ctxt' class _Prop_file_name(aetools.NProperty): ! """file name - The path to the file for the attachment """ ! which = 'atfn' ! want = 'utxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 33,50 **** class attribute_run(aetools.ComponentItem): ! """attribute run - This subdivides the text into chunks that all have the same attributes. """ ! want = 'catr' class _Prop_color(aetools.NProperty): ! """color - The color of the first character. """ ! which = 'colr' ! want = 'colr' class _Prop_font(aetools.NProperty): ! """font - The name of the font of the first character. """ ! which = 'font' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - The size in points of the first character. """ ! which = 'ptsz' ! want = 'long' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 33,50 ---- class attribute_run(aetools.ComponentItem): ! """attribute run - This subdivides the text into chunks that all have the same attributes. """ ! want = 'catr' class _Prop_color(aetools.NProperty): ! """color - The color of the first character. """ ! which = 'colr' ! want = 'colr' class _Prop_font(aetools.NProperty): ! """font - The name of the font of the first character. """ ! which = 'font' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - The size in points of the first character. """ ! which = 'ptsz' ! want = 'long' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 55,60 **** class character(aetools.ComponentItem): ! """character - This subdivides the text into characters. """ ! want = 'cha ' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 55,60 ---- class character(aetools.ComponentItem): ! """character - This subdivides the text into characters. """ ! want = 'cha ' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 65,70 **** class paragraph(aetools.ComponentItem): ! """paragraph - This subdivides the text into paragraphs. """ ! want = 'cpar' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 65,70 ---- class paragraph(aetools.ComponentItem): ! """paragraph - This subdivides the text into paragraphs. """ ! want = 'cpar' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 75,80 **** class text(aetools.ComponentItem): ! """text - Rich (styled) text """ ! want = 'ctxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 75,80 ---- class text(aetools.ComponentItem): ! """text - Rich (styled) text """ ! want = 'ctxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 83,88 **** class word(aetools.ComponentItem): ! """word - This subdivides the text into words. """ ! want = 'cwor' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 83,88 ---- class word(aetools.ComponentItem): ! """word - This subdivides the text into words. """ ! want = 'cwor' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 93,170 **** attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } import Standard_Suite attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } --- 93,170 ---- attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } import Standard_Suite attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } *************** *** 173,181 **** # _classdeclarations = { ! 'atts' : attachment, ! 'catr' : attribute_run, ! 'cha ' : character, ! 'cpar' : paragraph, ! 'ctxt' : text, ! 'cwor' : word, } --- 173,195 ---- # _classdeclarations = { ! 'atts' : attachment, ! 'catr' : attribute_run, ! 'cha ' : character, ! 'cpar' : paragraph, ! 'ctxt' : text, ! 'cwor' : word, ! } ! ! _propdeclarations = { ! 'atfn' : _Prop_file_name, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'colr' : _Prop_color, ! 'font' : _Prop_font, ! 'ptsz' : _Prop_size, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 1 Apr 2003 22:05:14 -0000 1.6 --- __init__.py 12 Apr 2003 22:27:11 -0000 1.7 *************** *** 10,16 **** _code_to_module = { ! '????' : Standard_Suite, ! '????' : Text_Suite, ! 'trmx' : Terminal_Suite, } --- 10,16 ---- _code_to_module = { ! '????' : Standard_Suite, ! '????' : Text_Suite, ! 'trmx' : Terminal_Suite, } *************** *** 18,24 **** _code_to_fullname = { ! '????' : ('Terminal.Standard_Suite', 'Standard_Suite'), ! '????' : ('Terminal.Text_Suite', 'Text_Suite'), ! 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), } --- 18,24 ---- _code_to_fullname = { ! '????' : ('Terminal.Standard_Suite', 'Standard_Suite'), ! '????' : ('Terminal.Text_Suite', 'Text_Suite'), ! 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), } *************** *** 28,41 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 28,41 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 44,47 **** --- 44,52 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(color) + getbaseclasses(window) + getbaseclasses(application) + getbaseclasses(item) + getbaseclasses(document) getbaseclasses(character) getbaseclasses(attachment) *************** *** 52,60 **** getbaseclasses(window) getbaseclasses(application) - getbaseclasses(color) - getbaseclasses(window) - getbaseclasses(application) - getbaseclasses(item) - getbaseclasses(document) # --- 57,60 ---- *************** *** 62,87 **** # _classdeclarations = { ! 'cha ' : character, ! 'atts' : attachment, ! 'cpar' : paragraph, ! 'cwor' : word, ! 'catr' : attribute_run, ! 'ctxt' : text, ! 'cwin' : window, ! 'capp' : application, ! 'colr' : color, ! 'cwin' : window, ! 'capp' : application, ! 'cobj' : item, ! 'docu' : document, } class Terminal(Standard_Suite_Events, ! Text_Suite_Events, ! Terminal_Suite_Events, ! aetools.TalkTo): ! _signature = 'trmx' ! _moduleName = 'Terminal' --- 62,87 ---- # _classdeclarations = { ! 'colr' : color, ! 'cwin' : window, ! 'capp' : application, ! 'cobj' : item, ! 'docu' : document, ! 'cha ' : character, ! 'atts' : attachment, ! 'cpar' : paragraph, ! 'cwor' : word, ! 'catr' : attribute_run, ! 'ctxt' : text, ! 'cwin' : window, ! 'capp' : application, } class Terminal(Standard_Suite_Events, ! Text_Suite_Events, ! Terminal_Suite_Events, ! aetools.TalkTo): ! _signature = 'trmx' ! _moduleName = 'Terminal' From jackjansen@users.sourceforge.net Sat Apr 12 23:27:12 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.5,1.6 PowerPlant.py,1.4,1.5 Required_suite.py,1.3,1.4 Standard_Suite.py,1.4,1.5 Standard_URL_suite.py,1.3,1.4 Text.py,1.6,1.7 WorldWideWeb_suite.py,1.4,1.5 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Mozilla_suite.py 1 Apr 2003 22:04:44 -0000 1.5 --- Mozilla_suite.py 12 Apr 2003 22:27:09 -0000 1.6 *************** *** 13,251 **** class Mozilla_suite_Events: ! def Get_Import_Data(self, _no_object=None, _attributes={}, **_arguments): ! """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, \xd4Brwz\xd5 browser, \xd4Addr\xd5 addressbook, \xd4Mesg\xd5 messenger, etc., 4 bytes) ! """ ! _code = 'MOSS' ! _subcode = 'Impt' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Get_Profile_Name(self, _no_object=None, _attributes={}, **_arguments): ! """Get Profile Name: Get the current User Profile ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Name of the current profile, like \xd2Joe Bloggs\xd3. This is the name of the profile folder in the Netscape Users folder. ! """ ! _code = 'MOSS' ! _subcode = 'upro' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Get_workingURL(self, _no_object=None, _attributes={}, **_arguments): ! """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Will return text of the from \xd2FILE://foo/applicationname\xd3 ! """ ! _code = 'MOSS' ! _subcode = 'wurl' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_Go = { ! 'direction' : 'dire', ! } ! def Go(self, _object, _attributes={}, **_arguments): ! """Go: navigate a window: back, forward, again(reload), home) ! Required argument: window ! Keyword argument direction: undocumented, typecode 'dire' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'gogo' ! aetools.keysubst(_arguments, self._argmap_Go) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'dire', _Enum_dire) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Handle_command(self, _object, _attributes={}, **_arguments): ! """Handle command: Handle a command ! Required argument: The command to handle ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'hcmd' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_Address_Book(self, _no_object=None, _attributes={}, **_arguments): ! """Open Address Book: Opens the address book ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'addr' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_Component(self, _object, _attributes={}, **_arguments): ! """Open Component: Open a Communicator component ! Required argument: The component to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'cpnt' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_Profile_Manager(self, _no_object=None, _attributes={}, **_arguments): ! """Open Profile Manager: Open the user profile manager (obsolete) ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'prfl' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_bookmark(self, _object=None, _attributes={}, **_arguments): ! """Open bookmark: Reads in a bookmark file ! Required argument: If not available, reloads the current bookmark file ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'book' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_Read_help_file = { ! 'with_index' : 'idid', ! 'search_text' : 'sear', ! } ! def Read_help_file(self, _object, _attributes={}, **_arguments): ! """Read help file: Reads in the help file (file should be in the help file format) ! Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to \xd4DEFAULT\xd5) ! Keyword argument search_text: Optional text to search for ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'help' ! aetools.keysubst(_arguments, self._argmap_Read_help_file) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_comp = { ! 'Navigator' : 'navg', # The Navigator component ! 'InBox' : 'inbx', # The InBox component ! 'Newsgroups' : 'colb', # The Newsgroups component ! 'Composer' : 'cpsr', # The Page Composer component ! 'Conference' : 'conf', # The Conference Component ! 'Calendar' : 'cald', # The Calendar Component } _Enum_dire = { ! 'again' : 'agai', # Again (reload) ! 'home' : 'home', # Home ! 'backward' : 'prev', # Previous page ! 'forward' : 'next', # Next page } _Enum_ncmd = { ! 'Get_new_mail' : '\x00\x00\x04W', # ! 'Send_queued_messages' : '\x00\x00\x04X', # ! 'Read_newsgroups' : '\x00\x00\x04\x04', # ! 'Show_Inbox' : '\x00\x00\x04\x05', # ! 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # ! 'Show_History_window' : '\x00\x00\x04\x07', # ! 'Show_Address_Book_window' : '\x00\x00\x04\t', # } --- 13,251 ---- class Mozilla_suite_Events: ! def Get_Import_Data(self, _no_object=None, _attributes={}, **_arguments): ! """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, \xd4Brwz\xd5 browser, \xd4Addr\xd5 addressbook, \xd4Mesg\xd5 messenger, etc., 4 bytes) ! """ ! _code = 'MOSS' ! _subcode = 'Impt' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Get_Profile_Name(self, _no_object=None, _attributes={}, **_arguments): ! """Get Profile Name: Get the current User Profile ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Name of the current profile, like \xd2Joe Bloggs\xd3. This is the name of the profile folder in the Netscape Users folder. ! """ ! _code = 'MOSS' ! _subcode = 'upro' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Get_workingURL(self, _no_object=None, _attributes={}, **_arguments): ! """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Will return text of the from \xd2FILE://foo/applicationname\xd3 ! """ ! _code = 'MOSS' ! _subcode = 'wurl' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_Go = { ! 'direction' : 'dire', ! } ! def Go(self, _object, _attributes={}, **_arguments): ! """Go: navigate a window: back, forward, again(reload), home) ! Required argument: window ! Keyword argument direction: undocumented, typecode 'dire' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'gogo' ! aetools.keysubst(_arguments, self._argmap_Go) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'dire', _Enum_dire) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Handle_command(self, _object, _attributes={}, **_arguments): ! """Handle command: Handle a command ! Required argument: The command to handle ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'hcmd' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_Address_Book(self, _no_object=None, _attributes={}, **_arguments): ! """Open Address Book: Opens the address book ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'addr' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_Component(self, _object, _attributes={}, **_arguments): ! """Open Component: Open a Communicator component ! Required argument: The component to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'cpnt' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_Profile_Manager(self, _no_object=None, _attributes={}, **_arguments): ! """Open Profile Manager: Open the user profile manager (obsolete) ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'prfl' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def Open_bookmark(self, _object=None, _attributes={}, **_arguments): ! """Open bookmark: Reads in a bookmark file ! Required argument: If not available, reloads the current bookmark file ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'book' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_Read_help_file = { ! 'with_index' : 'idid', ! 'search_text' : 'sear', ! } ! def Read_help_file(self, _object, _attributes={}, **_arguments): ! """Read help file: Reads in the help file (file should be in the help file format) ! Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to \xd4DEFAULT\xd5) ! Keyword argument search_text: Optional text to search for ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'help' ! aetools.keysubst(_arguments, self._argmap_Read_help_file) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_comp = { ! 'Navigator' : 'navg', # The Navigator component ! 'InBox' : 'inbx', # The InBox component ! 'Newsgroups' : 'colb', # The Newsgroups component ! 'Composer' : 'cpsr', # The Page Composer component ! 'Conference' : 'conf', # The Conference Component ! 'Calendar' : 'cald', # The Calendar Component } _Enum_dire = { ! 'again' : 'agai', # Again (reload) ! 'home' : 'home', # Home ! 'backward' : 'prev', # Previous page ! 'forward' : 'next', # Next page } _Enum_ncmd = { ! 'Get_new_mail' : '\x00\x00\x04W', # ! 'Send_queued_messages' : '\x00\x00\x04X', # ! 'Read_newsgroups' : '\x00\x00\x04\x04', # ! 'Show_Inbox' : '\x00\x00\x04\x05', # ! 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # ! 'Show_History_window' : '\x00\x00\x04\x07', # ! 'Show_Address_Book_window' : '\x00\x00\x04\t', # } *************** *** 255,257 **** --- 255,269 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { + 'comp' : _Enum_comp, + 'dire' : _Enum_dire, + 'ncmd' : _Enum_ncmd, } Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PowerPlant.py 1 Apr 2003 22:04:45 -0000 1.4 --- PowerPlant.py 12 Apr 2003 22:27:09 -0000 1.5 *************** *** 13,70 **** class PowerPlant_Events: ! _argmap_SwitchTellTarget = { ! 'to' : 'data', ! } ! def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the \xd2focus\xd3 of AppleEvents ! Keyword argument to: reference to new focus of AppleEvents ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'ppnt' ! _subcode = 'sttg' ! aetools.keysubst(_arguments, self._argmap_SwitchTellTarget) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_select = { ! 'data' : 'data', ! } ! def select(self, _object, _attributes={}, **_arguments): ! """select: Sets the present selection ! Required argument: object to select or container of sub-objects to select ! Keyword argument data: sub-object(s) to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! aetools.keysubst(_arguments, self._argmap_select) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_dbac = { ! 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. ! 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. ! 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). ! 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). } --- 13,70 ---- class PowerPlant_Events: ! _argmap_SwitchTellTarget = { ! 'to' : 'data', ! } ! def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the \xd2focus\xd3 of AppleEvents ! Keyword argument to: reference to new focus of AppleEvents ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'ppnt' ! _subcode = 'sttg' ! aetools.keysubst(_arguments, self._argmap_SwitchTellTarget) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_select = { ! 'data' : 'data', ! } ! def select(self, _object, _attributes={}, **_arguments): ! """select: Sets the present selection ! Required argument: object to select or container of sub-objects to select ! Keyword argument data: sub-object(s) to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! aetools.keysubst(_arguments, self._argmap_select) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_dbac = { ! 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. ! 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. ! 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). ! 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). } *************** *** 74,76 **** --- 74,86 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { + 'dbac' : _Enum_dbac, } Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Required_suite.py 1 Apr 2003 22:04:45 -0000 1.3 --- Required_suite.py 12 Apr 2003 22:27:09 -0000 1.4 *************** *** 14,94 **** class Required_suite_Events(Required_Suite_Events): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print the specified object(s) ! Required argument: list of objects to print ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'pdoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit Navigator ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: Sent to an application when it is double-clicked ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'oapp' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 14,94 ---- class Required_suite_Events(Required_Suite_Events): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print the specified object(s) ! Required argument: list of objects to print ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'pdoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit Navigator ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: Sent to an application when it is double-clicked ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'oapp' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 97,99 **** --- 97,108 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 1 Apr 2003 22:04:45 -0000 1.4 --- Standard_Suite.py 12 Apr 2003 22:27:09 -0000 1.5 *************** *** 14,206 **** class Standard_Suite_Events(Standard_Suite_Events): ! def close(self, _object, _attributes={}, **_arguments): ! """close: Close an object ! Required argument: the objects to close ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'clos' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def data_size(self, _object, _attributes={}, **_arguments): ! """data size: Return the size in bytes of an object ! Required argument: the object whose data size is to be returned ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the size of the object in bytes ! """ ! _code = 'core' ! _subcode = 'dsiz' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def get(self, _object, _attributes={}, **_arguments): ! """get: Get the data for an object ! Required argument: the object whose data is to be returned ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The data from the object ! """ ! _code = 'core' ! _subcode = 'getd' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_set = { ! 'to' : 'data', ! } ! def set(self, _object, _attributes={}, **_arguments): ! """set: Set an object\xd5s data ! Required argument: the object to change ! Keyword argument to: the new value ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! aetools.keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - An application program """ ! want = 'capp' class _Prop_alert_application(aetools.NProperty): ! """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ ! which = 'ALAP' ! want = 'type' class _Prop_kiosk_mode(aetools.NProperty): ! """kiosk mode - Kiosk mode leaves very few menus enabled """ ! which = 'KOSK' ! want = 'long' # element 'cwin' as ['indx', 'name', 'ID '] class window(aetools.ComponentItem): ! """window - A Window """ ! want = 'cwin' class _Prop_URL(aetools.NProperty): ! """URL - Current URL """ ! which = 'curl' ! want = 'TEXT' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_busy(aetools.NProperty): ! """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ ! which = 'busy' ! want = 'long' class _Prop_closeable(aetools.NProperty): ! """closeable - Does the window have a close box? """ ! which = 'hclb' ! want = 'bool' class _Prop_floating(aetools.NProperty): ! """floating - Does the window float? """ ! which = 'isfl' ! want = 'bool' class _Prop_index(aetools.NProperty): ! """index - the number of the window """ ! which = 'pidx' ! want = 'long' class _Prop_modal(aetools.NProperty): ! """modal - Is the window modal? """ ! which = 'pmod' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the title of the window """ ! which = 'pnam' ! want = 'itxt' class _Prop_position(aetools.NProperty): ! """position - upper left coordinates of window """ ! which = 'ppos' ! want = 'QDpt' class _Prop_resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class _Prop_titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' ! want = 'bool' class _Prop_unique_ID(aetools.NProperty): ! """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ ! which = 'wiid' ! want = 'long' class _Prop_visible(aetools.NProperty): ! """visible - is the window visible? """ ! which = 'pvis' ! want = 'bool' class _Prop_zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' ! want = 'bool' class _Prop_zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' application._superclassnames = [] application._privpropdict = { ! 'alert_application' : _Prop_alert_application, ! 'kiosk_mode' : _Prop_kiosk_mode, } application._privelemdict = { ! 'window' : window, } window._superclassnames = [] window._privpropdict = { ! 'URL' : _Prop_URL, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'closeable' : _Prop_closeable, ! 'floating' : _Prop_floating, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'unique_ID' : _Prop_unique_ID, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { --- 14,206 ---- class Standard_Suite_Events(Standard_Suite_Events): ! def close(self, _object, _attributes={}, **_arguments): ! """close: Close an object ! Required argument: the objects to close ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'clos' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def data_size(self, _object, _attributes={}, **_arguments): ! """data size: Return the size in bytes of an object ! Required argument: the object whose data size is to be returned ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the size of the object in bytes ! """ ! _code = 'core' ! _subcode = 'dsiz' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def get(self, _object, _attributes={}, **_arguments): ! """get: Get the data for an object ! Required argument: the object whose data is to be returned ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The data from the object ! """ ! _code = 'core' ! _subcode = 'getd' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_set = { ! 'to' : 'data', ! } ! def set(self, _object, _attributes={}, **_arguments): ! """set: Set an object\xd5s data ! Required argument: the object to change ! Keyword argument to: the new value ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! aetools.keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - An application program """ ! want = 'capp' class _Prop_alert_application(aetools.NProperty): ! """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ ! which = 'ALAP' ! want = 'type' class _Prop_kiosk_mode(aetools.NProperty): ! """kiosk mode - Kiosk mode leaves very few menus enabled """ ! which = 'KOSK' ! want = 'long' # element 'cwin' as ['indx', 'name', 'ID '] class window(aetools.ComponentItem): ! """window - A Window """ ! want = 'cwin' class _Prop_URL(aetools.NProperty): ! """URL - Current URL """ ! which = 'curl' ! want = 'TEXT' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_busy(aetools.NProperty): ! """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ ! which = 'busy' ! want = 'long' class _Prop_closeable(aetools.NProperty): ! """closeable - Does the window have a close box? """ ! which = 'hclb' ! want = 'bool' class _Prop_floating(aetools.NProperty): ! """floating - Does the window float? """ ! which = 'isfl' ! want = 'bool' class _Prop_index(aetools.NProperty): ! """index - the number of the window """ ! which = 'pidx' ! want = 'long' class _Prop_modal(aetools.NProperty): ! """modal - Is the window modal? """ ! which = 'pmod' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the title of the window """ ! which = 'pnam' ! want = 'itxt' class _Prop_position(aetools.NProperty): ! """position - upper left coordinates of window """ ! which = 'ppos' ! want = 'QDpt' class _Prop_resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class _Prop_titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' ! want = 'bool' class _Prop_unique_ID(aetools.NProperty): ! """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ ! which = 'wiid' ! want = 'long' class _Prop_visible(aetools.NProperty): ! """visible - is the window visible? """ ! which = 'pvis' ! want = 'bool' class _Prop_zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' ! want = 'bool' class _Prop_zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' application._superclassnames = [] application._privpropdict = { ! 'alert_application' : _Prop_alert_application, ! 'kiosk_mode' : _Prop_kiosk_mode, } application._privelemdict = { ! 'window' : window, } window._superclassnames = [] window._privpropdict = { ! 'URL' : _Prop_URL, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'closeable' : _Prop_closeable, ! 'floating' : _Prop_floating, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'unique_ID' : _Prop_unique_ID, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 211,215 **** # _classdeclarations = { ! 'capp' : application, ! 'cwin' : window, } --- 211,241 ---- # _classdeclarations = { ! 'capp' : application, ! 'cwin' : window, ! } ! ! _propdeclarations = { ! 'ALAP' : _Prop_alert_application, ! 'KOSK' : _Prop_kiosk_mode, ! 'busy' : _Prop_busy, ! 'curl' : _Prop_URL, ! 'hclb' : _Prop_closeable, ! 'isfl' : _Prop_floating, ! 'iszm' : _Prop_zoomable, ! 'pbnd' : _Prop_bounds, ! 'pidx' : _Prop_index, ! 'pmod' : _Prop_modal, ! 'pnam' : _Prop_name, ! 'ppos' : _Prop_position, ! 'prsz' : _Prop_resizable, ! 'ptit' : _Prop_titled, ! 'pvis' : _Prop_visible, ! 'pzum' : _Prop_zoomed, ! 'wiid' : _Prop_unique_ID, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_URL_suite.py 1 Apr 2003 22:04:45 -0000 1.3 --- Standard_URL_suite.py 12 Apr 2003 22:27:09 -0000 1.4 *************** *** 13,44 **** class Standard_URL_suite_Events: ! _argmap_GetURL = { ! 'to' : 'dest', ! 'inside' : 'HWIN', ! 'from_' : 'refe', ! } ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Loads the URL (optionally to disk) ! Required argument: The url ! Keyword argument to: file the URL should be loaded into ! Keyword argument inside: Window the URL should be loaded to ! Keyword argument from_: Referrer, to be sent with the HTTP request ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'GURL' ! _subcode = 'GURL' ! aetools.keysubst(_arguments, self._argmap_GetURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,44 ---- class Standard_URL_suite_Events: ! _argmap_GetURL = { ! 'to' : 'dest', ! 'inside' : 'HWIN', ! 'from_' : 'refe', ! } ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Loads the URL (optionally to disk) ! Required argument: The url ! Keyword argument to: file the URL should be loaded into ! Keyword argument inside: Window the URL should be loaded to ! Keyword argument from_: Referrer, to be sent with the HTTP request ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'GURL' ! _subcode = 'GURL' ! aetools.keysubst(_arguments, self._argmap_GetURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 47,49 **** --- 47,58 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Text.py 1 Apr 2003 22:04:46 -0000 1.6 --- Text.py 12 Apr 2003 22:27:09 -0000 1.7 *************** *** 14,93 **** class Text_Events(Text_Suite_Events): ! pass class text(aetools.ComponentItem): ! """text - independent text view objects """ ! want = 'ctxt' class _Prop_beginning(aetools.NProperty): ! """beginning - Beginning of element """ ! which = 'bgng' ! want = 'obj ' class _Prop_end(aetools.NProperty): ! """end - Ending of element """ ! which = 'end ' ! want = 'obj ' class _Prop_infront(aetools.NProperty): ! """infront - Immediately before element """ ! which = 'pBef' ! want = 'obj ' class _Prop_justbehind(aetools.NProperty): ! """justbehind - Immediately after element """ ! which = 'pAft' ! want = 'obj ' class _Prop_updateLevel(aetools.NProperty): ! """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ ! which = 'pUpL' ! want = 'long' # element 'stys' as ['indx', 'name'] class styleset(aetools.ComponentItem): ! """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ ! want = 'stys' class _Prop_color(aetools.NProperty): ! """color - the color """ ! which = 'colr' ! want = 'RGB ' class _Prop_font(aetools.NProperty): ! """font - font name """ ! which = 'font' ! want = 'TEXT' class _Prop_name(aetools.NProperty): ! """name - style name """ ! which = 'pnam' ! want = 'TEXT' class _Prop_size(aetools.NProperty): ! """size - the size in points """ ! which = 'ptsz' ! want = 'long' class _Prop_style(aetools.NProperty): ! """style - the text styles or face attributes """ ! which = 'txst' ! want = 'tsty' class _Prop_writing_code(aetools.NProperty): ! """writing code - the script system and language """ ! which = 'psct' ! want = 'tsty' stylesets = styleset text._superclassnames = [] text._privpropdict = { ! 'beginning' : _Prop_beginning, ! 'end' : _Prop_end, ! 'infront' : _Prop_infront, ! 'justbehind' : _Prop_justbehind, ! 'updateLevel' : _Prop_updateLevel, } text._privelemdict = { ! 'styleset' : styleset, } styleset._superclassnames = [] styleset._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'name' : _Prop_name, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'writing_code' : _Prop_writing_code, } styleset._privelemdict = { --- 14,93 ---- class Text_Events(Text_Suite_Events): ! pass class text(aetools.ComponentItem): ! """text - independent text view objects """ ! want = 'ctxt' class _Prop_beginning(aetools.NProperty): ! """beginning - Beginning of element """ ! which = 'bgng' ! want = 'obj ' class _Prop_end(aetools.NProperty): ! """end - Ending of element """ ! which = 'end ' ! want = 'obj ' class _Prop_infront(aetools.NProperty): ! """infront - Immediately before element """ ! which = 'pBef' ! want = 'obj ' class _Prop_justbehind(aetools.NProperty): ! """justbehind - Immediately after element """ ! which = 'pAft' ! want = 'obj ' class _Prop_updateLevel(aetools.NProperty): ! """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ ! which = 'pUpL' ! want = 'long' # element 'stys' as ['indx', 'name'] class styleset(aetools.ComponentItem): ! """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ ! want = 'stys' class _Prop_color(aetools.NProperty): ! """color - the color """ ! which = 'colr' ! want = 'RGB ' class _Prop_font(aetools.NProperty): ! """font - font name """ ! which = 'font' ! want = 'TEXT' class _Prop_name(aetools.NProperty): ! """name - style name """ ! which = 'pnam' ! want = 'TEXT' class _Prop_size(aetools.NProperty): ! """size - the size in points """ ! which = 'ptsz' ! want = 'long' class _Prop_style(aetools.NProperty): ! """style - the text styles or face attributes """ ! which = 'txst' ! want = 'tsty' class _Prop_writing_code(aetools.NProperty): ! """writing code - the script system and language """ ! which = 'psct' ! want = 'tsty' stylesets = styleset text._superclassnames = [] text._privpropdict = { ! 'beginning' : _Prop_beginning, ! 'end' : _Prop_end, ! 'infront' : _Prop_infront, ! 'justbehind' : _Prop_justbehind, ! 'updateLevel' : _Prop_updateLevel, } text._privelemdict = { ! 'styleset' : styleset, } styleset._superclassnames = [] styleset._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'name' : _Prop_name, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'writing_code' : _Prop_writing_code, } styleset._privelemdict = { *************** *** 98,102 **** # _classdeclarations = { ! 'ctxt' : text, ! 'stys' : styleset, } --- 98,122 ---- # _classdeclarations = { ! 'ctxt' : text, ! 'stys' : styleset, ! } ! ! _propdeclarations = { ! 'bgng' : _Prop_beginning, ! 'colr' : _Prop_color, ! 'end ' : _Prop_end, ! 'font' : _Prop_font, ! 'pAft' : _Prop_justbehind, ! 'pBef' : _Prop_infront, ! 'pUpL' : _Prop_updateLevel, ! 'pnam' : _Prop_name, ! 'psct' : _Prop_writing_code, ! 'ptsz' : _Prop_size, ! 'txst' : _Prop_style, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WorldWideWeb_suite.py 1 Apr 2003 22:04:47 -0000 1.4 --- WorldWideWeb_suite.py 12 Apr 2003 22:27:09 -0000 1.5 *************** *** 13,412 **** class WorldWideWeb_suite_Events: ! _argmap_OpenURL = { ! 'to' : 'INTO', ! 'toWindow' : 'WIND', ! 'flags' : 'FLGS', ! 'post_data' : 'POST', ! 'post_type' : 'MIME', ! 'progressApp' : 'PROG', ! } ! def OpenURL(self, _object, _attributes={}, **_arguments): ! """OpenURL: Opens a URL. Allows for more options than GetURL event ! Required argument: URL ! Keyword argument to: file destination ! Keyword argument toWindow: window iD ! Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored ! Keyword argument post_data: Form posting data ! Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded ! Keyword argument progressApp: Application that will display progress ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: ID of the loading window ! """ ! _code = 'WWW!' ! _subcode = 'OURL' ! aetools.keysubst(_arguments, self._argmap_OpenURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_ShowFile = { ! 'MIME_type' : 'MIME', ! 'Window_ID' : 'WIND', ! 'URL' : 'URL ', ! } ! def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file ! Required argument: File to open ! Keyword argument MIME_type: MIME type ! Keyword argument Window_ID: Window to open the file in ! Keyword argument URL: Use this as a base URL ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser. ! """ ! _code = 'WWW!' ! _subcode = 'SHWF' ! aetools.keysubst(_arguments, self._argmap_ShowFile) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_cancel_progress = { ! 'in_window' : 'WIND', ! } ! def cancel_progress(self, _object=None, _attributes={}, **_arguments): ! """cancel progress: Interrupts the download of the document in the given window ! Required argument: progress ID, obtained from the progress app ! Keyword argument in_window: window ID of the progress to cancel ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'CNCL' ! aetools.keysubst(_arguments, self._argmap_cancel_progress) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def find_URL(self, _object, _attributes={}, **_arguments): ! """find URL: If the file was downloaded by Netscape, you can call FindURL to find out the URL used to download the file. ! Required argument: File spec ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The URL ! """ ! _code = 'WWW!' ! _subcode = 'FURL' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def get_window_info(self, _object=None, _attributes={}, **_arguments): ! """get window info: Returns the information about the window as a list. Currently the list contains the window title and the URL. You can get the same information using standard Apple Event GetProperty. ! Required argument: window ID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'list' ! """ ! _code = 'WWW!' ! _subcode = 'WNFO' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def list_windows(self, _no_object=None, _attributes={}, **_arguments): ! """list windows: Lists the IDs of all the hypertext windows ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: List of unique IDs of all the hypertext windows ! """ ! _code = 'WWW!' ! _subcode = 'LSTW' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_parse_anchor = { ! 'relative_to' : 'RELA', ! } ! def parse_anchor(self, _object, _attributes={}, **_arguments): ! """parse anchor: Resolves the relative URL ! Required argument: Main URL ! Keyword argument relative_to: Relative URL ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Parsed URL ! """ ! _code = 'WWW!' ! _subcode = 'PRSA' ! aetools.keysubst(_arguments, self._argmap_parse_anchor) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the \xd2echo\xd3 application. Each download from now on will be echoed to this application. ! Required argument: Application signature ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGUE' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_register_protocol = { ! 'for_protocol' : 'PROT', ! } ! def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event. ! Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3, ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if registration has been successful ! """ ! _code = 'WWW!' ! _subcode = 'RGPR' ! aetools.keysubst(_arguments, self._argmap_register_protocol) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_register_viewer = { ! 'MIME_type' : 'MIME', ! 'with_file_type' : 'FTYP', ! } ! def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a \xd4special\xd5 viewer for this MIME type. The application will be launched with ViewDoc events ! Required argument: Application sig ! Keyword argument MIME_type: MIME type viewer is registering for ! Keyword argument with_file_type: Mac file type for the downloaded files ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if registration has been successful ! """ ! _code = 'WWW!' ! _subcode = 'RGVW' ! aetools.keysubst(_arguments, self._argmap_register_viewer) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_register_window_close = { ! 'for_window' : 'WIND', ! } ! def register_window_close(self, _object=None, _attributes={}, **_arguments): ! """register window close: Netscape will notify registered application when this window closes ! Required argument: Application signature ! Keyword argument for_window: window ID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if successful ! """ ! _code = 'WWW!' ! _subcode = 'RGWC' ! aetools.keysubst(_arguments, self._argmap_register_window_close) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def unregister_URL_echo(self, _object, _attributes={}, **_arguments): ! """unregister URL echo: cancels URL echo ! Required argument: application signature ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRU' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_unregister_protocol = { ! 'for_protocol' : 'PROT', ! } ! def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of \xd2register protocol\xd3 ! Required argument: Application sig. ! Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if successful ! """ ! _code = 'WWW!' ! _subcode = 'UNRP' ! aetools.keysubst(_arguments, self._argmap_unregister_protocol) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_unregister_viewer = { ! 'MIME_type' : 'MIME', ! } ! def unregister_viewer(self, _object, _attributes={}, **_arguments): ! """unregister viewer: Revert to the old way of handling this MIME type ! Required argument: Application sig ! Keyword argument MIME_type: MIME type to be unregistered ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if the event was successful ! """ ! _code = 'WWW!' ! _subcode = 'UNRV' ! aetools.keysubst(_arguments, self._argmap_unregister_viewer) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_unregister_window_close = { ! 'for_window' : 'WIND', ! } ! def unregister_window_close(self, _object=None, _attributes={}, **_arguments): ! """unregister window close: Undo for register window close ! Required argument: Application signature ! Keyword argument for_window: window ID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if successful ! """ ! _code = 'WWW!' ! _subcode = 'UNRC' ! aetools.keysubst(_arguments, self._argmap_unregister_window_close) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def webActivate(self, _object=None, _attributes={}, **_arguments): ! """webActivate: Makes Netscape the frontmost application, and selects a given window. This event is here for suite completeness/ cross-platform compatibility only, you should use standard AppleEvents instead. ! Required argument: window to bring to front ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'ACTV' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,412 ---- class WorldWideWeb_suite_Events: ! _argmap_OpenURL = { ! 'to' : 'INTO', ! 'toWindow' : 'WIND', ! 'flags' : 'FLGS', ! 'post_data' : 'POST', ! 'post_type' : 'MIME', ! 'progressApp' : 'PROG', ! } ! def OpenURL(self, _object, _attributes={}, **_arguments): ! """OpenURL: Opens a URL. Allows for more options than GetURL event ! Required argument: URL ! Keyword argument to: file destination ! Keyword argument toWindow: window iD ! Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored ! Keyword argument post_data: Form posting data ! Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded ! Keyword argument progressApp: Application that will display progress ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: ID of the loading window ! """ ! _code = 'WWW!' ! _subcode = 'OURL' ! aetools.keysubst(_arguments, self._argmap_OpenURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_ShowFile = { ! 'MIME_type' : 'MIME', ! 'Window_ID' : 'WIND', ! 'URL' : 'URL ', ! } ! def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file ! Required argument: File to open ! Keyword argument MIME_type: MIME type ! Keyword argument Window_ID: Window to open the file in ! Keyword argument URL: Use this as a base URL ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser. ! """ ! _code = 'WWW!' ! _subcode = 'SHWF' ! aetools.keysubst(_arguments, self._argmap_ShowFile) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_cancel_progress = { ! 'in_window' : 'WIND', ! } ! def cancel_progress(self, _object=None, _attributes={}, **_arguments): ! """cancel progress: Interrupts the download of the document in the given window ! Required argument: progress ID, obtained from the progress app ! Keyword argument in_window: window ID of the progress to cancel ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'CNCL' ! aetools.keysubst(_arguments, self._argmap_cancel_progress) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def find_URL(self, _object, _attributes={}, **_arguments): ! """find URL: If the file was downloaded by Netscape, you can call FindURL to find out the URL used to download the file. ! Required argument: File spec ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The URL ! """ ! _code = 'WWW!' ! _subcode = 'FURL' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def get_window_info(self, _object=None, _attributes={}, **_arguments): ! """get window info: Returns the information about the window as a list. Currently the list contains the window title and the URL. You can get the same information using standard Apple Event GetProperty. ! Required argument: window ID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'list' ! """ ! _code = 'WWW!' ! _subcode = 'WNFO' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def list_windows(self, _no_object=None, _attributes={}, **_arguments): ! """list windows: Lists the IDs of all the hypertext windows ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: List of unique IDs of all the hypertext windows ! """ ! _code = 'WWW!' ! _subcode = 'LSTW' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_parse_anchor = { ! 'relative_to' : 'RELA', ! } ! def parse_anchor(self, _object, _attributes={}, **_arguments): ! """parse anchor: Resolves the relative URL ! Required argument: Main URL ! Keyword argument relative_to: Relative URL ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Parsed URL ! """ ! _code = 'WWW!' ! _subcode = 'PRSA' ! aetools.keysubst(_arguments, self._argmap_parse_anchor) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the \xd2echo\xd3 application. Each download from now on will be echoed to this application. ! Required argument: Application signature ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGUE' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_register_protocol = { ! 'for_protocol' : 'PROT', ! } ! def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event. ! Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3, ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if registration has been successful ! """ ! _code = 'WWW!' ! _subcode = 'RGPR' ! aetools.keysubst(_arguments, self._argmap_register_protocol) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_register_viewer = { ! 'MIME_type' : 'MIME', ! 'with_file_type' : 'FTYP', ! } ! def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a \xd4special\xd5 viewer for this MIME type. The application will be launched with ViewDoc events ! Required argument: Application sig ! Keyword argument MIME_type: MIME type viewer is registering for ! Keyword argument with_file_type: Mac file type for the downloaded files ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if registration has been successful ! """ ! _code = 'WWW!' ! _subcode = 'RGVW' ! aetools.keysubst(_arguments, self._argmap_register_viewer) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_register_window_close = { ! 'for_window' : 'WIND', ! } ! def register_window_close(self, _object=None, _attributes={}, **_arguments): ! """register window close: Netscape will notify registered application when this window closes ! Required argument: Application signature ! Keyword argument for_window: window ID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if successful ! """ ! _code = 'WWW!' ! _subcode = 'RGWC' ! aetools.keysubst(_arguments, self._argmap_register_window_close) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def unregister_URL_echo(self, _object, _attributes={}, **_arguments): ! """unregister URL echo: cancels URL echo ! Required argument: application signature ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRU' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_unregister_protocol = { ! 'for_protocol' : 'PROT', ! } ! def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of \xd2register protocol\xd3 ! Required argument: Application sig. ! Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if successful ! """ ! _code = 'WWW!' ! _subcode = 'UNRP' ! aetools.keysubst(_arguments, self._argmap_unregister_protocol) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_unregister_viewer = { ! 'MIME_type' : 'MIME', ! } ! def unregister_viewer(self, _object, _attributes={}, **_arguments): ! """unregister viewer: Revert to the old way of handling this MIME type ! Required argument: Application sig ! Keyword argument MIME_type: MIME type to be unregistered ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if the event was successful ! """ ! _code = 'WWW!' ! _subcode = 'UNRV' ! aetools.keysubst(_arguments, self._argmap_unregister_viewer) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_unregister_window_close = { ! 'for_window' : 'WIND', ! } ! def unregister_window_close(self, _object=None, _attributes={}, **_arguments): ! """unregister window close: Undo for register window close ! Required argument: Application signature ! Keyword argument for_window: window ID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if successful ! """ ! _code = 'WWW!' ! _subcode = 'UNRC' ! aetools.keysubst(_arguments, self._argmap_unregister_window_close) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def webActivate(self, _object=None, _attributes={}, **_arguments): ! """webActivate: Makes Netscape the frontmost application, and selects a given window. This event is here for suite completeness/ cross-platform compatibility only, you should use standard AppleEvents instead. ! Required argument: window to bring to front ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'ACTV' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 415,417 **** --- 415,426 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 1 Apr 2003 22:04:48 -0000 1.6 --- __init__.py 12 Apr 2003 22:27:09 -0000 1.7 *************** *** 14,24 **** _code_to_module = { ! 'CoRe' : Standard_Suite, ! 'GURL' : Standard_URL_suite, ! 'MOSS' : Mozilla_suite, ! 'TEXT' : Text, ! 'WWW!' : WorldWideWeb_suite, ! 'ppnt' : PowerPlant, ! 'reqd' : Required_suite, } --- 14,24 ---- _code_to_module = { ! 'CoRe' : Standard_Suite, ! 'GURL' : Standard_URL_suite, ! 'MOSS' : Mozilla_suite, ! 'TEXT' : Text, ! 'WWW!' : WorldWideWeb_suite, ! 'ppnt' : PowerPlant, ! 'reqd' : Required_suite, } *************** *** 26,36 **** _code_to_fullname = { ! 'CoRe' : ('Netscape.Standard_Suite', 'Standard_Suite'), ! 'GURL' : ('Netscape.Standard_URL_suite', 'Standard_URL_suite'), ! 'MOSS' : ('Netscape.Mozilla_suite', 'Mozilla_suite'), ! 'TEXT' : ('Netscape.Text', 'Text'), ! 'WWW!' : ('Netscape.WorldWideWeb_suite', 'WorldWideWeb_suite'), ! 'ppnt' : ('Netscape.PowerPlant', 'PowerPlant'), ! 'reqd' : ('Netscape.Required_suite', 'Required_suite'), } --- 26,36 ---- _code_to_fullname = { ! 'CoRe' : ('Netscape.Standard_Suite', 'Standard_Suite'), ! 'GURL' : ('Netscape.Standard_URL_suite', 'Standard_URL_suite'), ! 'MOSS' : ('Netscape.Mozilla_suite', 'Mozilla_suite'), ! 'TEXT' : ('Netscape.Text', 'Text'), ! 'WWW!' : ('Netscape.WorldWideWeb_suite', 'WorldWideWeb_suite'), ! 'ppnt' : ('Netscape.PowerPlant', 'PowerPlant'), ! 'reqd' : ('Netscape.Required_suite', 'Required_suite'), } *************** *** 44,57 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 44,57 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 62,65 **** --- 62,67 ---- getbaseclasses(window) getbaseclasses(application) + getbaseclasses(text) + getbaseclasses(styleset) getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.character) *************** *** 69,74 **** getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.text) - getbaseclasses(text) - getbaseclasses(styleset) # --- 71,74 ---- *************** *** 76,103 **** # _classdeclarations = { ! 'cwin' : window, ! 'capp' : application, ! 'cflo' : StdSuites.Text_Suite.text_flow, ! 'cha ' : StdSuites.Text_Suite.character, ! 'tsty' : StdSuites.Text_Suite.text_style_info, ! 'clin' : StdSuites.Text_Suite.line, ! 'cwor' : StdSuites.Text_Suite.word, ! 'cpar' : StdSuites.Text_Suite.paragraph, ! 'ctxt' : StdSuites.Text_Suite.text, ! 'ctxt' : text, ! 'stys' : styleset, } class Netscape(Standard_Suite_Events, ! Standard_URL_suite_Events, ! Mozilla_suite_Events, ! Text_Events, ! WorldWideWeb_suite_Events, ! PowerPlant_Events, ! Required_suite_Events, ! aetools.TalkTo): ! _signature = 'MOSS' ! _moduleName = 'Netscape' --- 76,103 ---- # _classdeclarations = { ! 'cwin' : window, ! 'capp' : application, ! 'ctxt' : text, ! 'stys' : styleset, ! 'cflo' : StdSuites.Text_Suite.text_flow, ! 'cha ' : StdSuites.Text_Suite.character, ! 'tsty' : StdSuites.Text_Suite.text_style_info, ! 'clin' : StdSuites.Text_Suite.line, ! 'cwor' : StdSuites.Text_Suite.word, ! 'cpar' : StdSuites.Text_Suite.paragraph, ! 'ctxt' : StdSuites.Text_Suite.text, } class Netscape(Standard_Suite_Events, ! Standard_URL_suite_Events, ! Mozilla_suite_Events, ! Text_Events, ! WorldWideWeb_suite_Events, ! PowerPlant_Events, ! Required_suite_Events, ! aetools.TalkTo): ! _signature = 'MOSS' ! _moduleName = 'Netscape' From jackjansen@users.sourceforge.net Sat Apr 12 23:27:13 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.6,1.7 Macintosh_Connectivity_Clas.py,1.6,1.7 QuickDraw_Graphics_Suite.py,1.6,1.7 QuickDraw_Graphics_Suppleme.py,1.5,1.6 Required_Suite.py,1.3,1.4 Standard_Suite.py,1.6,1.7 Table_Suite.py,1.5,1.6 Text_Suite.py,1.5,1.6 Type_Names_Suite.py,1.6,1.7 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Required_Suite.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AppleScript_Suite.py 1 Apr 2003 22:04:49 -0000 1.6 --- AppleScript_Suite.py 12 Apr 2003 22:27:09 -0000 1.7 *************** *** 13,847 **** class AppleScript_Suite_Events: ! def _26_(self, _object, _attributes={}, **_arguments): ! """&: Concatenation ! Required argument: an AE object reference ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: anything ! """ ! _code = 'ascr' ! _subcode = 'ccat' [...3302 lines suppressed...] ! 'spac' : _Prop_space, ! 'tab ' : _Prop_tab, ! 'time' : _Prop_time, ! 'tstr' : _Prop_time_string, ! 'txdl' : _Prop_text_item_delimiters, ! 'week' : _Prop_weeks, ! 'wkdy' : _Prop_weekday, ! 'year' : _Prop_year, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'boov' : _Enum_boov, ! 'cons' : _Enum_cons, ! 'eMds' : _Enum_eMds, ! 'ekst' : _Enum_ekst, ! 'misc' : _Enum_misc, } Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Macintosh_Connectivity_Clas.py 1 Apr 2003 22:04:52 -0000 1.6 --- Macintosh_Connectivity_Clas.py 12 Apr 2003 22:27:10 -0000 1.7 *************** *** 13,166 **** class Macintosh_Connectivity_Clas_Events: ! pass class ADB_address(aetools.ComponentItem): ! """ADB address - Addresses a device connected via Apple Desktop Bus """ ! want = 'cadb' class _Prop__3c_inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from this class """ ! which = 'c@#^' ! want = 'cadr' class _Prop_ID(aetools.NProperty): ! """ID - the Apple Desktop Bus device ID """ ! which = 'ID ' ! want = 'shor' ADB_addresses = ADB_address class address_specification(aetools.ComponentItem): ! """address specification - Unique designation of a device or service connected to this computer """ ! want = 'cadr' class _Prop_conduit(aetools.NProperty): ! """conduit - How the addressee is physically connected """ ! which = 'pcon' ! want = 'econ' class _Prop_properties(aetools.NProperty): ! """properties - property that allows getting and setting of multiple properties """ ! which = 'pALL' ! want = 'reco' class _Prop_protocol(aetools.NProperty): ! """protocol - How to talk to this addressee """ ! which = 'pprt' ! want = 'epro' address_specifications = address_specification class AppleTalk_address(aetools.ComponentItem): ! """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ ! want = 'cat ' class _Prop_AppleTalk_machine(aetools.NProperty): ! """AppleTalk machine - the machine name part of the address """ ! which = 'patm' ! want = 'TEXT' class _Prop_AppleTalk_type(aetools.NProperty): ! """AppleTalk type - the type part of the AppleTalk address """ ! which = 'patt' ! want = 'TEXT' class _Prop_AppleTalk_zone(aetools.NProperty): ! """AppleTalk zone - the zone part of the address """ ! which = 'patz' ! want = 'TEXT' AppleTalk_addresses = AppleTalk_address class bus_slot(aetools.ComponentItem): ! """bus slot - Addresses a PC, PCI, or NuBus card """ ! want = 'cbus' bus_slots = bus_slot class device_specification(aetools.ComponentItem): ! """device specification - A device connected to a computer """ ! want = 'cdev' class _Prop_device_address(aetools.NProperty): ! """device address - the address of the device """ ! which = 'pdva' ! want = 'cadr' class _Prop_device_type(aetools.NProperty): ! """device type - the kind of device """ ! which = 'pdvt' ! want = 'edvt' device_specifications = device_specification class Ethernet_address(aetools.ComponentItem): ! """Ethernet address - Addresses a device by its Ethernet address """ ! want = 'cen ' Ethernet_addresses = Ethernet_address class FireWire_address(aetools.ComponentItem): ! """FireWire address - Addresses a device on the FireWire bus """ ! want = 'cfw ' FireWire_addresses = FireWire_address class IP_address(aetools.ComponentItem): ! """IP address - Addresses a device or service via the Internet Protocol (IP) """ ! want = 'cip ' class _Prop_DNS_form(aetools.NProperty): ! """DNS form - the address in the form "apple.com" """ ! which = 'pdns' ! want = 'TEXT' class _Prop_port(aetools.NProperty): ! """port - the port number of the service or client being addressed """ ! which = 'ppor' ! want = 'TEXT' IP_addresses = IP_address class LocalTalk_address(aetools.ComponentItem): ! """LocalTalk address - Addresses a device by its LocalTalk address """ ! want = 'clt ' class _Prop_network(aetools.NProperty): ! """network - the LocalTalk network number """ ! which = 'pnet' ! want = 'shor' class _Prop_node(aetools.NProperty): ! """node - the LocalTalk node number """ ! which = 'pnod' ! want = 'shor' class _Prop_socket(aetools.NProperty): ! """socket - the LocalTalk socket number """ ! which = 'psoc' ! want = 'shor' LocalTalk_addresses = LocalTalk_address class SCSI_address(aetools.ComponentItem): ! """SCSI address - Addresses a SCSI device """ ! want = 'cscs' class _Prop_LUN(aetools.NProperty): ! """LUN - the SCSI logical unit number """ ! which = 'pslu' ! want = 'shor' class _Prop_SCSI_bus(aetools.NProperty): ! """SCSI bus - the SCSI bus number """ ! which = 'pscb' ! want = 'shor' SCSI_addresses = SCSI_address class Token_Ring_address(aetools.ComponentItem): ! """Token Ring address - Addresses a device or service via the Token Ring protocol """ ! want = 'ctok' Token_Ring_addresses = Token_Ring_address class USB_address(aetools.ComponentItem): ! """USB address - Addresses a device on the Universal Serial Bus """ ! want = 'cusb' class _Prop_name(aetools.NProperty): ! """name - the USB device name """ ! which = 'pnam' ! want = 'TEXT' USB_Addresses = USB_address ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } ADB_address._privelemdict = { --- 13,166 ---- class Macintosh_Connectivity_Clas_Events: ! pass class ADB_address(aetools.ComponentItem): ! """ADB address - Addresses a device connected via Apple Desktop Bus """ ! want = 'cadb' class _Prop__3c_inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from this class """ ! which = 'c@#^' ! want = 'cadr' class _Prop_ID(aetools.NProperty): ! """ID - the Apple Desktop Bus device ID """ ! which = 'ID ' ! want = 'shor' ADB_addresses = ADB_address class address_specification(aetools.ComponentItem): ! """address specification - Unique designation of a device or service connected to this computer """ ! want = 'cadr' class _Prop_conduit(aetools.NProperty): ! """conduit - How the addressee is physically connected """ ! which = 'pcon' ! want = 'econ' class _Prop_properties(aetools.NProperty): ! """properties - property that allows getting and setting of multiple properties """ ! which = 'pALL' ! want = 'reco' class _Prop_protocol(aetools.NProperty): ! """protocol - How to talk to this addressee """ ! which = 'pprt' ! want = 'epro' address_specifications = address_specification class AppleTalk_address(aetools.ComponentItem): ! """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ ! want = 'cat ' class _Prop_AppleTalk_machine(aetools.NProperty): ! """AppleTalk machine - the machine name part of the address """ ! which = 'patm' ! want = 'TEXT' class _Prop_AppleTalk_type(aetools.NProperty): ! """AppleTalk type - the type part of the AppleTalk address """ ! which = 'patt' ! want = 'TEXT' class _Prop_AppleTalk_zone(aetools.NProperty): ! """AppleTalk zone - the zone part of the address """ ! which = 'patz' ! want = 'TEXT' AppleTalk_addresses = AppleTalk_address class bus_slot(aetools.ComponentItem): ! """bus slot - Addresses a PC, PCI, or NuBus card """ ! want = 'cbus' bus_slots = bus_slot class device_specification(aetools.ComponentItem): ! """device specification - A device connected to a computer """ ! want = 'cdev' class _Prop_device_address(aetools.NProperty): ! """device address - the address of the device """ ! which = 'pdva' ! want = 'cadr' class _Prop_device_type(aetools.NProperty): ! """device type - the kind of device """ ! which = 'pdvt' ! want = 'edvt' device_specifications = device_specification class Ethernet_address(aetools.ComponentItem): ! """Ethernet address - Addresses a device by its Ethernet address """ ! want = 'cen ' Ethernet_addresses = Ethernet_address class FireWire_address(aetools.ComponentItem): ! """FireWire address - Addresses a device on the FireWire bus """ ! want = 'cfw ' FireWire_addresses = FireWire_address class IP_address(aetools.ComponentItem): ! """IP address - Addresses a device or service via the Internet Protocol (IP) """ ! want = 'cip ' class _Prop_DNS_form(aetools.NProperty): ! """DNS form - the address in the form "apple.com" """ ! which = 'pdns' ! want = 'TEXT' class _Prop_port(aetools.NProperty): ! """port - the port number of the service or client being addressed """ ! which = 'ppor' ! want = 'TEXT' IP_addresses = IP_address class LocalTalk_address(aetools.ComponentItem): ! """LocalTalk address - Addresses a device by its LocalTalk address """ ! want = 'clt ' class _Prop_network(aetools.NProperty): ! """network - the LocalTalk network number """ ! which = 'pnet' ! want = 'shor' class _Prop_node(aetools.NProperty): ! """node - the LocalTalk node number """ ! which = 'pnod' ! want = 'shor' class _Prop_socket(aetools.NProperty): ! """socket - the LocalTalk socket number """ ! which = 'psoc' ! want = 'shor' LocalTalk_addresses = LocalTalk_address class SCSI_address(aetools.ComponentItem): ! """SCSI address - Addresses a SCSI device """ ! want = 'cscs' class _Prop_LUN(aetools.NProperty): ! """LUN - the SCSI logical unit number """ ! which = 'pslu' ! want = 'shor' class _Prop_SCSI_bus(aetools.NProperty): ! """SCSI bus - the SCSI bus number """ ! which = 'pscb' ! want = 'shor' SCSI_addresses = SCSI_address class Token_Ring_address(aetools.ComponentItem): ! """Token Ring address - Addresses a device or service via the Token Ring protocol """ ! want = 'ctok' Token_Ring_addresses = Token_Ring_address class USB_address(aetools.ComponentItem): ! """USB address - Addresses a device on the Universal Serial Bus """ ! want = 'cusb' class _Prop_name(aetools.NProperty): ! """name - the USB device name """ ! which = 'pnam' ! want = 'TEXT' USB_Addresses = USB_address ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } ADB_address._privelemdict = { *************** *** 168,174 **** address_specification._superclassnames = [] address_specification._privpropdict = { ! 'conduit' : _Prop_conduit, ! 'properties' : _Prop_properties, ! 'protocol' : _Prop_protocol, } address_specification._privelemdict = { --- 168,174 ---- address_specification._superclassnames = [] address_specification._privpropdict = { ! 'conduit' : _Prop_conduit, ! 'properties' : _Prop_properties, ! 'protocol' : _Prop_protocol, } address_specification._privelemdict = { *************** *** 176,183 **** AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { ! 'AppleTalk_machine' : _Prop_AppleTalk_machine, ! 'AppleTalk_type' : _Prop_AppleTalk_type, ! 'AppleTalk_zone' : _Prop_AppleTalk_zone, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } AppleTalk_address._privelemdict = { --- 176,183 ---- AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { ! 'AppleTalk_machine' : _Prop_AppleTalk_machine, ! 'AppleTalk_type' : _Prop_AppleTalk_type, ! 'AppleTalk_zone' : _Prop_AppleTalk_zone, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } AppleTalk_address._privelemdict = { *************** *** 185,190 **** bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } bus_slot._privelemdict = { --- 185,190 ---- bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } bus_slot._privelemdict = { *************** *** 192,198 **** device_specification._superclassnames = [] device_specification._privpropdict = { ! 'device_address' : _Prop_device_address, ! 'device_type' : _Prop_device_type, ! 'properties' : _Prop_properties, } device_specification._privelemdict = { --- 192,198 ---- device_specification._superclassnames = [] device_specification._privpropdict = { ! 'device_address' : _Prop_device_address, ! 'device_type' : _Prop_device_type, ! 'properties' : _Prop_properties, } device_specification._privelemdict = { *************** *** 200,205 **** Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Ethernet_address._privelemdict = { --- 200,205 ---- Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Ethernet_address._privelemdict = { *************** *** 207,212 **** FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } FireWire_address._privelemdict = { --- 207,212 ---- FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } FireWire_address._privelemdict = { *************** *** 214,221 **** IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { ! 'DNS_form' : _Prop_DNS_form, ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'port' : _Prop_port, } IP_address._privelemdict = { --- 214,221 ---- IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { ! 'DNS_form' : _Prop_DNS_form, ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'port' : _Prop_port, } IP_address._privelemdict = { *************** *** 223,230 **** LocalTalk_address._superclassnames = ['address_specification'] LocalTalk_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'network' : _Prop_network, ! 'node' : _Prop_node, ! 'socket' : _Prop_socket, } LocalTalk_address._privelemdict = { --- 223,230 ---- LocalTalk_address._superclassnames = ['address_specification'] LocalTalk_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'network' : _Prop_network, ! 'node' : _Prop_node, ! 'socket' : _Prop_socket, } LocalTalk_address._privelemdict = { *************** *** 232,239 **** SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { ! 'ID' : _Prop_ID, ! 'LUN' : _Prop_LUN, ! 'SCSI_bus' : _Prop_SCSI_bus, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } SCSI_address._privelemdict = { --- 232,239 ---- SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { ! 'ID' : _Prop_ID, ! 'LUN' : _Prop_LUN, ! 'SCSI_bus' : _Prop_SCSI_bus, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } SCSI_address._privelemdict = { *************** *** 241,246 **** Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Token_Ring_address._privelemdict = { --- 241,246 ---- Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Token_Ring_address._privelemdict = { *************** *** 248,325 **** USB_address._superclassnames = ['address_specification'] USB_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } USB_address._privelemdict = { } _Enum_econ = { ! 'ADB' : 'eadb', # ! 'printer_port' : 'ecpp', # ! 'modem_port' : 'ecmp', # ! 'modem_printer_port' : 'empp', # ! 'LocalTalk' : 'eclt', # ! 'Ethernet' : 'ecen', # ! 'Token_Ring' : 'etok', # ! 'SCSI' : 'ecsc', # ! 'USB' : 'ecus', # ! 'FireWire' : 'ecfw', # ! 'infrared' : 'ecir', # ! 'PC_card' : 'ecpc', # ! 'PCI_bus' : 'ecpi', # ! 'NuBus' : 'enub', # ! 'PDS_slot' : 'ecpd', # ! 'Comm_slot' : 'eccm', # ! 'monitor_out' : 'ecmn', # ! 'video_out' : 'ecvo', # ! 'video_in' : 'ecvi', # ! 'audio_out' : 'ecao', # ! 'audio_line_in' : 'ecai', # ! 'audio_line_out' : 'ecal', # ! 'microphone' : 'ecmi', # } _Enum_edvt = { ! 'hard_disk_drive' : 'ehd ', # ! 'floppy_disk_drive' : 'efd ', # ! 'CD_ROM_drive' : 'ecd ', # ! 'DVD_drive' : 'edvd', # ! 'storage_device' : 'edst', # ! 'keyboard' : 'ekbd', # ! 'mouse' : 'emou', # ! 'trackball' : 'etrk', # ! 'trackpad' : 'edtp', # ! 'pointing_device' : 'edpd', # ! 'video_monitor' : 'edvm', # ! 'LCD_display' : 'edlc', # ! 'display' : 'edds', # ! 'modem' : 'edmm', # ! 'PC_card' : 'ecpc', # ! 'PCI_card' : 'edpi', # ! 'NuBus_card' : 'ednb', # ! 'printer' : 'edpr', # ! 'speakers' : 'edsp', # ! 'microphone' : 'ecmi', # } _Enum_epro = { ! 'serial' : 'epsr', # ! 'AppleTalk' : 'epat', # ! 'IP' : 'epip', # ! 'SCSI' : 'ecsc', # ! 'ADB' : 'eadb', # ! 'FireWire' : 'ecfw', # ! 'IrDA' : 'epir', # ! 'IRTalk' : 'epit', # ! 'USB' : 'ecus', # ! 'PC_card' : 'ecpc', # ! 'PCI_bus' : 'ecpi', # ! 'NuBus' : 'enub', # ! 'bus' : 'ebus', # ! 'Macintosh_video' : 'epmv', # ! 'SVGA' : 'epsg', # ! 'S_video' : 'epsv', # ! 'analog_audio' : 'epau', # ! 'digital_audio' : 'epda', # ! 'PostScript' : 'epps', # } --- 248,325 ---- USB_address._superclassnames = ['address_specification'] USB_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } USB_address._privelemdict = { } _Enum_econ = { ! 'ADB' : 'eadb', # ! 'printer_port' : 'ecpp', # ! 'modem_port' : 'ecmp', # ! 'modem_printer_port' : 'empp', # ! 'LocalTalk' : 'eclt', # ! 'Ethernet' : 'ecen', # ! 'Token_Ring' : 'etok', # ! 'SCSI' : 'ecsc', # ! 'USB' : 'ecus', # ! 'FireWire' : 'ecfw', # ! 'infrared' : 'ecir', # ! 'PC_card' : 'ecpc', # ! 'PCI_bus' : 'ecpi', # ! 'NuBus' : 'enub', # ! 'PDS_slot' : 'ecpd', # ! 'Comm_slot' : 'eccm', # ! 'monitor_out' : 'ecmn', # ! 'video_out' : 'ecvo', # ! 'video_in' : 'ecvi', # ! 'audio_out' : 'ecao', # ! 'audio_line_in' : 'ecai', # ! 'audio_line_out' : 'ecal', # ! 'microphone' : 'ecmi', # } _Enum_edvt = { ! 'hard_disk_drive' : 'ehd ', # ! 'floppy_disk_drive' : 'efd ', # ! 'CD_ROM_drive' : 'ecd ', # ! 'DVD_drive' : 'edvd', # ! 'storage_device' : 'edst', # ! 'keyboard' : 'ekbd', # ! 'mouse' : 'emou', # ! 'trackball' : 'etrk', # ! 'trackpad' : 'edtp', # ! 'pointing_device' : 'edpd', # ! 'video_monitor' : 'edvm', # ! 'LCD_display' : 'edlc', # ! 'display' : 'edds', # ! 'modem' : 'edmm', # ! 'PC_card' : 'ecpc', # ! 'PCI_card' : 'edpi', # ! 'NuBus_card' : 'ednb', # ! 'printer' : 'edpr', # ! 'speakers' : 'edsp', # ! 'microphone' : 'ecmi', # } _Enum_epro = { ! 'serial' : 'epsr', # ! 'AppleTalk' : 'epat', # ! 'IP' : 'epip', # ! 'SCSI' : 'ecsc', # ! 'ADB' : 'eadb', # ! 'FireWire' : 'ecfw', # ! 'IrDA' : 'epir', # ! 'IRTalk' : 'epit', # ! 'USB' : 'ecus', # ! 'PC_card' : 'ecpc', # ! 'PCI_bus' : 'ecpi', # ! 'NuBus' : 'enub', # ! 'bus' : 'ebus', # ! 'Macintosh_video' : 'epmv', # ! 'SVGA' : 'epsg', # ! 'S_video' : 'epsv', # ! 'analog_audio' : 'epau', # ! 'digital_audio' : 'epda', # ! 'PostScript' : 'epps', # } *************** *** 329,343 **** # _classdeclarations = { ! 'cadb' : ADB_address, ! 'cadr' : address_specification, ! 'cat ' : AppleTalk_address, ! 'cbus' : bus_slot, ! 'cdev' : device_specification, ! 'cen ' : Ethernet_address, ! 'cfw ' : FireWire_address, ! 'cip ' : IP_address, ! 'clt ' : LocalTalk_address, ! 'cscs' : SCSI_address, ! 'ctok' : Token_Ring_address, ! 'cusb' : USB_address, } --- 329,373 ---- # _classdeclarations = { ! 'cadb' : ADB_address, ! 'cadr' : address_specification, ! 'cat ' : AppleTalk_address, ! 'cbus' : bus_slot, ! 'cdev' : device_specification, ! 'cen ' : Ethernet_address, ! 'cfw ' : FireWire_address, ! 'cip ' : IP_address, ! 'clt ' : LocalTalk_address, ! 'cscs' : SCSI_address, ! 'ctok' : Token_Ring_address, ! 'cusb' : USB_address, ! } ! ! _propdeclarations = { ! 'ID ' : _Prop_ID, ! 'c@#^' : _Prop__3c_inheritance_3e_, ! 'pALL' : _Prop_properties, ! 'patm' : _Prop_AppleTalk_machine, ! 'patt' : _Prop_AppleTalk_type, ! 'patz' : _Prop_AppleTalk_zone, ! 'pcon' : _Prop_conduit, ! 'pdns' : _Prop_DNS_form, ! 'pdva' : _Prop_device_address, ! 'pdvt' : _Prop_device_type, ! 'pnam' : _Prop_name, ! 'pnet' : _Prop_network, ! 'pnod' : _Prop_node, ! 'ppor' : _Prop_port, ! 'pprt' : _Prop_protocol, ! 'pscb' : _Prop_SCSI_bus, ! 'pslu' : _Prop_LUN, ! 'psoc' : _Prop_socket, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'econ' : _Enum_econ, ! 'edvt' : _Enum_edvt, ! 'epro' : _Enum_epro, } Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** QuickDraw_Graphics_Suite.py 1 Apr 2003 22:04:52 -0000 1.6 --- QuickDraw_Graphics_Suite.py 12 Apr 2003 22:27:10 -0000 1.7 *************** *** 13,242 **** class QuickDraw_Graphics_Suite_Events: ! pass class arc(aetools.ComponentItem): ! """arc - An arc """ ! want = 'carc' class _Prop_arc_angle(aetools.NProperty): ! """arc angle - the angle of the arc in degrees """ ! which = 'parc' ! want = 'fixd' class _Prop_bounds(aetools.NProperty): ! """bounds - the smallest rectangle that contains the entire arc """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_definition_rect(aetools.NProperty): ! """definition rect - the rectangle that contains the circle or oval used to define the arc """ ! which = 'pdrt' ! want = 'qdrt' class _Prop_fill_color(aetools.NProperty): ! """fill color - the fill color """ ! which = 'flcl' ! want = 'cRGB' class _Prop_fill_pattern(aetools.NProperty): ! """fill pattern - the fill pattern """ ! which = 'flpt' ! want = 'cpix' class _Prop_pen_color(aetools.NProperty): ! """pen color - the pen color """ ! which = 'ppcl' ! want = 'cRGB' class _Prop_pen_pattern(aetools.NProperty): ! """pen pattern - the pen pattern """ ! which = 'pppa' ! want = 'cpix' class _Prop_pen_width(aetools.NProperty): ! """pen width - the pen width """ ! which = 'ppwd' ! want = 'shor' class _Prop_start_angle(aetools.NProperty): ! """start angle - the angle that defines the start of the arc, in degrees """ ! which = 'pang' ! want = 'fixd' class _Prop_transfer_mode(aetools.NProperty): ! """transfer mode - the transfer mode """ ! which = 'pptm' ! want = 'tran' arcs = arc class drawing_area(aetools.ComponentItem): ! """drawing area - Container for graphics and supporting information """ ! want = 'cdrw' class _Prop_background_color(aetools.NProperty): ! """background color - the color used to fill in unoccupied areas """ ! which = 'pbcl' ! want = 'cRGB' class _Prop_background_pattern(aetools.NProperty): ! """background pattern - the pattern used to fill in unoccupied areas """ ! which = 'pbpt' ! want = 'cpix' class _Prop_color_table(aetools.NProperty): ! """color table - the color table """ ! which = 'cltb' ! want = 'clrt' class _Prop_default_font(aetools.NProperty): ! """default font - the name of the default font for text objects """ ! which = 'ptxf' ! want = 'itxt' class _Prop_default_location(aetools.NProperty): ! """default location - the default location of each new graphic object """ ! which = 'pnel' ! want = 'QDpt' class _Prop_default_size(aetools.NProperty): ! """default size - the default size for text objects """ ! which = 'ptps' ! want = 'fixd' class _Prop_name(aetools.NProperty): ! """name - the name """ ! which = 'pnam' ! want = 'itxt' class _Prop_ordering(aetools.NProperty): ! """ordering - the ordered list of graphic objects in the drawing area """ ! which = 'gobs' ! want = 'obj ' class _Prop_pixel_depth(aetools.NProperty): ! """pixel depth - the number of bits per pixel """ ! which = 'pdpt' ! want = 'shor' class _Prop_style(aetools.NProperty): ! """style - the default text style for text objects """ ! which = 'txst' ! want = 'tsty' class _Prop_text_color(aetools.NProperty): ! """text color - the default color for text objects """ ! which = 'ptxc' ! want = 'cRGB' class _Prop_update_on_change(aetools.NProperty): ! """update on change - Redraw after each change? """ ! which = 'pupd' ! want = 'bool' class _Prop_writing_code(aetools.NProperty): ! """writing code - the script system and language of text objects in the drawing area """ ! which = 'psct' ! want = 'intl' drawing_areas = drawing_area class graphic_objects(aetools.ComponentItem): ! """graphic objects - """ ! want = 'cgob' graphic_object = graphic_objects class graphic_shapes(aetools.ComponentItem): ! """graphic shapes - """ ! want = 'cgsh' graphic_shape = graphic_shapes class graphic_text(aetools.ComponentItem): ! """graphic text - A series of characters within a drawing area """ ! want = 'cgtx' class _Prop_color(aetools.NProperty): ! """color - the color of the first character """ ! which = 'colr' ! want = 'cRGB' class _Prop_font(aetools.NProperty): ! """font - the name of the font of the first character """ ! which = 'font' ! want = 'ctxt' class _Prop_size(aetools.NProperty): ! """size - the size in points of the first character """ ! which = 'ptsz' ! want = 'fixd' class _Prop_uniform_styles(aetools.NProperty): ! """uniform styles - the text styles that are uniform throughout the text """ ! which = 'ustl' ! want = 'tsty' class ovals(aetools.ComponentItem): ! """ovals - """ ! want = 'covl' oval = ovals class polygon(aetools.ComponentItem): ! """polygon - A polygon """ ! want = 'cpgn' class _Prop_point_list(aetools.NProperty): ! """point list - the list of points that define the polygon """ ! which = 'ptlt' ! want = 'QDpt' polygons = polygon class graphic_groups(aetools.ComponentItem): ! """graphic groups - """ ! want = 'cpic' graphic_group = graphic_groups class pixel_maps(aetools.ComponentItem): ! """pixel maps - """ ! want = 'cpix' pixel_map = pixel_maps class pixel(aetools.ComponentItem): ! """pixel - A pixel """ ! want = 'cpxl' pixels = pixel class rectangles(aetools.ComponentItem): ! """rectangles - """ ! want = 'crec' rectangle = rectangles class rounded_rectangle(aetools.ComponentItem): ! """rounded rectangle - A rounded rectangle """ ! want = 'crrc' class _Prop_corner_curve_height(aetools.NProperty): ! """corner curve height - the height of the oval used to define the shape of the rounded corners """ ! which = 'pchd' ! want = 'shor' class _Prop_corner_curve_width(aetools.NProperty): ! """corner curve width - the width of the oval used to define the shape of the rounded corners """ ! which = 'pcwd' ! want = 'shor' rounded_rectangles = rounded_rectangle class graphic_line(aetools.ComponentItem): ! """graphic line - A graphic line """ ! want = 'glin' class _Prop_arrow_style(aetools.NProperty): ! """arrow style - the arrow style """ ! which = 'arro' ! want = 'arro' class _Prop_dash_style(aetools.NProperty): ! """dash style - the dash style """ ! which = 'pdst' ! want = 'tdas' class _Prop_end_point(aetools.NProperty): ! """end point - the ending point of the line """ ! which = 'pend' ! want = 'QDpt' class _Prop_start_point(aetools.NProperty): ! """start point - the starting point of the line """ ! which = 'pstp' ! want = 'QDpt' graphic_lines = graphic_line arc._superclassnames = [] arc._privpropdict = { ! 'arc_angle' : _Prop_arc_angle, ! 'bounds' : _Prop_bounds, ! 'definition_rect' : _Prop_definition_rect, ! 'fill_color' : _Prop_fill_color, ! 'fill_pattern' : _Prop_fill_pattern, ! 'pen_color' : _Prop_pen_color, ! 'pen_pattern' : _Prop_pen_pattern, ! 'pen_width' : _Prop_pen_width, ! 'start_angle' : _Prop_start_angle, ! 'transfer_mode' : _Prop_transfer_mode, } arc._privelemdict = { --- 13,242 ---- class QuickDraw_Graphics_Suite_Events: ! pass class arc(aetools.ComponentItem): ! """arc - An arc """ ! want = 'carc' class _Prop_arc_angle(aetools.NProperty): ! """arc angle - the angle of the arc in degrees """ ! which = 'parc' ! want = 'fixd' class _Prop_bounds(aetools.NProperty): ! """bounds - the smallest rectangle that contains the entire arc """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_definition_rect(aetools.NProperty): ! """definition rect - the rectangle that contains the circle or oval used to define the arc """ ! which = 'pdrt' ! want = 'qdrt' class _Prop_fill_color(aetools.NProperty): ! """fill color - the fill color """ ! which = 'flcl' ! want = 'cRGB' class _Prop_fill_pattern(aetools.NProperty): ! """fill pattern - the fill pattern """ ! which = 'flpt' ! want = 'cpix' class _Prop_pen_color(aetools.NProperty): ! """pen color - the pen color """ ! which = 'ppcl' ! want = 'cRGB' class _Prop_pen_pattern(aetools.NProperty): ! """pen pattern - the pen pattern """ ! which = 'pppa' ! want = 'cpix' class _Prop_pen_width(aetools.NProperty): ! """pen width - the pen width """ ! which = 'ppwd' ! want = 'shor' class _Prop_start_angle(aetools.NProperty): ! """start angle - the angle that defines the start of the arc, in degrees """ ! which = 'pang' ! want = 'fixd' class _Prop_transfer_mode(aetools.NProperty): ! """transfer mode - the transfer mode """ ! which = 'pptm' ! want = 'tran' arcs = arc class drawing_area(aetools.ComponentItem): ! """drawing area - Container for graphics and supporting information """ ! want = 'cdrw' class _Prop_background_color(aetools.NProperty): ! """background color - the color used to fill in unoccupied areas """ ! which = 'pbcl' ! want = 'cRGB' class _Prop_background_pattern(aetools.NProperty): ! """background pattern - the pattern used to fill in unoccupied areas """ ! which = 'pbpt' ! want = 'cpix' class _Prop_color_table(aetools.NProperty): ! """color table - the color table """ ! which = 'cltb' ! want = 'clrt' class _Prop_default_font(aetools.NProperty): ! """default font - the name of the default font for text objects """ ! which = 'ptxf' ! want = 'itxt' class _Prop_default_location(aetools.NProperty): ! """default location - the default location of each new graphic object """ ! which = 'pnel' ! want = 'QDpt' class _Prop_default_size(aetools.NProperty): ! """default size - the default size for text objects """ ! which = 'ptps' ! want = 'fixd' class _Prop_name(aetools.NProperty): ! """name - the name """ ! which = 'pnam' ! want = 'itxt' class _Prop_ordering(aetools.NProperty): ! """ordering - the ordered list of graphic objects in the drawing area """ ! which = 'gobs' ! want = 'obj ' class _Prop_pixel_depth(aetools.NProperty): ! """pixel depth - the number of bits per pixel """ ! which = 'pdpt' ! want = 'shor' class _Prop_style(aetools.NProperty): ! """style - the default text style for text objects """ ! which = 'txst' ! want = 'tsty' class _Prop_text_color(aetools.NProperty): ! """text color - the default color for text objects """ ! which = 'ptxc' ! want = 'cRGB' class _Prop_update_on_change(aetools.NProperty): ! """update on change - Redraw after each change? """ ! which = 'pupd' ! want = 'bool' class _Prop_writing_code(aetools.NProperty): ! """writing code - the script system and language of text objects in the drawing area """ ! which = 'psct' ! want = 'intl' drawing_areas = drawing_area class graphic_objects(aetools.ComponentItem): ! """graphic objects - """ ! want = 'cgob' graphic_object = graphic_objects class graphic_shapes(aetools.ComponentItem): ! """graphic shapes - """ ! want = 'cgsh' graphic_shape = graphic_shapes class graphic_text(aetools.ComponentItem): ! """graphic text - A series of characters within a drawing area """ ! want = 'cgtx' class _Prop_color(aetools.NProperty): ! """color - the color of the first character """ ! which = 'colr' ! want = 'cRGB' class _Prop_font(aetools.NProperty): ! """font - the name of the font of the first character """ ! which = 'font' ! want = 'ctxt' class _Prop_size(aetools.NProperty): ! """size - the size in points of the first character """ ! which = 'ptsz' ! want = 'fixd' class _Prop_uniform_styles(aetools.NProperty): ! """uniform styles - the text styles that are uniform throughout the text """ ! which = 'ustl' ! want = 'tsty' class ovals(aetools.ComponentItem): ! """ovals - """ ! want = 'covl' oval = ovals class polygon(aetools.ComponentItem): ! """polygon - A polygon """ ! want = 'cpgn' class _Prop_point_list(aetools.NProperty): ! """point list - the list of points that define the polygon """ ! which = 'ptlt' ! want = 'QDpt' polygons = polygon class graphic_groups(aetools.ComponentItem): ! """graphic groups - """ ! want = 'cpic' graphic_group = graphic_groups class pixel_maps(aetools.ComponentItem): ! """pixel maps - """ ! want = 'cpix' pixel_map = pixel_maps class pixel(aetools.ComponentItem): ! """pixel - A pixel """ ! want = 'cpxl' pixels = pixel class rectangles(aetools.ComponentItem): ! """rectangles - """ ! want = 'crec' rectangle = rectangles class rounded_rectangle(aetools.ComponentItem): ! """rounded rectangle - A rounded rectangle """ ! want = 'crrc' class _Prop_corner_curve_height(aetools.NProperty): ! """corner curve height - the height of the oval used to define the shape of the rounded corners """ ! which = 'pchd' ! want = 'shor' class _Prop_corner_curve_width(aetools.NProperty): ! """corner curve width - the width of the oval used to define the shape of the rounded corners """ ! which = 'pcwd' ! want = 'shor' rounded_rectangles = rounded_rectangle class graphic_line(aetools.ComponentItem): ! """graphic line - A graphic line """ ! want = 'glin' class _Prop_arrow_style(aetools.NProperty): ! """arrow style - the arrow style """ ! which = 'arro' ! want = 'arro' class _Prop_dash_style(aetools.NProperty): ! """dash style - the dash style """ ! which = 'pdst' ! want = 'tdas' class _Prop_end_point(aetools.NProperty): ! """end point - the ending point of the line """ ! which = 'pend' ! want = 'QDpt' class _Prop_start_point(aetools.NProperty): ! """start point - the starting point of the line """ ! which = 'pstp' ! want = 'QDpt' graphic_lines = graphic_line arc._superclassnames = [] arc._privpropdict = { ! 'arc_angle' : _Prop_arc_angle, ! 'bounds' : _Prop_bounds, ! 'definition_rect' : _Prop_definition_rect, ! 'fill_color' : _Prop_fill_color, ! 'fill_pattern' : _Prop_fill_pattern, ! 'pen_color' : _Prop_pen_color, ! 'pen_pattern' : _Prop_pen_pattern, ! 'pen_width' : _Prop_pen_width, ! 'start_angle' : _Prop_start_angle, ! 'transfer_mode' : _Prop_transfer_mode, } arc._privelemdict = { *************** *** 244,260 **** drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'background_color' : _Prop_background_color, ! 'background_pattern' : _Prop_background_pattern, ! 'color_table' : _Prop_color_table, ! 'default_font' : _Prop_default_font, ! 'default_location' : _Prop_default_location, ! 'default_size' : _Prop_default_size, ! 'name' : _Prop_name, ! 'ordering' : _Prop_ordering, ! 'pixel_depth' : _Prop_pixel_depth, ! 'style' : _Prop_style, ! 'text_color' : _Prop_text_color, ! 'update_on_change' : _Prop_update_on_change, ! 'writing_code' : _Prop_writing_code, } drawing_area._privelemdict = { --- 244,260 ---- drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'background_color' : _Prop_background_color, ! 'background_pattern' : _Prop_background_pattern, ! 'color_table' : _Prop_color_table, ! 'default_font' : _Prop_default_font, ! 'default_location' : _Prop_default_location, ! 'default_size' : _Prop_default_size, ! 'name' : _Prop_name, ! 'ordering' : _Prop_ordering, ! 'pixel_depth' : _Prop_pixel_depth, ! 'style' : _Prop_style, ! 'text_color' : _Prop_text_color, ! 'update_on_change' : _Prop_update_on_change, ! 'writing_code' : _Prop_writing_code, } drawing_area._privelemdict = { *************** *** 272,279 **** graphic_text._superclassnames = [] graphic_text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'uniform_styles' : _Prop_uniform_styles, } graphic_text._privelemdict = { --- 272,279 ---- graphic_text._superclassnames = [] graphic_text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'uniform_styles' : _Prop_uniform_styles, } graphic_text._privelemdict = { *************** *** 286,290 **** polygon._superclassnames = [] polygon._privpropdict = { ! 'point_list' : _Prop_point_list, } polygon._privelemdict = { --- 286,290 ---- polygon._superclassnames = [] polygon._privpropdict = { ! 'point_list' : _Prop_point_list, } polygon._privelemdict = { *************** *** 302,306 **** pixel._superclassnames = [] pixel._privpropdict = { ! 'color' : _Prop_color, } pixel._privelemdict = { --- 302,306 ---- pixel._superclassnames = [] pixel._privpropdict = { ! 'color' : _Prop_color, } pixel._privelemdict = { *************** *** 313,318 **** rounded_rectangle._superclassnames = [] rounded_rectangle._privpropdict = { ! 'corner_curve_height' : _Prop_corner_curve_height, ! 'corner_curve_width' : _Prop_corner_curve_width, } rounded_rectangle._privelemdict = { --- 313,318 ---- rounded_rectangle._superclassnames = [] rounded_rectangle._privpropdict = { ! 'corner_curve_height' : _Prop_corner_curve_height, ! 'corner_curve_width' : _Prop_corner_curve_width, } rounded_rectangle._privelemdict = { *************** *** 320,353 **** graphic_line._superclassnames = [] graphic_line._privpropdict = { ! 'arrow_style' : _Prop_arrow_style, ! 'dash_style' : _Prop_dash_style, ! 'end_point' : _Prop_end_point, ! 'start_point' : _Prop_start_point, } graphic_line._privelemdict = { } _Enum_arro = { ! 'no_arrow' : 'arno', # No arrow on line ! 'arrow_at_start' : 'arst', # Arrow at start of line ! 'arrow_at_end' : 'aren', # Arrow at end of line ! 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line } _Enum_tran = { ! 'copy_pixels' : 'cpy ', # ! 'not_copy_pixels' : 'ncpy', # ! 'or_pixels' : 'or ', # ! 'not_or_pixels' : 'ntor', # ! 'bic_pixels' : 'bic ', # ! 'not_bic_pixels' : 'nbic', # ! 'xor_pixels' : 'xor ', # ! 'not_xor_pixels' : 'nxor', # ! 'add_over_pixels' : 'addo', # ! 'add_pin_pixels' : 'addp', # ! 'sub_over_pixels' : 'subo', # ! 'sub_pin_pixels' : 'subp', # ! 'ad_max_pixels' : 'admx', # ! 'ad_min_pixels' : 'admn', # ! 'blend_pixels' : 'blnd', # } --- 320,353 ---- graphic_line._superclassnames = [] graphic_line._privpropdict = { ! 'arrow_style' : _Prop_arrow_style, ! 'dash_style' : _Prop_dash_style, ! 'end_point' : _Prop_end_point, ! 'start_point' : _Prop_start_point, } graphic_line._privelemdict = { } _Enum_arro = { ! 'no_arrow' : 'arno', # No arrow on line ! 'arrow_at_start' : 'arst', # Arrow at start of line ! 'arrow_at_end' : 'aren', # Arrow at end of line ! 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line } _Enum_tran = { ! 'copy_pixels' : 'cpy ', # ! 'not_copy_pixels' : 'ncpy', # ! 'or_pixels' : 'or ', # ! 'not_or_pixels' : 'ntor', # ! 'bic_pixels' : 'bic ', # ! 'not_bic_pixels' : 'nbic', # ! 'xor_pixels' : 'xor ', # ! 'not_xor_pixels' : 'nxor', # ! 'add_over_pixels' : 'addo', # ! 'add_pin_pixels' : 'addp', # ! 'sub_over_pixels' : 'subo', # ! 'sub_pin_pixels' : 'subp', # ! 'ad_max_pixels' : 'admx', # ! 'ad_min_pixels' : 'admn', # ! 'blend_pixels' : 'blnd', # } *************** *** 357,372 **** # _classdeclarations = { ! 'carc' : arc, ! 'cdrw' : drawing_area, ! 'cgob' : graphic_objects, ! 'cgsh' : graphic_shapes, ! 'cgtx' : graphic_text, ! 'covl' : ovals, ! 'cpgn' : polygon, ! 'cpic' : graphic_groups, ! 'cpix' : pixel_maps, ! 'cpxl' : pixel, ! 'crec' : rectangles, ! 'crrc' : rounded_rectangle, ! 'glin' : graphic_line, } --- 357,417 ---- # _classdeclarations = { ! 'carc' : arc, ! 'cdrw' : drawing_area, ! 'cgob' : graphic_objects, ! 'cgsh' : graphic_shapes, ! 'cgtx' : graphic_text, ! 'covl' : ovals, ! 'cpgn' : polygon, ! 'cpic' : graphic_groups, ! 'cpix' : pixel_maps, ! 'cpxl' : pixel, ! 'crec' : rectangles, ! 'crrc' : rounded_rectangle, ! 'glin' : graphic_line, ! } ! ! _propdeclarations = { ! 'arro' : _Prop_arrow_style, ! 'cltb' : _Prop_color_table, ! 'colr' : _Prop_color, ! 'flcl' : _Prop_fill_color, ! 'flpt' : _Prop_fill_pattern, ! 'font' : _Prop_font, ! 'gobs' : _Prop_ordering, ! 'pang' : _Prop_start_angle, ! 'parc' : _Prop_arc_angle, ! 'pbcl' : _Prop_background_color, ! 'pbnd' : _Prop_bounds, ! 'pbpt' : _Prop_background_pattern, ! 'pchd' : _Prop_corner_curve_height, ! 'pcwd' : _Prop_corner_curve_width, ! 'pdpt' : _Prop_pixel_depth, ! 'pdrt' : _Prop_definition_rect, ! 'pdst' : _Prop_dash_style, ! 'pend' : _Prop_end_point, ! 'pnam' : _Prop_name, ! 'pnel' : _Prop_default_location, ! 'ppcl' : _Prop_pen_color, ! 'pppa' : _Prop_pen_pattern, ! 'pptm' : _Prop_transfer_mode, ! 'ppwd' : _Prop_pen_width, ! 'psct' : _Prop_writing_code, ! 'pstp' : _Prop_start_point, ! 'ptlt' : _Prop_point_list, ! 'ptps' : _Prop_default_size, ! 'ptsz' : _Prop_size, ! 'ptxc' : _Prop_text_color, ! 'ptxf' : _Prop_default_font, ! 'pupd' : _Prop_update_on_change, ! 'txst' : _Prop_style, ! 'ustl' : _Prop_uniform_styles, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'arro' : _Enum_arro, ! 'tran' : _Enum_tran, } Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QuickDraw_Graphics_Suppleme.py 1 Apr 2003 22:04:54 -0000 1.5 --- QuickDraw_Graphics_Suppleme.py 12 Apr 2003 22:27:10 -0000 1.6 *************** *** 13,47 **** class QuickDraw_Graphics_Suppleme_Events: ! pass class drawing_area(aetools.ComponentItem): ! """drawing area - Container for graphics and supporting information """ ! want = 'cdrw' class _Prop_rotation(aetools.NProperty): ! """rotation - the default rotation for objects in the drawing area """ ! which = 'prot' ! want = 'trot' class _Prop_scale(aetools.NProperty): ! """scale - the default scaling for objects in the drawing area """ ! which = 'pscl' ! want = 'fixd' class _Prop_translation(aetools.NProperty): ! """translation - the default repositioning for objects in the drawing area """ ! which = 'ptrs' ! want = 'QDpt' drawing_areas = drawing_area class graphic_groups(aetools.ComponentItem): ! """graphic groups - """ ! want = 'cpic' graphic_group = graphic_groups drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'rotation' : _Prop_rotation, ! 'scale' : _Prop_scale, ! 'translation' : _Prop_translation, } drawing_area._privelemdict = { --- 13,47 ---- class QuickDraw_Graphics_Suppleme_Events: ! pass class drawing_area(aetools.ComponentItem): ! """drawing area - Container for graphics and supporting information """ ! want = 'cdrw' class _Prop_rotation(aetools.NProperty): ! """rotation - the default rotation for objects in the drawing area """ ! which = 'prot' ! want = 'trot' class _Prop_scale(aetools.NProperty): ! """scale - the default scaling for objects in the drawing area """ ! which = 'pscl' ! want = 'fixd' class _Prop_translation(aetools.NProperty): ! """translation - the default repositioning for objects in the drawing area """ ! which = 'ptrs' ! want = 'QDpt' drawing_areas = drawing_area class graphic_groups(aetools.ComponentItem): ! """graphic groups - """ ! want = 'cpic' graphic_group = graphic_groups drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'rotation' : _Prop_rotation, ! 'scale' : _Prop_scale, ! 'translation' : _Prop_translation, } drawing_area._privelemdict = { *************** *** 57,61 **** # _classdeclarations = { ! 'cdrw' : drawing_area, ! 'cpic' : graphic_groups, } --- 57,73 ---- # _classdeclarations = { ! 'cdrw' : drawing_area, ! 'cpic' : graphic_groups, ! } ! ! _propdeclarations = { ! 'prot' : _Prop_rotation, ! 'pscl' : _Prop_scale, ! 'ptrs' : _Prop_translation, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Required_Suite.py 1 Apr 2003 22:04:54 -0000 1.3 --- Required_Suite.py 12 Apr 2003 22:27:10 -0000 1.4 *************** *** 14,18 **** class Required_Suite_Events(builtin_Suite_Events): ! pass --- 14,18 ---- class Required_Suite_Events(builtin_Suite_Events): ! pass *************** *** 21,23 **** --- 21,32 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Standard_Suite.py 1 Apr 2003 22:04:55 -0000 1.6 --- Standard_Suite.py 12 Apr 2003 22:27:10 -0000 1.7 *************** *** 14,561 **** class Standard_Suite_Events(builtin_Suite_Events): ! _argmap_class_info = { ! 'in_' : 'wrcd', ! } ! def class_info(self, _object=None, _attributes={}, **_arguments): ! """class info: (optional) Get information about an object class ! Required argument: the object class about which information is requested ! Keyword argument in_: the human language and script system in which to return information [...1313 lines suppressed...] ! 'sele' : _Prop_selection, ! 'vers' : _Prop_version, ! } ! ! _compdeclarations = { ! '< ' : _3c_, ! '<= ' : _b2_, ! '= ' : _3d_, ! '> ' : _3e_, ! '>= ' : _b3_, ! 'bgwt' : starts_with, ! 'cont' : contains, ! 'ends' : ends_with, ! } ! ! _enumdeclarations = { ! 'kfrm' : _Enum_kfrm, ! 'savo' : _Enum_savo, ! 'styl' : _Enum_styl, } Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Table_Suite.py 1 Apr 2003 22:04:56 -0000 1.5 --- Table_Suite.py 12 Apr 2003 22:27:10 -0000 1.6 *************** *** 13,58 **** class Table_Suite_Events: ! pass class cell(aetools.ComponentItem): ! """cell - A cell """ ! want = 'ccel' class _Prop_formula(aetools.NProperty): ! """formula - the formula of the cell """ ! which = 'pfor' ! want = 'ctxt' class _Prop_protection(aetools.NProperty): ! """protection - Indicates whether value or formula in the cell can be changed """ ! which = 'ppro' ! want = 'prtn' cells = cell class column(aetools.ComponentItem): ! """column - A column """ ! want = 'ccol' class _Prop_name(aetools.NProperty): ! """name - the name of the column """ ! which = 'pnam' ! want = 'itxt' columns = column class rows(aetools.ComponentItem): ! """rows - """ ! want = 'crow' row = rows class tables(aetools.ComponentItem): ! """tables - """ ! want = 'ctbl' table = tables cell._superclassnames = [] cell._privpropdict = { ! 'formula' : _Prop_formula, ! 'protection' : _Prop_protection, } cell._privelemdict = { --- 13,58 ---- class Table_Suite_Events: ! pass class cell(aetools.ComponentItem): ! """cell - A cell """ ! want = 'ccel' class _Prop_formula(aetools.NProperty): ! """formula - the formula of the cell """ ! which = 'pfor' ! want = 'ctxt' class _Prop_protection(aetools.NProperty): ! """protection - Indicates whether value or formula in the cell can be changed """ ! which = 'ppro' ! want = 'prtn' cells = cell class column(aetools.ComponentItem): ! """column - A column """ ! want = 'ccol' class _Prop_name(aetools.NProperty): ! """name - the name of the column """ ! which = 'pnam' ! want = 'itxt' columns = column class rows(aetools.ComponentItem): ! """rows - """ ! want = 'crow' row = rows class tables(aetools.ComponentItem): ! """tables - """ ! want = 'ctbl' table = tables cell._superclassnames = [] cell._privpropdict = { ! 'formula' : _Prop_formula, ! 'protection' : _Prop_protection, } cell._privelemdict = { *************** *** 60,64 **** column._superclassnames = [] column._privpropdict = { ! 'name' : _Prop_name, } column._privelemdict = { --- 60,64 ---- column._superclassnames = [] column._privpropdict = { ! 'name' : _Prop_name, } column._privelemdict = { *************** *** 75,81 **** } _Enum_prtn = { ! 'read_only' : 'nmod', # Can\xd5t change values or formulas ! 'formulas_protected' : 'fpro', # Can changes values but not formulas ! 'read_2f_write' : 'modf', # Can change values and formulas } --- 75,81 ---- } _Enum_prtn = { ! 'read_only' : 'nmod', # Can\xd5t change values or formulas ! 'formulas_protected' : 'fpro', # Can changes values but not formulas ! 'read_2f_write' : 'modf', # Can change values and formulas } *************** *** 85,91 **** # _classdeclarations = { ! 'ccel' : cell, ! 'ccol' : column, ! 'crow' : rows, ! 'ctbl' : tables, } --- 85,104 ---- # _classdeclarations = { ! 'ccel' : cell, ! 'ccol' : column, ! 'crow' : rows, ! 'ctbl' : tables, ! } ! ! _propdeclarations = { ! 'pfor' : _Prop_formula, ! 'pnam' : _Prop_name, ! 'ppro' : _Prop_protection, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'prtn' : _Enum_prtn, } Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Text_Suite.py 1 Apr 2003 22:04:57 -0000 1.5 --- Text_Suite.py 12 Apr 2003 22:27:10 -0000 1.6 *************** *** 13,80 **** class Text_Suite_Events: ! pass class text_flow(aetools.ComponentItem): ! """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ ! want = 'cflo' class _Prop__3c_inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from this class """ ! which = 'c@#^' ! want = 'ctxt' class _Prop_name(aetools.NProperty): ! """name - the name """ ! which = 'pnam' ! want = 'itxt' text_flows = text_flow class character(aetools.ComponentItem): ! """character - A character """ ! want = 'cha ' class line(aetools.ComponentItem): ! """line - A line of text """ ! want = 'clin' class _Prop_justification(aetools.NProperty): ! """justification - the justification of the text """ ! which = 'pjst' ! want = 'just' lines = line class paragraph(aetools.ComponentItem): ! """paragraph - A paragraph """ ! want = 'cpar' paragraphs = paragraph class text(aetools.ComponentItem): ! """text - Text """ ! want = 'ctxt' class _Prop_color(aetools.NProperty): ! """color - the color of the first character """ ! which = 'colr' ! want = 'cRGB' class _Prop_font(aetools.NProperty): ! """font - the name of the font of the first character """ ! which = 'font' ! want = 'ctxt' class _Prop_size(aetools.NProperty): ! """size - the size in points of the first character """ ! which = 'ptsz' ! want = 'fixd' class _Prop_style(aetools.NProperty): ! """style - the text style of the first character of the first character """ ! which = 'txst' ! want = 'tsty' class _Prop_uniform_styles(aetools.NProperty): ! """uniform styles - the text styles that are uniform throughout the text """ ! which = 'ustl' ! want = 'tsty' class _Prop_writing_code(aetools.NProperty): ! """writing code - the script system and language """ ! which = 'psct' ! want = 'intl' # element 'cha ' as ['indx'] # element 'clin' as ['indx'] --- 13,80 ---- class Text_Suite_Events: ! pass class text_flow(aetools.ComponentItem): ! """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ ! want = 'cflo' class _Prop__3c_inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from this class """ ! which = 'c@#^' ! want = 'ctxt' class _Prop_name(aetools.NProperty): ! """name - the name """ ! which = 'pnam' ! want = 'itxt' text_flows = text_flow class character(aetools.ComponentItem): ! """character - A character """ ! want = 'cha ' class line(aetools.ComponentItem): ! """line - A line of text """ ! want = 'clin' class _Prop_justification(aetools.NProperty): ! """justification - the justification of the text """ ! which = 'pjst' ! want = 'just' lines = line class paragraph(aetools.ComponentItem): ! """paragraph - A paragraph """ ! want = 'cpar' paragraphs = paragraph class text(aetools.ComponentItem): ! """text - Text """ ! want = 'ctxt' class _Prop_color(aetools.NProperty): ! """color - the color of the first character """ ! which = 'colr' ! want = 'cRGB' class _Prop_font(aetools.NProperty): ! """font - the name of the font of the first character """ ! which = 'font' ! want = 'ctxt' class _Prop_size(aetools.NProperty): ! """size - the size in points of the first character """ ! which = 'ptsz' ! want = 'fixd' class _Prop_style(aetools.NProperty): ! """style - the text style of the first character of the first character """ ! which = 'txst' ! want = 'tsty' class _Prop_uniform_styles(aetools.NProperty): ! """uniform styles - the text styles that are uniform throughout the text """ ! which = 'ustl' ! want = 'tsty' class _Prop_writing_code(aetools.NProperty): ! """writing code - the script system and language """ ! which = 'psct' ! want = 'intl' # element 'cha ' as ['indx'] # element 'clin' as ['indx'] *************** *** 84,109 **** class word(aetools.ComponentItem): ! """word - A word """ ! want = 'cwor' words = word class text_style_info(aetools.ComponentItem): ! """text style info - On and Off styles of text run """ ! want = 'tsty' class _Prop_off_styles(aetools.NProperty): ! """off styles - the styles that are off for the text """ ! which = 'ofst' ! want = 'styl' class _Prop_on_styles(aetools.NProperty): ! """on styles - the styles that are on for the text """ ! which = 'onst' ! want = 'styl' text_style_infos = text_style_info text_flow._superclassnames = ['text'] text_flow._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } text_flow._privelemdict = { --- 84,109 ---- class word(aetools.ComponentItem): ! """word - A word """ ! want = 'cwor' words = word class text_style_info(aetools.ComponentItem): ! """text style info - On and Off styles of text run """ ! want = 'tsty' class _Prop_off_styles(aetools.NProperty): ! """off styles - the styles that are off for the text """ ! which = 'ofst' ! want = 'styl' class _Prop_on_styles(aetools.NProperty): ! """on styles - the styles that are on for the text """ ! which = 'onst' ! want = 'styl' text_style_infos = text_style_info text_flow._superclassnames = ['text'] text_flow._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } text_flow._privelemdict = { *************** *** 111,115 **** character._superclassnames = ['text'] character._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } character._privelemdict = { --- 111,115 ---- character._superclassnames = ['text'] character._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } character._privelemdict = { *************** *** 117,122 **** line._superclassnames = ['text'] line._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'justification' : _Prop_justification, } line._privelemdict = { --- 117,122 ---- line._superclassnames = ['text'] line._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'justification' : _Prop_justification, } line._privelemdict = { *************** *** 124,128 **** paragraph._superclassnames = ['text'] paragraph._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } paragraph._privelemdict = { --- 124,128 ---- paragraph._superclassnames = ['text'] paragraph._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } paragraph._privelemdict = { *************** *** 130,150 **** text._superclassnames = [] text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'uniform_styles' : _Prop_uniform_styles, ! 'writing_code' : _Prop_writing_code, } text._privelemdict = { ! 'character' : character, ! 'line' : line, ! 'paragraph' : paragraph, ! 'text' : text, ! 'word' : word, } word._superclassnames = ['text'] word._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } word._privelemdict = { --- 130,150 ---- text._superclassnames = [] text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'uniform_styles' : _Prop_uniform_styles, ! 'writing_code' : _Prop_writing_code, } text._privelemdict = { ! 'character' : character, ! 'line' : line, ! 'paragraph' : paragraph, ! 'text' : text, ! 'word' : word, } word._superclassnames = ['text'] word._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } word._privelemdict = { *************** *** 152,183 **** text_style_info._superclassnames = [] text_style_info._privpropdict = { ! 'off_styles' : _Prop_off_styles, ! 'on_styles' : _Prop_on_styles, } text_style_info._privelemdict = { } _Enum_just = { ! 'left' : 'left', # Align with left margin ! 'right' : 'rght', # Align with right margin ! 'center' : 'cent', # Align with center ! 'full' : 'full', # Align with both left and right margins } _Enum_styl = { ! 'plain' : 'plan', # Plain ! 'bold' : 'bold', # Bold ! 'italic' : 'ital', # Italic ! 'outline' : 'outl', # Outline ! 'shadow' : 'shad', # Shadow ! 'underline' : 'undl', # Underline ! 'superscript' : 'spsc', # Superscript ! 'subscript' : 'sbsc', # Subscript ! 'strikethrough' : 'strk', # Strikethrough ! 'small_caps' : 'smcp', # Small caps ! 'all_caps' : 'alcp', # All capital letters ! 'all_lowercase' : 'lowc', # Lowercase ! 'condensed' : 'cond', # Condensed ! 'expanded' : 'pexp', # Expanded ! 'hidden' : 'hidn', # Hidden } --- 152,183 ---- text_style_info._superclassnames = [] text_style_info._privpropdict = { ! 'off_styles' : _Prop_off_styles, ! 'on_styles' : _Prop_on_styles, } text_style_info._privelemdict = { } _Enum_just = { ! 'left' : 'left', # Align with left margin ! 'right' : 'rght', # Align with right margin ! 'center' : 'cent', # Align with center ! 'full' : 'full', # Align with both left and right margins } _Enum_styl = { ! 'plain' : 'plan', # Plain ! 'bold' : 'bold', # Bold ! 'italic' : 'ital', # Italic ! 'outline' : 'outl', # Outline ! 'shadow' : 'shad', # Shadow ! 'underline' : 'undl', # Underline ! 'superscript' : 'spsc', # Superscript ! 'subscript' : 'sbsc', # Subscript ! 'strikethrough' : 'strk', # Strikethrough ! 'small_caps' : 'smcp', # Small caps ! 'all_caps' : 'alcp', # All capital letters ! 'all_lowercase' : 'lowc', # Lowercase ! 'condensed' : 'cond', # Condensed ! 'expanded' : 'pexp', # Expanded ! 'hidden' : 'hidn', # Hidden } *************** *** 187,196 **** # _classdeclarations = { ! 'cflo' : text_flow, ! 'cha ' : character, ! 'clin' : line, ! 'cpar' : paragraph, ! 'ctxt' : text, ! 'cwor' : word, ! 'tsty' : text_style_info, } --- 187,218 ---- # _classdeclarations = { ! 'cflo' : text_flow, ! 'cha ' : character, ! 'clin' : line, ! 'cpar' : paragraph, ! 'ctxt' : text, ! 'cwor' : word, ! 'tsty' : text_style_info, ! } ! ! _propdeclarations = { ! 'c@#^' : _Prop__3c_inheritance_3e_, ! 'colr' : _Prop_color, ! 'font' : _Prop_font, ! 'ofst' : _Prop_off_styles, ! 'onst' : _Prop_on_styles, ! 'pjst' : _Prop_justification, ! 'pnam' : _Prop_name, ! 'psct' : _Prop_writing_code, ! 'ptsz' : _Prop_size, ! 'txst' : _Prop_style, ! 'ustl' : _Prop_uniform_styles, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'just' : _Enum_just, ! 'styl' : _Enum_styl, } Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Type_Names_Suite.py 1 Apr 2003 22:04:57 -0000 1.6 --- Type_Names_Suite.py 12 Apr 2003 22:27:10 -0000 1.7 *************** *** 13,30 **** class Type_Names_Suite_Events: ! pass class PostScript_picture(aetools.ComponentItem): ! """PostScript picture - """ ! want = 'EPS ' class point(aetools.ComponentItem): ! """point - point coordinates """ ! want = 'QDpt' class string(aetools.ComponentItem): ! """string - a string of characters """ ! want = 'TEXT' plain_text = string --- 13,30 ---- class Type_Names_Suite_Events: ! pass class PostScript_picture(aetools.ComponentItem): ! """PostScript picture - """ ! want = 'EPS ' class point(aetools.ComponentItem): ! """point - point coordinates """ ! want = 'QDpt' class string(aetools.ComponentItem): ! """string - a string of characters """ ! want = 'TEXT' plain_text = string *************** *** 33,182 **** class TIFF_picture(aetools.ComponentItem): ! """TIFF picture - """ ! want = 'TIFF' class application_dictionary(aetools.ComponentItem): ! """application dictionary - """ ! want = 'aete' class system_dictionary(aetools.ComponentItem): ! """system dictionary - """ ! want = 'aeut' class color_table(aetools.ComponentItem): ! """color table - """ ! want = 'clrt' class menu_item(aetools.ComponentItem): ! """menu item - """ ! want = 'cmen' class menu(aetools.ComponentItem): ! """menu - """ ! want = 'cmnu' class double_integer(aetools.ComponentItem): ! """double integer - """ ! want = 'comp' class type_element_info(aetools.ComponentItem): ! """type element info - """ ! want = 'elin' class type_event_info(aetools.ComponentItem): ! """type event info - information about an event """ ! want = 'evin' class extended_real(aetools.ComponentItem): ! """extended real - """ ! want = 'exte' class fixed(aetools.ComponentItem): ! """fixed - a real number """ ! want = 'fixd' class fixed_point(aetools.ComponentItem): ! """fixed point - """ ! want = 'fpnt' class fixed_rectangle(aetools.ComponentItem): ! """fixed rectangle - """ ! want = 'frct' class type_class_info(aetools.ComponentItem): ! """type class info - information about properties and elements of a class """ ! want = 'gcli' class location_reference(aetools.ComponentItem): ! """location reference - """ ! want = 'insl' class long_fixed_point(aetools.ComponentItem): ! """long fixed point - """ ! want = 'lfpt' class long_fixed_rectangle(aetools.ComponentItem): ! """long fixed rectangle - """ ! want = 'lfrc' class long_fixed(aetools.ComponentItem): ! """long fixed - """ ! want = 'lfxd' class long_point(aetools.ComponentItem): ! """long point - """ ! want = 'lpnt' class long_rectangle(aetools.ComponentItem): ! """long rectangle - """ ! want = 'lrct' class machine_location(aetools.ComponentItem): ! """machine location - """ ! want = 'mLoc' class unsigned_integer(aetools.ComponentItem): ! """unsigned integer - """ ! want = 'magn' class null(aetools.ComponentItem): ! """null - """ ! want = 'null' class type_property_info(aetools.ComponentItem): ! """type property info - """ ! want = 'pinf' class type_parameter_info(aetools.ComponentItem): ! """type parameter info - """ ! want = 'pmin' class bounding_rectangle(aetools.ComponentItem): ! """bounding rectangle - bounding rectangle """ ! want = 'qdrt' class small_integer(aetools.ComponentItem): ! """small integer - """ ! want = 'shor' class small_real(aetools.ComponentItem): ! """small real - """ ! want = 'sing' class scrap_styles(aetools.ComponentItem): ! """scrap styles - """ ! want = 'styl' class type_suite_info(aetools.ComponentItem): ! """type suite info - """ ! want = 'suin' class target_id(aetools.ComponentItem): ! """target id - """ ! want = 'targ' class dash_style(aetools.ComponentItem): ! """dash style - """ ! want = 'tdas' class pixel_map_record(aetools.ComponentItem): ! """pixel map record - """ ! want = 'tpmm' class RGB16_color(aetools.ComponentItem): ! """RGB16 color - """ ! want = 'tr16' class RGB96_color(aetools.ComponentItem): ! """RGB96 color - """ ! want = 'tr96' class rotation(aetools.ComponentItem): ! """rotation - """ ! want = 'trot' class version(aetools.ComponentItem): ! """version - """ ! want = 'vers' PostScript_picture._superclassnames = [] PostScript_picture._privpropdict = { --- 33,182 ---- class TIFF_picture(aetools.ComponentItem): ! """TIFF picture - """ ! want = 'TIFF' class application_dictionary(aetools.ComponentItem): ! """application dictionary - """ ! want = 'aete' class system_dictionary(aetools.ComponentItem): ! """system dictionary - """ ! want = 'aeut' class color_table(aetools.ComponentItem): ! """color table - """ ! want = 'clrt' class menu_item(aetools.ComponentItem): ! """menu item - """ ! want = 'cmen' class menu(aetools.ComponentItem): ! """menu - """ ! want = 'cmnu' class double_integer(aetools.ComponentItem): ! """double integer - """ ! want = 'comp' class type_element_info(aetools.ComponentItem): ! """type element info - """ ! want = 'elin' class type_event_info(aetools.ComponentItem): ! """type event info - information about an event """ ! want = 'evin' class extended_real(aetools.ComponentItem): ! """extended real - """ ! want = 'exte' class fixed(aetools.ComponentItem): ! """fixed - a real number """ ! want = 'fixd' class fixed_point(aetools.ComponentItem): ! """fixed point - """ ! want = 'fpnt' class fixed_rectangle(aetools.ComponentItem): ! """fixed rectangle - """ ! want = 'frct' class type_class_info(aetools.ComponentItem): ! """type class info - information about properties and elements of a class """ ! want = 'gcli' class location_reference(aetools.ComponentItem): ! """location reference - """ ! want = 'insl' class long_fixed_point(aetools.ComponentItem): ! """long fixed point - """ ! want = 'lfpt' class long_fixed_rectangle(aetools.ComponentItem): ! """long fixed rectangle - """ ! want = 'lfrc' class long_fixed(aetools.ComponentItem): ! """long fixed - """ ! want = 'lfxd' class long_point(aetools.ComponentItem): ! """long point - """ ! want = 'lpnt' class long_rectangle(aetools.ComponentItem): ! """long rectangle - """ ! want = 'lrct' class machine_location(aetools.ComponentItem): ! """machine location - """ ! want = 'mLoc' class unsigned_integer(aetools.ComponentItem): ! """unsigned integer - """ ! want = 'magn' class null(aetools.ComponentItem): ! """null - """ ! want = 'null' class type_property_info(aetools.ComponentItem): ! """type property info - """ ! want = 'pinf' class type_parameter_info(aetools.ComponentItem): ! """type parameter info - """ ! want = 'pmin' class bounding_rectangle(aetools.ComponentItem): ! """bounding rectangle - bounding rectangle """ ! want = 'qdrt' class small_integer(aetools.ComponentItem): ! """small integer - """ ! want = 'shor' class small_real(aetools.ComponentItem): ! """small real - """ ! want = 'sing' class scrap_styles(aetools.ComponentItem): ! """scrap styles - """ ! want = 'styl' class type_suite_info(aetools.ComponentItem): ! """type suite info - """ ! want = 'suin' class target_id(aetools.ComponentItem): ! """target id - """ ! want = 'targ' class dash_style(aetools.ComponentItem): ! """dash style - """ ! want = 'tdas' class pixel_map_record(aetools.ComponentItem): ! """pixel map record - """ ! want = 'tpmm' class RGB16_color(aetools.ComponentItem): ! """RGB16 color - """ ! want = 'tr16' class RGB96_color(aetools.ComponentItem): ! """RGB96 color - """ ! want = 'tr96' class rotation(aetools.ComponentItem): ! """rotation - """ ! want = 'trot' class version(aetools.ComponentItem): ! """version - """ ! want = 'vers' PostScript_picture._superclassnames = [] PostScript_picture._privpropdict = { *************** *** 384,426 **** # _classdeclarations = { ! 'EPS ' : PostScript_picture, ! 'QDpt' : point, ! 'TEXT' : string, ! 'TIFF' : TIFF_picture, ! 'aete' : application_dictionary, ! 'aeut' : system_dictionary, ! 'clrt' : color_table, ! 'cmen' : menu_item, ! 'cmnu' : menu, ! 'comp' : double_integer, ! 'elin' : type_element_info, ! 'evin' : type_event_info, ! 'exte' : extended_real, ! 'fixd' : fixed, ! 'fpnt' : fixed_point, ! 'frct' : fixed_rectangle, ! 'gcli' : type_class_info, ! 'insl' : location_reference, ! 'lfpt' : long_fixed_point, ! 'lfrc' : long_fixed_rectangle, ! 'lfxd' : long_fixed, ! 'lpnt' : long_point, ! 'lrct' : long_rectangle, ! 'mLoc' : machine_location, ! 'magn' : unsigned_integer, ! 'null' : null, ! 'pinf' : type_property_info, ! 'pmin' : type_parameter_info, ! 'qdrt' : bounding_rectangle, ! 'shor' : small_integer, ! 'sing' : small_real, ! 'styl' : scrap_styles, ! 'suin' : type_suite_info, ! 'targ' : target_id, ! 'tdas' : dash_style, ! 'tpmm' : pixel_map_record, ! 'tr16' : RGB16_color, ! 'tr96' : RGB96_color, ! 'trot' : rotation, ! 'vers' : version, } --- 384,435 ---- # _classdeclarations = { ! 'EPS ' : PostScript_picture, ! 'QDpt' : point, ! 'TEXT' : string, ! 'TIFF' : TIFF_picture, ! 'aete' : application_dictionary, ! 'aeut' : system_dictionary, ! 'clrt' : color_table, ! 'cmen' : menu_item, ! 'cmnu' : menu, ! 'comp' : double_integer, ! 'elin' : type_element_info, ! 'evin' : type_event_info, ! 'exte' : extended_real, ! 'fixd' : fixed, ! 'fpnt' : fixed_point, ! 'frct' : fixed_rectangle, ! 'gcli' : type_class_info, ! 'insl' : location_reference, ! 'lfpt' : long_fixed_point, ! 'lfrc' : long_fixed_rectangle, ! 'lfxd' : long_fixed, ! 'lpnt' : long_point, ! 'lrct' : long_rectangle, ! 'mLoc' : machine_location, ! 'magn' : unsigned_integer, ! 'null' : null, ! 'pinf' : type_property_info, ! 'pmin' : type_parameter_info, ! 'qdrt' : bounding_rectangle, ! 'shor' : small_integer, ! 'sing' : small_real, ! 'styl' : scrap_styles, ! 'suin' : type_suite_info, ! 'targ' : target_id, ! 'tdas' : dash_style, ! 'tpmm' : pixel_map_record, ! 'tr16' : RGB16_color, ! 'tr96' : RGB96_color, ! 'trot' : rotation, ! 'vers' : version, ! } ! ! _propdeclarations = { ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 1 Apr 2003 22:04:59 -0000 1.6 --- __init__.py 12 Apr 2003 22:27:10 -0000 1.7 *************** *** 17,29 **** _code_to_module = { ! 'TEXT' : Text_Suite, ! 'ascr' : AppleScript_Suite, ! 'core' : Standard_Suite, ! 'macc' : Macintosh_Connectivity_Clas, ! 'qdrw' : QuickDraw_Graphics_Suite, ! 'qdsp' : QuickDraw_Graphics_Suppleme, ! 'reqd' : Required_Suite, ! 'tbls' : Table_Suite, ! 'tpnm' : Type_Names_Suite, } --- 17,29 ---- _code_to_module = { ! 'TEXT' : Text_Suite, ! 'ascr' : AppleScript_Suite, ! 'core' : Standard_Suite, ! 'macc' : Macintosh_Connectivity_Clas, ! 'qdrw' : QuickDraw_Graphics_Suite, ! 'qdsp' : QuickDraw_Graphics_Suppleme, ! 'reqd' : Required_Suite, ! 'tbls' : Table_Suite, ! 'tpnm' : Type_Names_Suite, } *************** *** 31,43 **** _code_to_fullname = { ! 'TEXT' : ('StdSuites.Text_Suite', 'Text_Suite'), ! 'ascr' : ('StdSuites.AppleScript_Suite', 'AppleScript_Suite'), ! 'core' : ('StdSuites.Standard_Suite', 'Standard_Suite'), ! 'macc' : ('StdSuites.Macintosh_Connectivity_Clas', 'Macintosh_Connectivity_Clas'), ! 'qdrw' : ('StdSuites.QuickDraw_Graphics_Suite', 'QuickDraw_Graphics_Suite'), ! 'qdsp' : ('StdSuites.QuickDraw_Graphics_Suppleme', 'QuickDraw_Graphics_Suppleme'), ! 'reqd' : ('StdSuites.Required_Suite', 'Required_Suite'), ! 'tbls' : ('StdSuites.Table_Suite', 'Table_Suite'), ! 'tpnm' : ('StdSuites.Type_Names_Suite', 'Type_Names_Suite'), } --- 31,43 ---- _code_to_fullname = { ! 'TEXT' : ('StdSuites.Text_Suite', 'Text_Suite'), ! 'ascr' : ('StdSuites.AppleScript_Suite', 'AppleScript_Suite'), ! 'core' : ('StdSuites.Standard_Suite', 'Standard_Suite'), ! 'macc' : ('StdSuites.Macintosh_Connectivity_Clas', 'Macintosh_Connectivity_Clas'), ! 'qdrw' : ('StdSuites.QuickDraw_Graphics_Suite', 'QuickDraw_Graphics_Suite'), ! 'qdsp' : ('StdSuites.QuickDraw_Graphics_Suppleme', 'QuickDraw_Graphics_Suppleme'), ! 'reqd' : ('StdSuites.Required_Suite', 'Required_Suite'), ! 'tbls' : ('StdSuites.Table_Suite', 'Table_Suite'), ! 'tpnm' : ('StdSuites.Type_Names_Suite', 'Type_Names_Suite'), } *************** *** 53,66 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 53,66 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 264,472 **** # _classdeclarations = { ! 'jul ' : July, ! 'may ' : May, ! 'TEXT' : string, ! 'cmet' : cubic_metres, ! 'STXT' : styled_text, ! 'nds ' : number_2c__date_or_text, ! 'feet' : feet, ! 'feb ' : February, ! 'nmbr' : number, ! 'mile' : miles, ! 'kprs' : keystroke, ! 'psct' : writing_code, ! 'degf' : degrees_Fahrenheit, ! 'lrs ' : list_2c__record_or_text, ! 'ldt ' : date, ! 'litr' : litres, ! 'nd ' : number_or_date, ! 'cmtr' : centimetres, ! 'evnt' : event, ! 'pstr' : Pascal_string, ! 'zone' : zone, ! 'PICT' : picture, ! 'ls ' : list_or_string, ! 'long' : integer, ! 'sf ' : alias_or_string, ! 'citl' : writing_code_info, ! 'citm' : text_item, ! 'mach' : machine, ! 'type' : type_class, ! 'prep' : preposition, ! 'tue ' : Tuesday, ! 'case' : upper_case, ! 'vers' : version, ! 'wed ' : Wednesday, ! 'dec ' : December, ! 'sqkm' : square_kilometres, ! 'obj ' : reference, ! 'vect' : vector, ! 'wkdy' : weekday, ! 'cRGB' : RGB_color, ! 'sun ' : Sunday, ! 'itxt' : international_text, ! 'scnd' : seconds, ! 'mar ' : March, ! 'kmtr' : kilometres, ! 'sqft' : square_feet, ! 'list' : list, ! 'doub' : real, ! 'nov ' : November, ! 'qrts' : quarts, ! 'degc' : degrees_Celsius, ! 'msng' : missing_value, ! 'alis' : alias, ! 'jan ' : January, ! 'metr' : metres, ! 'mnth' : month, ! 'ns ' : number_or_string, ! 'jun ' : June, ! 'aug ' : August, ! 'llst' : linked_list, ! 'styl' : styled_Clipboard_text, ! 'encs' : encoded_string, ! 'galn' : gallons, ! 'cuin' : cubic_inches, ! 'fri ' : Friday, ! 'sutx' : styled_Unicode_text, ! 'lr ' : list_or_record, ! 'degk' : degrees_Kelvin, ! 'mon ' : Monday, ! 'snd ' : sound, ! 'pcls' : class_, ! 'kgrm' : kilograms, ! 'scpt' : script, ! '****' : anything, ! 'prop' : property, ! 'reco' : record, ! 'bool' : boolean, ! 'oct ' : October, ! 'sqrm' : square_metres, ! 'inch' : inches, ! 'kfrm' : reference_form, ! 'cobj' : item, ! 'gram' : grams, ! 'cha ' : character, ! 'apr ' : April, ! 'undf' : empty_ae_name_, ! 'capp' : app, ! 'enum' : constant, ! 'hand' : handler, ! 'sqmi' : square_miles, ! 'rdat' : data, ! 'cstr' : C_string, ! 'utxt' : Unicode_text, ! 'thu ' : Thursday, ! 'sqyd' : square_yards, ! 'yard' : yards, ! 'cyrd' : cubic_yards, ! 'ozs ' : ounces, ! 'lbs ' : pounds, ! 'cfet' : cubic_feet, ! 'ccmt' : cubic_centimetres, ! 'sat ' : Saturday, ! 'sep ' : September, ! 'fss ' : file_specification, ! 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'csel' : selection_2d_object, ! 'alis' : alias, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, ! 'shor' : small_integer, ! 'tr16' : RGB16_color, ! 'vers' : version, ! 'aeut' : system_dictionary, ! 'clrt' : color_table, ! 'fpnt' : fixed_point, ! 'TEXT' : plain_text, ! 'elin' : type_element_info, ! 'insl' : location_reference, ! 'mLoc' : machine_location, ! 'EPS ' : PostScript_picture, ! 'QDpt' : point, ! 'cmen' : menu_item, ! 'tpmm' : pixel_map_record, ! 'aete' : application_dictionary, ! 'magn' : unsigned_integer, ! 'cmnu' : menu, ! 'frct' : fixed_rectangle, ! 'lfrc' : long_fixed_rectangle, ! 'evin' : type_event_info, ! 'sing' : small_real, ! 'suin' : type_suite_info, ! 'trot' : rotation, ! 'pmin' : type_parameter_info, ! 'fixd' : fixed, ! 'styl' : scrap_styles, ! 'lpnt' : long_point, ! 'gcli' : type_class_info, ! 'TIFF' : TIFF_picture, ! 'tr96' : RGB96_color, ! 'tdas' : dash_style, ! 'exte' : extended_real, ! 'pinf' : type_property_info, ! 'lfpt' : long_fixed_point, ! 'lrct' : long_rectangle, ! 'qdrt' : bounding_rectangle, ! 'comp' : double_integer, ! 'lfxd' : long_fixed, ! 'null' : null, ! 'targ' : target_id, ! 'cpar' : paragraph, ! 'cha ' : character, ! 'cflo' : text_flow, ! 'tsty' : text_style_info, ! 'clin' : line, ! 'cwor' : word, ! 'ctxt' : text, ! 'cpic' : graphic_group, ! 'covl' : oval, ! 'cgtx' : graphic_text, ! 'cgsh' : graphic_shape, ! 'glin' : graphic_line, ! 'cgob' : graphic_object, ! 'cdrw' : drawing_area, ! 'cpgn' : polygon, ! 'cpxl' : pixel, ! 'crrc' : rounded_rectangle, ! 'carc' : arc, ! 'cpix' : pixel_map, ! 'crec' : rectangle, ! 'cpic' : graphic_group, ! 'cdrw' : drawing_area, ! 'cat ' : AppleTalk_address, ! 'cadr' : address_specification, ! 'ctok' : Token_Ring_address, ! 'cfw ' : FireWire_address, ! 'cbus' : bus_slot, ! 'cscs' : SCSI_address, ! 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cen ' : Ethernet_address, ! 'ccel' : cell, ! 'ccol' : column, ! 'ctbl' : table, ! 'crow' : row, } class StdSuites(Text_Suite_Events, ! AppleScript_Suite_Events, ! Standard_Suite_Events, ! Macintosh_Connectivity_Clas_Events, ! QuickDraw_Graphics_Suite_Events, ! QuickDraw_Graphics_Suppleme_Events, ! Required_Suite_Events, ! Table_Suite_Events, ! Type_Names_Suite_Events, ! aetools.TalkTo): ! _signature = 'ascr' ! _moduleName = 'StdSuites' --- 264,472 ---- # _classdeclarations = { ! 'jul ' : July, ! 'may ' : May, ! 'TEXT' : string, ! 'cmet' : cubic_metres, ! 'STXT' : styled_text, ! 'nds ' : number_2c__date_or_text, ! 'feet' : feet, ! 'feb ' : February, ! 'nmbr' : number, ! 'mile' : miles, ! 'kprs' : keystroke, ! 'psct' : writing_code, ! 'degf' : degrees_Fahrenheit, ! 'lrs ' : list_2c__record_or_text, ! 'ldt ' : date, ! 'litr' : litres, ! 'nd ' : number_or_date, ! 'cmtr' : centimetres, ! 'evnt' : event, ! 'pstr' : Pascal_string, ! 'zone' : zone, ! 'PICT' : picture, ! 'ls ' : list_or_string, ! 'long' : integer, ! 'sf ' : alias_or_string, ! 'citl' : writing_code_info, ! 'citm' : text_item, ! 'mach' : machine, ! 'type' : type_class, ! 'prep' : preposition, ! 'tue ' : Tuesday, ! 'case' : upper_case, ! 'vers' : version, ! 'wed ' : Wednesday, ! 'dec ' : December, ! 'sqkm' : square_kilometres, ! 'obj ' : reference, ! 'vect' : vector, ! 'wkdy' : weekday, ! 'cRGB' : RGB_color, ! 'sun ' : Sunday, ! 'itxt' : international_text, ! 'scnd' : seconds, ! 'mar ' : March, ! 'kmtr' : kilometres, ! 'sqft' : square_feet, ! 'list' : list, ! 'doub' : real, ! 'nov ' : November, ! 'qrts' : quarts, ! 'degc' : degrees_Celsius, ! 'msng' : missing_value, ! 'alis' : alias, ! 'jan ' : January, ! 'metr' : metres, ! 'mnth' : month, ! 'ns ' : number_or_string, ! 'jun ' : June, ! 'aug ' : August, ! 'llst' : linked_list, ! 'styl' : styled_Clipboard_text, ! 'encs' : encoded_string, ! 'galn' : gallons, ! 'cuin' : cubic_inches, ! 'fri ' : Friday, ! 'sutx' : styled_Unicode_text, ! 'lr ' : list_or_record, ! 'degk' : degrees_Kelvin, ! 'mon ' : Monday, ! 'snd ' : sound, ! 'pcls' : class_, ! 'kgrm' : kilograms, ! 'scpt' : script, ! '****' : anything, ! 'prop' : property, ! 'reco' : record, ! 'bool' : boolean, ! 'oct ' : October, ! 'sqrm' : square_metres, ! 'inch' : inches, ! 'kfrm' : reference_form, ! 'cobj' : item, ! 'gram' : grams, ! 'cha ' : character, ! 'apr ' : April, ! 'undf' : empty_ae_name_, ! 'capp' : app, ! 'enum' : constant, ! 'hand' : handler, ! 'sqmi' : square_miles, ! 'rdat' : data, ! 'cstr' : C_string, ! 'utxt' : Unicode_text, ! 'thu ' : Thursday, ! 'sqyd' : square_yards, ! 'yard' : yards, ! 'cyrd' : cubic_yards, ! 'ozs ' : ounces, ! 'lbs ' : pounds, ! 'cfet' : cubic_feet, ! 'ccmt' : cubic_centimetres, ! 'sat ' : Saturday, ! 'sep ' : September, ! 'fss ' : file_specification, ! 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'csel' : selection_2d_object, ! 'alis' : alias, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, ! 'shor' : small_integer, ! 'tr16' : RGB16_color, ! 'vers' : version, ! 'aeut' : system_dictionary, ! 'clrt' : color_table, ! 'fpnt' : fixed_point, ! 'TEXT' : plain_text, ! 'elin' : type_element_info, ! 'insl' : location_reference, ! 'mLoc' : machine_location, ! 'EPS ' : PostScript_picture, ! 'QDpt' : point, ! 'cmen' : menu_item, ! 'tpmm' : pixel_map_record, ! 'aete' : application_dictionary, ! 'magn' : unsigned_integer, ! 'cmnu' : menu, ! 'frct' : fixed_rectangle, ! 'lfrc' : long_fixed_rectangle, ! 'evin' : type_event_info, ! 'sing' : small_real, ! 'suin' : type_suite_info, ! 'trot' : rotation, ! 'pmin' : type_parameter_info, ! 'fixd' : fixed, ! 'styl' : scrap_styles, ! 'lpnt' : long_point, ! 'gcli' : type_class_info, ! 'TIFF' : TIFF_picture, ! 'tr96' : RGB96_color, ! 'tdas' : dash_style, ! 'exte' : extended_real, ! 'pinf' : type_property_info, ! 'lfpt' : long_fixed_point, ! 'lrct' : long_rectangle, ! 'qdrt' : bounding_rectangle, ! 'comp' : double_integer, ! 'lfxd' : long_fixed, ! 'null' : null, ! 'targ' : target_id, ! 'cpar' : paragraph, ! 'cha ' : character, ! 'cflo' : text_flow, ! 'tsty' : text_style_info, ! 'clin' : line, ! 'cwor' : word, ! 'ctxt' : text, ! 'cpic' : graphic_group, ! 'covl' : oval, ! 'cgtx' : graphic_text, ! 'cgsh' : graphic_shape, ! 'glin' : graphic_line, ! 'cgob' : graphic_object, ! 'cdrw' : drawing_area, ! 'cpgn' : polygon, ! 'cpxl' : pixel, ! 'crrc' : rounded_rectangle, ! 'carc' : arc, ! 'cpix' : pixel_map, ! 'crec' : rectangle, ! 'cpic' : graphic_group, ! 'cdrw' : drawing_area, ! 'cat ' : AppleTalk_address, ! 'cadr' : address_specification, ! 'ctok' : Token_Ring_address, ! 'cfw ' : FireWire_address, ! 'cbus' : bus_slot, ! 'cscs' : SCSI_address, ! 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cen ' : Ethernet_address, ! 'ccel' : cell, ! 'ccol' : column, ! 'ctbl' : table, ! 'crow' : row, } class StdSuites(Text_Suite_Events, ! AppleScript_Suite_Events, ! Standard_Suite_Events, ! Macintosh_Connectivity_Clas_Events, ! QuickDraw_Graphics_Suite_Events, ! QuickDraw_Graphics_Suppleme_Events, ! Required_Suite_Events, ! Table_Suite_Events, ! Type_Names_Suite_Events, ! aetools.TalkTo): ! _signature = 'ascr' ! _moduleName = 'StdSuites' From jackjansen@users.sourceforge.net Sat Apr 12 23:27:14 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents Disk_2d_Folder_2d_File_Suite.py,1.2,1.3 Folder_Actions_Suite.py,1.2,1.3 Hidden_Suite.py,1.2,1.3 Login_Items_Suite.py,1.2,1.3 Power_Suite.py,1.2,1.3 Processes_Suite.py,1.2,1.3 Standard_Suite.py,1.2,1.3 System_Events_Suite.py,1.2,1.3 Text_Suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/SystemEvents Modified Files: Disk_2d_Folder_2d_File_Suite.py Folder_Actions_Suite.py Hidden_Suite.py Login_Items_Suite.py Power_Suite.py Processes_Suite.py Standard_Suite.py System_Events_Suite.py Text_Suite.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: Disk_2d_Folder_2d_File_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_2d_Folder_2d_File_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Disk_2d_Folder_2d_File_Suite.py 1 Apr 2003 22:05:00 -0000 1.2 --- Disk_2d_Folder_2d_File_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,58 **** class Disk_2d_Folder_2d_File_Suite_Events: ! _argmap_move = { ! 'to' : 'insh', ! } ! def move(self, _object, _attributes={}, **_arguments): ! """move: Move disk item(s) to a new location. ! Required argument: the object for the command ! Keyword argument to: The new location for the disk item(s). ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'core' ! _subcode = 'move' ! aetools.keysubst(_arguments, self._argmap_move) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class alias(aetools.ComponentItem): ! """alias - An alias in the file system """ ! want = 'alis' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'cobj' class _Prop_properties(aetools.NProperty): ! """properties - every property of the alias """ ! which = 'pALL' ! want = '****' class _Prop_version(aetools.NProperty): ! """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ ! which = 'vers' ! want = 'utxt' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] --- 13,58 ---- class Disk_2d_Folder_2d_File_Suite_Events: ! _argmap_move = { ! 'to' : 'insh', ! } ! def move(self, _object, _attributes={}, **_arguments): ! """move: Move disk item(s) to a new location. ! Required argument: the object for the command ! Keyword argument to: The new location for the disk item(s). ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'core' ! _subcode = 'move' ! aetools.keysubst(_arguments, self._argmap_move) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class alias(aetools.ComponentItem): ! """alias - An alias in the file system """ ! want = 'alis' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'cobj' class _Prop_properties(aetools.NProperty): ! """properties - every property of the alias """ ! which = 'pALL' ! want = '****' class _Prop_version(aetools.NProperty): ! """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ ! which = 'vers' ! want = 'utxt' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 63,96 **** class disk(aetools.ComponentItem): ! """disk - A disk in the file system """ ! want = 'cdis' class _Prop_capacity(aetools.NProperty): ! """capacity - the total number of bytes (free or used) on the disk """ ! which = 'capa' ! want = 'magn' class _Prop_ejectable(aetools.NProperty): ! """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ ! which = 'isej' ! want = 'bool' class _Prop_format(aetools.NProperty): ! """format - the file system format of this disk """ ! which = 'dfmt' ! want = 'edfm' class _Prop_free_space(aetools.NProperty): ! """free space - the number of free bytes left on the disk """ ! which = 'frsp' ! want = 'magn' class _Prop_ignore_privileges(aetools.NProperty): ! """ignore privileges - Ignore permissions on this disk? """ ! which = 'igpr' ! want = 'bool' class _Prop_local_volume(aetools.NProperty): ! """local volume - Is the media a local volume (as opposed to a file server)? """ ! which = 'isrv' ! want = 'bool' class _Prop_startup(aetools.NProperty): ! """startup - Is this disk the boot disk? """ ! which = 'istd' ! want = 'bool' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] --- 63,96 ---- class disk(aetools.ComponentItem): ! """disk - A disk in the file system """ ! want = 'cdis' class _Prop_capacity(aetools.NProperty): ! """capacity - the total number of bytes (free or used) on the disk """ ! which = 'capa' ! want = 'magn' class _Prop_ejectable(aetools.NProperty): ! """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ ! which = 'isej' ! want = 'bool' class _Prop_format(aetools.NProperty): ! """format - the file system format of this disk """ ! which = 'dfmt' ! want = 'edfm' class _Prop_free_space(aetools.NProperty): ! """free space - the number of free bytes left on the disk """ ! which = 'frsp' ! want = 'magn' class _Prop_ignore_privileges(aetools.NProperty): ! """ignore privileges - Ignore permissions on this disk? """ ! which = 'igpr' ! want = 'bool' class _Prop_local_volume(aetools.NProperty): ! """local volume - Is the media a local volume (as opposed to a file server)? """ ! which = 'isrv' ! want = 'bool' class _Prop_startup(aetools.NProperty): ! """startup - Is this disk the boot disk? """ ! which = 'istd' ! want = 'bool' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 101,106 **** class folder(aetools.ComponentItem): ! """folder - A folder in the file system """ ! want = 'cfol' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] --- 101,106 ---- class folder(aetools.ComponentItem): ! """folder - A folder in the file system """ ! want = 'cfol' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 111,253 **** class item(aetools.ComponentItem): ! """item - An item in the file system """ ! want = 'cobj' class _Prop_POSIX_path(aetools.NProperty): ! """POSIX path - the POSIX file system path of the item """ ! which = 'posx' ! want = 'utxt' class _Prop_busy_status(aetools.NProperty): ! """busy status - Is the item busy? """ ! which = 'busy' ! want = 'bool' class _Prop_creation_date(aetools.NProperty): ! """creation date - the date on which the item was created """ ! which = 'ascd' ! want = '****' class _Prop_displayed_name(aetools.NProperty): ! """displayed name - the name of the item as displayed in the User Interface """ ! which = 'dnam' ! want = 'utxt' class _Prop_modification_date(aetools.NProperty): ! """modification date - the date on which the item was last modified """ ! which = 'asmo' ! want = '****' class _Prop_name(aetools.NProperty): ! """name - the name of the item """ ! which = 'pnam' ! want = 'utxt' class _Prop_name_extension(aetools.NProperty): ! """name extension - the extension portion of the name """ ! which = 'extn' ! want = 'utxt' class _Prop_package_folder(aetools.NProperty): ! """package folder - Is the item a package? """ ! which = 'pkgf' ! want = 'bool' class _Prop_path(aetools.NProperty): ! """path - the file system path of the item """ ! which = 'ppth' ! want = 'utxt' class _Prop_url(aetools.NProperty): ! """url - the url of the item """ ! which = 'url ' ! want = 'utxt' class _Prop_visible(aetools.NProperty): ! """visible - Is the item visible? """ ! which = 'pvis' ! want = 'bool' class _Prop_volume(aetools.NProperty): ! """volume - the volume on which the item resides """ ! which = 'volu' ! want = 'utxt' items = item class file(aetools.ComponentItem): ! """file - A file in the file system """ ! want = 'file' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType identifying the application that created the file """ ! which = 'fcrt' ! want = 'utxt' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType identifying the type of data contained in the file """ ! which = 'asty' ! want = 'utxt' class _Prop_physical_size(aetools.NProperty): ! """physical size - the actual space used by the file on disk """ ! which = 'phys' ! want = '****' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the "Get Info" window) """ ! which = 'ver2' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - the logical size of the file """ ! which = 'ptsz' ! want = '****' class _Prop_stationery(aetools.NProperty): ! """stationery - Is the file a stationery pad? """ ! which = 'pspd' ! want = 'bool' files = file alias._superclassnames = ['item'] alias._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, ! 'version' : _Prop_version, } alias._privelemdict = { ! 'alias' : alias, ! 'file' : file, ! 'folder' : folder, ! 'item' : item, } disk._superclassnames = ['item'] disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'properties' : _Prop_properties, ! 'startup' : _Prop_startup, } disk._privelemdict = { ! 'alias' : alias, ! 'file' : file, ! 'folder' : folder, ! 'item' : item, } folder._superclassnames = ['item'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } folder._privelemdict = { ! 'alias' : alias, ! 'file' : file, ! 'folder' : folder, ! 'item' : item, } item._superclassnames = [] item._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'busy_status' : _Prop_busy_status, ! 'creation_date' : _Prop_creation_date, ! 'displayed_name' : _Prop_displayed_name, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'package_folder' : _Prop_package_folder, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'url' : _Prop_url, ! 'visible' : _Prop_visible, ! 'volume' : _Prop_volume, } item._privelemdict = { --- 111,253 ---- class item(aetools.ComponentItem): ! """item - An item in the file system """ ! want = 'cobj' class _Prop_POSIX_path(aetools.NProperty): ! """POSIX path - the POSIX file system path of the item """ ! which = 'posx' ! want = 'utxt' class _Prop_busy_status(aetools.NProperty): ! """busy status - Is the item busy? """ ! which = 'busy' ! want = 'bool' class _Prop_creation_date(aetools.NProperty): ! """creation date - the date on which the item was created """ ! which = 'ascd' ! want = '****' class _Prop_displayed_name(aetools.NProperty): ! """displayed name - the name of the item as displayed in the User Interface """ ! which = 'dnam' ! want = 'utxt' class _Prop_modification_date(aetools.NProperty): ! """modification date - the date on which the item was last modified """ ! which = 'asmo' ! want = '****' class _Prop_name(aetools.NProperty): ! """name - the name of the item """ ! which = 'pnam' ! want = 'utxt' class _Prop_name_extension(aetools.NProperty): ! """name extension - the extension portion of the name """ ! which = 'extn' ! want = 'utxt' class _Prop_package_folder(aetools.NProperty): ! """package folder - Is the item a package? """ ! which = 'pkgf' ! want = 'bool' class _Prop_path(aetools.NProperty): ! """path - the file system path of the item """ ! which = 'ppth' ! want = 'utxt' class _Prop_url(aetools.NProperty): ! """url - the url of the item """ ! which = 'url ' ! want = 'utxt' class _Prop_visible(aetools.NProperty): ! """visible - Is the item visible? """ ! which = 'pvis' ! want = 'bool' class _Prop_volume(aetools.NProperty): ! """volume - the volume on which the item resides """ ! which = 'volu' ! want = 'utxt' items = item class file(aetools.ComponentItem): ! """file - A file in the file system """ ! want = 'file' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType identifying the application that created the file """ ! which = 'fcrt' ! want = 'utxt' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType identifying the type of data contained in the file """ ! which = 'asty' ! want = 'utxt' class _Prop_physical_size(aetools.NProperty): ! """physical size - the actual space used by the file on disk """ ! which = 'phys' ! want = '****' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the "Get Info" window) """ ! which = 'ver2' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - the logical size of the file """ ! which = 'ptsz' ! want = '****' class _Prop_stationery(aetools.NProperty): ! """stationery - Is the file a stationery pad? """ ! which = 'pspd' ! want = 'bool' files = file alias._superclassnames = ['item'] alias._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, ! 'version' : _Prop_version, } alias._privelemdict = { ! 'alias' : alias, ! 'file' : file, ! 'folder' : folder, ! 'item' : item, } disk._superclassnames = ['item'] disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'properties' : _Prop_properties, ! 'startup' : _Prop_startup, } disk._privelemdict = { ! 'alias' : alias, ! 'file' : file, ! 'folder' : folder, ! 'item' : item, } folder._superclassnames = ['item'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } folder._privelemdict = { ! 'alias' : alias, ! 'file' : file, ! 'folder' : folder, ! 'item' : item, } item._superclassnames = [] item._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'busy_status' : _Prop_busy_status, ! 'creation_date' : _Prop_creation_date, ! 'displayed_name' : _Prop_displayed_name, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'package_folder' : _Prop_package_folder, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'url' : _Prop_url, ! 'visible' : _Prop_visible, ! 'volume' : _Prop_volume, } item._privelemdict = { *************** *** 255,286 **** file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'physical_size' : _Prop_physical_size, ! 'product_version' : _Prop_product_version, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { } _Enum_edfm = { ! 'MS_2d_DOS_format' : 'dfms', # MS-DOS format ! 'Apple_Photo_format' : 'dfph', # Apple Photo format ! 'ISO_9660_format' : 'df96', # ISO 9660 format ! 'QuickTake_format' : 'dfqt', # QuickTake format ! 'AppleShare_format' : 'dfas', # AppleShare format ! 'High_Sierra_format' : 'dfhs', # High Sierra format ! 'Mac_OS_Extended_format' : 'dfh+', # Mac OS Extended format ! 'UDF_format' : 'dfud', # UDF format ! 'unknown_format' : 'df??', # unknown format ! 'audio_format' : 'dfau', # audio format ! 'Mac_OS_format' : 'dfhf', # Mac OS format ! 'UFS_format' : 'dfuf', # UFS format ! 'NFS_format' : 'dfnf', # NFS format ! 'ProDOS_format' : 'dfpr', # ProDOS format ! 'WebDAV_format' : 'dfwd', # WebDAV format } --- 255,286 ---- file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'physical_size' : _Prop_physical_size, ! 'product_version' : _Prop_product_version, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { } _Enum_edfm = { ! 'MS_2d_DOS_format' : 'dfms', # MS-DOS format ! 'Apple_Photo_format' : 'dfph', # Apple Photo format ! 'ISO_9660_format' : 'df96', # ISO 9660 format ! 'QuickTake_format' : 'dfqt', # QuickTake format ! 'AppleShare_format' : 'dfas', # AppleShare format ! 'High_Sierra_format' : 'dfhs', # High Sierra format ! 'Mac_OS_Extended_format' : 'dfh+', # Mac OS Extended format ! 'UDF_format' : 'dfud', # UDF format ! 'unknown_format' : 'df??', # unknown format ! 'audio_format' : 'dfau', # audio format ! 'Mac_OS_format' : 'dfhf', # Mac OS format ! 'UFS_format' : 'dfuf', # UFS format ! 'NFS_format' : 'dfnf', # NFS format ! 'ProDOS_format' : 'dfpr', # ProDOS format ! 'WebDAV_format' : 'dfwd', # WebDAV format } *************** *** 290,297 **** # _classdeclarations = { ! 'alis' : alias, ! 'cdis' : disk, ! 'cfol' : folder, ! 'cobj' : item, ! 'file' : file, } --- 290,335 ---- # _classdeclarations = { ! 'alis' : alias, ! 'cdis' : disk, ! 'cfol' : folder, ! 'cobj' : item, ! 'file' : file, ! } ! ! _propdeclarations = { ! 'ascd' : _Prop_creation_date, ! 'asmo' : _Prop_modification_date, ! 'asty' : _Prop_file_type, ! 'busy' : _Prop_busy_status, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'capa' : _Prop_capacity, ! 'dfmt' : _Prop_format, ! 'dnam' : _Prop_displayed_name, ! 'extn' : _Prop_name_extension, ! 'fcrt' : _Prop_creator_type, ! 'frsp' : _Prop_free_space, ! 'igpr' : _Prop_ignore_privileges, ! 'isej' : _Prop_ejectable, ! 'isrv' : _Prop_local_volume, ! 'istd' : _Prop_startup, ! 'pALL' : _Prop_properties, ! 'phys' : _Prop_physical_size, ! 'pkgf' : _Prop_package_folder, ! 'pnam' : _Prop_name, ! 'posx' : _Prop_POSIX_path, ! 'ppth' : _Prop_path, ! 'pspd' : _Prop_stationery, ! 'ptsz' : _Prop_size, ! 'pvis' : _Prop_visible, ! 'url ' : _Prop_url, ! 'ver2' : _Prop_product_version, ! 'vers' : _Prop_version, ! 'volu' : _Prop_volume, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'edfm' : _Enum_edfm, } Index: Folder_Actions_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Folder_Actions_Suite.py 1 Apr 2003 22:05:02 -0000 1.2 --- Folder_Actions_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,178 **** class Folder_Actions_Suite_Events: ! _argmap_attach_action_to = { ! 'using' : 'faal', ! } ! def attach_action_to(self, _object, _attributes={}, **_arguments): ! """attach action to: Attach an action to a folder ! Required argument: the object for the command ! Keyword argument using: a file containing the script to attach ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'atfa' ! aetools.keysubst(_arguments, self._argmap_attach_action_to) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def attached_scripts(self, _object, _attributes={}, **_arguments): ! """attached scripts: List the actions attached to a folder ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'lact' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_do_folder_action = { ! 'with_window_size' : 'fnsz', ! 'with_item_list' : 'flst', ! 'folder_action_code' : 'actn', ! } ! def do_folder_action(self, _object, _attributes={}, **_arguments): ! """do folder action: Event the Finder sends to the Folder Actions FBA ! Required argument: the object for the command ! Keyword argument with_window_size: the new window size for the folder action message to process ! Keyword argument with_item_list: a list of items for the folder action message to process ! Keyword argument folder_action_code: the folder action message to process ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'fola' ! aetools.keysubst(_arguments, self._argmap_do_folder_action) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'actn', _Enum_actn) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_edit_action_of = { ! 'using_action_name' : 'snam', ! 'using_action_number' : 'indx', ! } ! def edit_action_of(self, _object, _attributes={}, **_arguments): ! """edit action of: Edit as action of a folder ! Required argument: the object for the command ! Keyword argument using_action_name: ...or the name of the action to edit ! Keyword argument using_action_number: the index number of the action to edit... ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'edfa' ! aetools.keysubst(_arguments, self._argmap_edit_action_of) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_remove_action_from = { ! 'using_action_name' : 'snam', ! 'using_action_number' : 'indx', ! } ! def remove_action_from(self, _object, _attributes={}, **_arguments): ! """remove action from: Remove a folder action from a folder ! Required argument: the object for the command ! Keyword argument using_action_name: ...or the name of the action to remove ! Keyword argument using_action_number: the index number of the action to remove... ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'rmfa' ! aetools.keysubst(_arguments, self._argmap_remove_action_from) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class folder_action(aetools.ComponentItem): ! """folder action - An action attached to a folder in the file system """ ! want = 'foac' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'cobj' class _Prop_enabled(aetools.NProperty): ! """enabled - Is the folder action enabled? """ ! which = 'enaB' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the name of the folder action, which is also the name of the folder """ ! which = 'pnam' ! want = 'utxt' class _Prop_path(aetools.NProperty): ! """path - the path to the folder to which the folder action applies """ ! which = 'ppth' ! want = '****' class _Prop_properties(aetools.NProperty): ! """properties - every property of the folder action """ ! which = 'pALL' ! want = '****' class _Prop_volume(aetools.NProperty): ! """volume - the volume on which the folder action resides """ ! which = 'volu' ! want = 'utxt' # element 'scpt' as ['name', 'indx', 'rele', 'rang', 'test'] --- 13,178 ---- class Folder_Actions_Suite_Events: ! _argmap_attach_action_to = { ! 'using' : 'faal', ! } ! def attach_action_to(self, _object, _attributes={}, **_arguments): ! """attach action to: Attach an action to a folder ! Required argument: the object for the command ! Keyword argument using: a file containing the script to attach ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'atfa' ! aetools.keysubst(_arguments, self._argmap_attach_action_to) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def attached_scripts(self, _object, _attributes={}, **_arguments): ! """attached scripts: List the actions attached to a folder ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'lact' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_do_folder_action = { ! 'with_window_size' : 'fnsz', ! 'with_item_list' : 'flst', ! 'folder_action_code' : 'actn', ! } ! def do_folder_action(self, _object, _attributes={}, **_arguments): ! """do folder action: Event the Finder sends to the Folder Actions FBA ! Required argument: the object for the command ! Keyword argument with_window_size: the new window size for the folder action message to process ! Keyword argument with_item_list: a list of items for the folder action message to process ! Keyword argument folder_action_code: the folder action message to process ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'fola' ! aetools.keysubst(_arguments, self._argmap_do_folder_action) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'actn', _Enum_actn) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_edit_action_of = { ! 'using_action_name' : 'snam', ! 'using_action_number' : 'indx', ! } ! def edit_action_of(self, _object, _attributes={}, **_arguments): ! """edit action of: Edit as action of a folder ! Required argument: the object for the command ! Keyword argument using_action_name: ...or the name of the action to edit ! Keyword argument using_action_number: the index number of the action to edit... ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'edfa' ! aetools.keysubst(_arguments, self._argmap_edit_action_of) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_remove_action_from = { ! 'using_action_name' : 'snam', ! 'using_action_number' : 'indx', ! } ! def remove_action_from(self, _object, _attributes={}, **_arguments): ! """remove action from: Remove a folder action from a folder ! Required argument: the object for the command ! Keyword argument using_action_name: ...or the name of the action to remove ! Keyword argument using_action_number: the index number of the action to remove... ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the reply for the command ! """ ! _code = 'faco' ! _subcode = 'rmfa' ! aetools.keysubst(_arguments, self._argmap_remove_action_from) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class folder_action(aetools.ComponentItem): ! """folder action - An action attached to a folder in the file system """ ! want = 'foac' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'cobj' class _Prop_enabled(aetools.NProperty): ! """enabled - Is the folder action enabled? """ ! which = 'enaB' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the name of the folder action, which is also the name of the folder """ ! which = 'pnam' ! want = 'utxt' class _Prop_path(aetools.NProperty): ! """path - the path to the folder to which the folder action applies """ ! which = 'ppth' ! want = '****' class _Prop_properties(aetools.NProperty): ! """properties - every property of the folder action """ ! which = 'pALL' ! want = '****' class _Prop_volume(aetools.NProperty): ! """volume - the volume on which the folder action resides """ ! which = 'volu' ! want = 'utxt' # element 'scpt' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 180,189 **** class script(aetools.ComponentItem): ! """script - A script invoked by a folder action """ ! want = 'scpt' class _Prop_POSIX_path(aetools.NProperty): ! """POSIX path - the POSIX file system path of the disk """ ! which = 'posx' ! want = 'utxt' scripts = script --- 180,189 ---- class script(aetools.ComponentItem): ! """script - A script invoked by a folder action """ ! want = 'scpt' class _Prop_POSIX_path(aetools.NProperty): ! """POSIX path - the POSIX file system path of the disk """ ! which = 'posx' ! want = 'utxt' scripts = script *************** *** 191,220 **** folder_action._superclassnames = ['item'] folder_action._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'enabled' : _Prop_enabled, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'volume' : _Prop_volume, } folder_action._privelemdict = { ! 'script' : script, } script._superclassnames = ['item'] script._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, } script._privelemdict = { } _Enum_actn = { ! 'items_added' : 'fget', # items added ! 'items_removed' : 'flos', # items removed ! 'window_closed' : 'fclo', # window closed ! 'window_moved' : 'fsiz', # window moved ! 'window_opened' : 'fopn', # window opened } --- 191,220 ---- folder_action._superclassnames = ['item'] folder_action._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'enabled' : _Prop_enabled, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'volume' : _Prop_volume, } folder_action._privelemdict = { ! 'script' : script, } script._superclassnames = ['item'] script._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, } script._privelemdict = { } _Enum_actn = { ! 'items_added' : 'fget', # items added ! 'items_removed' : 'flos', # items removed ! 'window_closed' : 'fclo', # window closed ! 'window_moved' : 'fsiz', # window moved ! 'window_opened' : 'fopn', # window opened } *************** *** 224,228 **** # _classdeclarations = { ! 'foac' : folder_action, ! 'scpt' : script, } --- 224,245 ---- # _classdeclarations = { ! 'foac' : folder_action, ! 'scpt' : script, ! } ! ! _propdeclarations = { ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'enaB' : _Prop_enabled, ! 'pALL' : _Prop_properties, ! 'pnam' : _Prop_name, ! 'posx' : _Prop_POSIX_path, ! 'ppth' : _Prop_path, ! 'volu' : _Prop_volume, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'actn' : _Enum_actn, } Index: Hidden_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Hidden_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Hidden_Suite.py 1 Apr 2003 22:05:03 -0000 1.2 --- Hidden_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 14,36 **** class Hidden_Suite_Events(Type_Names_Suite_Events): ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Execute an OSA script. ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'dosc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 14,36 ---- class Hidden_Suite_Events(Type_Names_Suite_Events): ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Execute an OSA script. ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'dosc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 39,41 **** --- 39,50 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Login_Items_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Login_Items_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Login_Items_Suite.py 1 Apr 2003 22:05:03 -0000 1.2 --- Login_Items_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,42 **** class Login_Items_Suite_Events: ! pass class login_item(aetools.ComponentItem): ! """login item - an item to be launched or opened at login """ ! want = 'logi' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'cobj' class _Prop_hidden(aetools.NProperty): ! """hidden - Is the Login Item hidden when launched? """ ! which = 'hidn' ! want = 'bool' class _Prop_kind(aetools.NProperty): ! """kind - the file type of the Login Item """ ! which = 'kind' ! want = 'utxt' class _Prop_name(aetools.NProperty): ! """name - the name of the Login Item """ ! which = 'pnam' ! want = 'utxt' class _Prop_path(aetools.NProperty): ! """path - the file system path to the Login Item """ ! which = 'ppth' ! want = 'utxt' login_items = login_item --- 13,42 ---- class Login_Items_Suite_Events: ! pass class login_item(aetools.ComponentItem): ! """login item - an item to be launched or opened at login """ ! want = 'logi' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'cobj' class _Prop_hidden(aetools.NProperty): ! """hidden - Is the Login Item hidden when launched? """ ! which = 'hidn' ! want = 'bool' class _Prop_kind(aetools.NProperty): ! """kind - the file type of the Login Item """ ! which = 'kind' ! want = 'utxt' class _Prop_name(aetools.NProperty): ! """name - the name of the Login Item """ ! which = 'pnam' ! want = 'utxt' class _Prop_path(aetools.NProperty): ! """path - the file system path to the Login Item """ ! which = 'ppth' ! want = 'utxt' login_items = login_item *************** *** 44,52 **** login_item._superclassnames = ['item'] login_item._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'hidden' : _Prop_hidden, ! 'kind' : _Prop_kind, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } login_item._privelemdict = { --- 44,52 ---- login_item._superclassnames = ['item'] login_item._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'hidden' : _Prop_hidden, ! 'kind' : _Prop_kind, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } login_item._privelemdict = { *************** *** 57,60 **** # _classdeclarations = { ! 'logi' : login_item, } --- 57,74 ---- # _classdeclarations = { ! 'logi' : login_item, ! } ! ! _propdeclarations = { ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'hidn' : _Prop_hidden, ! 'kind' : _Prop_kind, ! 'pnam' : _Prop_name, ! 'ppth' : _Prop_path, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Power_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Power_Suite.py 1 Apr 2003 22:05:05 -0000 1.2 --- Power_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,75 **** class Power_Suite_Events: ! def restart(self, _object, _attributes={}, **_arguments): ! """restart: Restart the computer ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'rest' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def shut_down(self, _object, _attributes={}, **_arguments): ! """shut down: Shut Down the computer ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'shut' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def sleep(self, _object, _attributes={}, **_arguments): ! """sleep: Put the computer to sleep ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'slep' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,75 ---- class Power_Suite_Events: ! def restart(self, _object, _attributes={}, **_arguments): ! """restart: Restart the computer ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'rest' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def shut_down(self, _object, _attributes={}, **_arguments): ! """shut down: Shut Down the computer ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'shut' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def sleep(self, _object, _attributes={}, **_arguments): ! """sleep: Put the computer to sleep ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'slep' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 78,80 **** --- 78,89 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Processes_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Processes_Suite.py 1 Apr 2003 22:05:06 -0000 1.2 --- Processes_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,235 **** class Processes_Suite_Events: ! def cancel(self, _object, _attributes={}, **_arguments): ! """cancel: cause the target process to behave as if the UI element were cancelled ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'prcs' ! _subcode = 'cncl' [...5777 lines suppressed...] ! 'pnam' : _Prop_name, ! 'posn' : _Prop_position, ! 'ptsz' : _Prop_size, ! 'pusd' : _Prop_partition_space_used, ! 'pvis' : _Prop_visible, ! 'revt' : _Prop_accepts_remote_events, ! 'role' : _Prop_role, ! 'sbrl' : _Prop_subrole, ! 'selE' : _Prop_selected, ! 'titl' : _Prop_title, ! 'valu' : _Prop_value, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'eMds' : _Enum_eMds, ! 'eMky' : _Enum_eMky, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 --- Standard_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,353 **** class Standard_Suite_Events: ! _argmap_close = { ! 'saving_in' : 'kfil', ! 'saving' : 'savo', ! } ! def close(self, _object, _attributes={}, **_arguments): ! """close: Close an object. ! Required argument: the object for the command [...1062 lines suppressed...] ! 'ptit' : _Prop_titled, ! 'pvis' : _Prop_visible, ! 'pzum' : _Prop_zoomed, ! 'vers' : _Prop_version, ! } ! ! _compdeclarations = { ! '< ' : _3c_, ! '<= ' : _b2_, ! '= ' : _3d_, ! '> ' : _3e_, ! '>= ' : _b3_, ! 'bgwt' : starts_with, ! 'cont' : contains, ! 'ends' : ends_with, ! } ! ! _enumdeclarations = { ! 'savo' : _Enum_savo, } Index: System_Events_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** System_Events_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 --- System_Events_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,38 **** class System_Events_Suite_Events: ! pass class application(aetools.ComponentItem): ! """application - The System Events application """ ! want = 'capp' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'capp' class _Prop_folder_actions_enabled(aetools.NProperty): ! """folder actions enabled - Are Folder Actions currently being processed? """ ! which = 'faen' ! want = 'bool' class _Prop_properties(aetools.NProperty): ! """properties - every property of the System Events application """ ! which = 'pALL' ! want = '****' class _Prop_system_wide_UI_element(aetools.NProperty): ! """system wide UI element - the UI element for the entire system """ ! which = 'swui' ! want = 'uiel' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] --- 13,38 ---- class System_Events_Suite_Events: ! pass class application(aetools.ComponentItem): ! """application - The System Events application """ ! want = 'capp' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'capp' class _Prop_folder_actions_enabled(aetools.NProperty): ! """folder actions enabled - Are Folder Actions currently being processed? """ ! which = 'faen' ! want = 'bool' class _Prop_properties(aetools.NProperty): ! """properties - every property of the System Events application """ ! which = 'pALL' ! want = '****' class _Prop_system_wide_UI_element(aetools.NProperty): ! """system wide UI element - the UI element for the entire system """ ! which = 'swui' ! want = 'uiel' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 57,79 **** import Processes_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'folder_actions_enabled' : _Prop_folder_actions_enabled, ! 'properties' : _Prop_properties, ! 'system_wide_UI_element' : _Prop_system_wide_UI_element, } application._privelemdict = { ! 'UI_element' : Processes_Suite.UI_element, ! 'alias' : Disk_2d_Folder_2d_File_Suite.alias, ! 'application_process' : Processes_Suite.application_process, ! 'desk_accessory_process' : Processes_Suite.desk_accessory_process, ! 'disk' : Disk_2d_Folder_2d_File_Suite.disk, ! 'document' : Standard_Suite.document, ! 'file' : Disk_2d_Folder_2d_File_Suite.file, ! 'folder' : Disk_2d_Folder_2d_File_Suite.folder, ! 'folder_action' : Folder_Actions_Suite.folder_action, ! 'item' : Disk_2d_Folder_2d_File_Suite.item, ! 'login_item' : Login_Items_Suite.login_item, ! 'process' : Processes_Suite.process, ! 'window' : Standard_Suite.window, } --- 57,79 ---- import Processes_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'folder_actions_enabled' : _Prop_folder_actions_enabled, ! 'properties' : _Prop_properties, ! 'system_wide_UI_element' : _Prop_system_wide_UI_element, } application._privelemdict = { ! 'UI_element' : Processes_Suite.UI_element, ! 'alias' : Disk_2d_Folder_2d_File_Suite.alias, ! 'application_process' : Processes_Suite.application_process, ! 'desk_accessory_process' : Processes_Suite.desk_accessory_process, ! 'disk' : Disk_2d_Folder_2d_File_Suite.disk, ! 'document' : Standard_Suite.document, ! 'file' : Disk_2d_Folder_2d_File_Suite.file, ! 'folder' : Disk_2d_Folder_2d_File_Suite.folder, ! 'folder_action' : Folder_Actions_Suite.folder_action, ! 'item' : Disk_2d_Folder_2d_File_Suite.item, ! 'login_item' : Login_Items_Suite.login_item, ! 'process' : Processes_Suite.process, ! 'window' : Standard_Suite.window, } *************** *** 82,85 **** # _classdeclarations = { ! 'capp' : application, } --- 82,98 ---- # _classdeclarations = { ! 'capp' : application, ! } ! ! _propdeclarations = { ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'faen' : _Prop_folder_actions_enabled, ! 'pALL' : _Prop_properties, ! 'swui' : _Prop_system_wide_UI_element, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Text_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Text_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 --- Text_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 13,30 **** class Text_Suite_Events: ! pass class attachment(aetools.ComponentItem): ! """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ ! want = 'atts' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'ctxt' class _Prop_file_name(aetools.NProperty): ! """file name - The path to the file for the attachment """ ! which = 'atfn' ! want = 'utxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 13,30 ---- class Text_Suite_Events: ! pass class attachment(aetools.ComponentItem): ! """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ ! want = 'atts' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'ctxt' class _Prop_file_name(aetools.NProperty): ! """file name - The path to the file for the attachment """ ! which = 'atfn' ! want = 'utxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 33,50 **** class attribute_run(aetools.ComponentItem): ! """attribute run - This subdivides the text into chunks that all have the same attributes. """ ! want = 'catr' class _Prop_color(aetools.NProperty): ! """color - The color of the first character. """ ! which = 'colr' ! want = 'colr' class _Prop_font(aetools.NProperty): ! """font - The name of the font of the first character. """ ! which = 'font' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - The size in points of the first character. """ ! which = 'ptsz' ! want = 'long' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 33,50 ---- class attribute_run(aetools.ComponentItem): ! """attribute run - This subdivides the text into chunks that all have the same attributes. """ ! want = 'catr' class _Prop_color(aetools.NProperty): ! """color - The color of the first character. """ ! which = 'colr' ! want = 'colr' class _Prop_font(aetools.NProperty): ! """font - The name of the font of the first character. """ ! which = 'font' ! want = 'utxt' class _Prop_size(aetools.NProperty): ! """size - The size in points of the first character. """ ! which = 'ptsz' ! want = 'long' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 55,60 **** class character(aetools.ComponentItem): ! """character - This subdivides the text into characters. """ ! want = 'cha ' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 55,60 ---- class character(aetools.ComponentItem): ! """character - This subdivides the text into characters. """ ! want = 'cha ' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 65,70 **** class paragraph(aetools.ComponentItem): ! """paragraph - This subdivides the text into paragraphs. """ ! want = 'cpar' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 65,70 ---- class paragraph(aetools.ComponentItem): ! """paragraph - This subdivides the text into paragraphs. """ ! want = 'cpar' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 75,80 **** class text(aetools.ComponentItem): ! """text - Rich (styled) text """ ! want = 'ctxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 75,80 ---- class text(aetools.ComponentItem): ! """text - Rich (styled) text """ ! want = 'ctxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 83,88 **** class word(aetools.ComponentItem): ! """word - This subdivides the text into words. """ ! want = 'cwor' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] --- 83,88 ---- class word(aetools.ComponentItem): ! """word - This subdivides the text into words. """ ! want = 'cwor' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] *************** *** 93,170 **** attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } import Standard_Suite attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } --- 93,170 ---- attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } import Standard_Suite attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { ! 'attribute_run' : attribute_run, ! 'character' : character, ! 'paragraph' : paragraph, ! 'word' : word, } *************** *** 173,181 **** # _classdeclarations = { ! 'atts' : attachment, ! 'catr' : attribute_run, ! 'cha ' : character, ! 'cpar' : paragraph, ! 'ctxt' : text, ! 'cwor' : word, } --- 173,195 ---- # _classdeclarations = { ! 'atts' : attachment, ! 'catr' : attribute_run, ! 'cha ' : character, ! 'cpar' : paragraph, ! 'ctxt' : text, ! 'cwor' : word, ! } ! ! _propdeclarations = { ! 'atfn' : _Prop_file_name, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'colr' : _Prop_color, ! 'font' : _Prop_font, ! 'ptsz' : _Prop_size, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 1 Apr 2003 22:05:09 -0000 1.2 --- __init__.py 12 Apr 2003 22:27:10 -0000 1.3 *************** *** 16,28 **** _code_to_module = { ! '????' : Standard_Suite, ! '????' : Text_Suite, ! 'cdis' : Disk_2d_Folder_2d_File_Suite, ! 'faco' : Folder_Actions_Suite, ! 'logi' : Login_Items_Suite, ! 'powr' : Power_Suite, ! 'prcs' : Processes_Suite, ! 'sevs' : System_Events_Suite, ! 'tpnm' : Hidden_Suite, } --- 16,28 ---- _code_to_module = { ! '????' : Standard_Suite, ! '????' : Text_Suite, ! 'cdis' : Disk_2d_Folder_2d_File_Suite, ! 'faco' : Folder_Actions_Suite, ! 'logi' : Login_Items_Suite, ! 'powr' : Power_Suite, ! 'prcs' : Processes_Suite, ! 'sevs' : System_Events_Suite, ! 'tpnm' : Hidden_Suite, } *************** *** 30,42 **** _code_to_fullname = { ! '????' : ('SystemEvents.Standard_Suite', 'Standard_Suite'), ! '????' : ('SystemEvents.Text_Suite', 'Text_Suite'), ! 'cdis' : ('SystemEvents.Disk_2d_Folder_2d_File_Suite', 'Disk_2d_Folder_2d_File_Suite'), ! 'faco' : ('SystemEvents.Folder_Actions_Suite', 'Folder_Actions_Suite'), ! 'logi' : ('SystemEvents.Login_Items_Suite', 'Login_Items_Suite'), ! 'powr' : ('SystemEvents.Power_Suite', 'Power_Suite'), ! 'prcs' : ('SystemEvents.Processes_Suite', 'Processes_Suite'), ! 'sevs' : ('SystemEvents.System_Events_Suite', 'System_Events_Suite'), ! 'tpnm' : ('SystemEvents.Hidden_Suite', 'Hidden_Suite'), } --- 30,42 ---- _code_to_fullname = { ! '????' : ('SystemEvents.Standard_Suite', 'Standard_Suite'), ! '????' : ('SystemEvents.Text_Suite', 'Text_Suite'), ! 'cdis' : ('SystemEvents.Disk_2d_Folder_2d_File_Suite', 'Disk_2d_Folder_2d_File_Suite'), ! 'faco' : ('SystemEvents.Folder_Actions_Suite', 'Folder_Actions_Suite'), ! 'logi' : ('SystemEvents.Login_Items_Suite', 'Login_Items_Suite'), ! 'powr' : ('SystemEvents.Power_Suite', 'Power_Suite'), ! 'prcs' : ('SystemEvents.Processes_Suite', 'Processes_Suite'), ! 'sevs' : ('SystemEvents.System_Events_Suite', 'System_Events_Suite'), ! 'tpnm' : ('SystemEvents.Hidden_Suite', 'Hidden_Suite'), } *************** *** 52,65 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 52,65 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 68,71 **** --- 68,76 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(color) + getbaseclasses(window) + getbaseclasses(application) + getbaseclasses(item) + getbaseclasses(document) getbaseclasses(character) getbaseclasses(attachment) *************** *** 74,77 **** --- 79,83 ---- getbaseclasses(attribute_run) getbaseclasses(text) + getbaseclasses(login_item) getbaseclasses(file) getbaseclasses(alias) *************** *** 79,89 **** getbaseclasses(folder) getbaseclasses(disk) - getbaseclasses(color) - getbaseclasses(window) - getbaseclasses(application) - getbaseclasses(item) - getbaseclasses(document) getbaseclasses(script) getbaseclasses(folder_action) getbaseclasses(window) getbaseclasses(radio_button) --- 85,130 ---- getbaseclasses(folder) getbaseclasses(disk) getbaseclasses(script) getbaseclasses(folder_action) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.string) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) getbaseclasses(window) getbaseclasses(radio_button) *************** *** 130,175 **** getbaseclasses(combo_box) getbaseclasses(browser) - getbaseclasses(StdSuites.Type_Names_Suite.double_integer) - getbaseclasses(StdSuites.Type_Names_Suite.version) - getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) - getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.color_table) - getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) - getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) - getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) - getbaseclasses(StdSuites.Type_Names_Suite.machine_location) - getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) - getbaseclasses(StdSuites.Type_Names_Suite.point) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.menu_item) - getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) - getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) - getbaseclasses(StdSuites.Type_Names_Suite.menu) - getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) - getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) - getbaseclasses(StdSuites.Type_Names_Suite.rotation) - getbaseclasses(StdSuites.Type_Names_Suite.small_integer) - getbaseclasses(StdSuites.Type_Names_Suite.fixed) - getbaseclasses(StdSuites.Type_Names_Suite.long_point) - getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) - getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) - getbaseclasses(StdSuites.Type_Names_Suite.target_id) - getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) - getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) - getbaseclasses(StdSuites.Type_Names_Suite.extended_real) - getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.dash_style) - getbaseclasses(StdSuites.Type_Names_Suite.string) - getbaseclasses(StdSuites.Type_Names_Suite.small_real) - getbaseclasses(StdSuites.Type_Names_Suite.null) - getbaseclasses(StdSuites.Type_Names_Suite.location_reference) - getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) getbaseclasses(application) - getbaseclasses(login_item) # --- 171,175 ---- *************** *** 177,299 **** # _classdeclarations = { ! 'cha ' : character, ! 'atts' : attachment, ! 'cpar' : paragraph, ! 'cwor' : word, ! 'catr' : attribute_run, ! 'ctxt' : text, ! 'file' : file, ! 'alis' : alias, ! 'cobj' : item, ! 'cfol' : folder, ! 'cdis' : disk, ! 'colr' : color, ! 'cwin' : window, ! 'capp' : application, ! 'cobj' : item, ! 'docu' : document, ! 'scpt' : script, ! 'foac' : folder_action, ! 'cwin' : window, ! 'radB' : radio_button, ! 'list' : list, ! 'pcda' : desk_accessory_process, ! 'menI' : menu_item, ! 'proI' : progress_indicator, ! 'menE' : menu, ! 'menB' : menu_button, ! 'popB' : pop_up_button, ! 'incr' : incrementor, ! 'sheE' : sheet, ! 'tbar' : tool_bar, ! 'pcap' : application_process, ! 'txtf' : text_field, ! 'txta' : text_area, ! 'sliI' : slider, ! 'scra' : scroll_area, ! 'reli' : relevance_indicator, ! 'busi' : busy_indicator, ! 'crow' : row, ! 'prcs' : process, ! 'tabB' : table, ! 'outl' : outline, ! 'uiel' : UI_element, ! 'vali' : value_indicator, ! 'sysw' : system_wide_UI_element, ! 'butT' : button, ! 'capp' : application, ! 'rgrp' : radio_group, ! 'imaA' : image, ! 'tab ' : tab_group, ! 'mbar' : menu_bar, ! 'grow' : grow_area, ! 'chbx' : check_box, ! 'ccol' : column, ! 'sttx' : static_text, ! 'splg' : splitter_group, ! 'sgrp' : group, ! 'splr' : splitter, ! 'draA' : drawer, ! 'colW' : color_well, ! 'scrb' : scroll_bar, ! 'comB' : combo_box, ! 'broW' : browser, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, ! 'capp' : application, ! 'logi' : login_item, } class SystemEvents(Standard_Suite_Events, ! Text_Suite_Events, ! Disk_2d_Folder_2d_File_Suite_Events, ! Folder_Actions_Suite_Events, ! Login_Items_Suite_Events, ! Power_Suite_Events, ! Processes_Suite_Events, ! System_Events_Suite_Events, ! Hidden_Suite_Events, ! aetools.TalkTo): ! _signature = 'sevs' ! _moduleName = 'SystemEvents' --- 177,299 ---- # _classdeclarations = { ! 'colr' : color, ! 'cwin' : window, ! 'capp' : application, ! 'cobj' : item, ! 'docu' : document, ! 'cha ' : character, ! 'atts' : attachment, ! 'cpar' : paragraph, ! 'cwor' : word, ! 'catr' : attribute_run, ! 'ctxt' : text, ! 'logi' : login_item, ! 'file' : file, ! 'alis' : alias, ! 'cobj' : item, ! 'cfol' : folder, ! 'cdis' : disk, ! 'scpt' : script, ! 'foac' : folder_action, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, ! 'cwin' : window, ! 'radB' : radio_button, ! 'list' : list, ! 'pcda' : desk_accessory_process, ! 'menI' : menu_item, ! 'proI' : progress_indicator, ! 'menE' : menu, ! 'menB' : menu_button, ! 'popB' : pop_up_button, ! 'incr' : incrementor, ! 'sheE' : sheet, ! 'tbar' : tool_bar, ! 'pcap' : application_process, ! 'txtf' : text_field, ! 'txta' : text_area, ! 'sliI' : slider, ! 'scra' : scroll_area, ! 'reli' : relevance_indicator, ! 'busi' : busy_indicator, ! 'crow' : row, ! 'prcs' : process, ! 'tabB' : table, ! 'outl' : outline, ! 'uiel' : UI_element, ! 'vali' : value_indicator, ! 'sysw' : system_wide_UI_element, ! 'butT' : button, ! 'capp' : application, ! 'rgrp' : radio_group, ! 'imaA' : image, ! 'tab ' : tab_group, ! 'mbar' : menu_bar, ! 'grow' : grow_area, ! 'chbx' : check_box, ! 'ccol' : column, ! 'sttx' : static_text, ! 'splg' : splitter_group, ! 'sgrp' : group, ! 'splr' : splitter, ! 'draA' : drawer, ! 'colW' : color_well, ! 'scrb' : scroll_bar, ! 'comB' : combo_box, ! 'broW' : browser, ! 'capp' : application, } class SystemEvents(Standard_Suite_Events, ! Text_Suite_Events, ! Disk_2d_Folder_2d_File_Suite_Events, ! Folder_Actions_Suite_Events, ! Login_Items_Suite_Events, ! Power_Suite_Events, ! Processes_Suite_Events, ! System_Events_Suite_Events, ! Hidden_Suite_Events, ! aetools.TalkTo): ! _signature = 'sevs' ! _moduleName = 'SystemEvents' From jackjansen@users.sourceforge.net Sat Apr 12 23:27:38 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bgenlocations.py,1.4,1.5 gensuitemodule.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv30892 Modified Files: bgenlocations.py gensuitemodule.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: bgenlocations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bgenlocations.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bgenlocations.py 9 Apr 2003 13:25:42 -0000 1.4 --- bgenlocations.py 12 Apr 2003 22:27:05 -0000 1.5 *************** *** 27,33 **** # if sys.platform == 'mac': ! _MWERKSDIR="Sap:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") --- 27,33 ---- # if sys.platform == 'mac': ! _MWERKSDIR="Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gensuitemodule.py 9 Apr 2003 13:25:42 -0000 1.6 --- gensuitemodule.py 12 Apr 2003 22:27:05 -0000 1.7 *************** *** 988,993 **** self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername)) else: - if self.hasname(pname): - pass if self.fp: self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname) --- 988,991 ---- *************** *** 1109,1132 **** self.fp.write("}\n") ! ## self.fp.write("\n_propdeclarations = {\n") ! ## proplist = self.namemappers[0].getall('property') ! ## proplist.sort() ! ## for k, v in proplist: ! ## self.fp.write(" %s : _Prop_%s,\n" % (`k`, v)) ! ## self.fp.write("}\n") ! ## ! ## self.fp.write("\n_compdeclarations = {\n") ! ## complist = self.namemappers[0].getall('comparison') ! ## complist.sort() ! ## for k, v in complist: ! ## self.fp.write(" %s : %s,\n" % (`k`, v)) ! ## self.fp.write("}\n") ! ## ! ## self.fp.write("\n_enumdeclarations = {\n") ! ## enumlist = self.namemappers[0].getall('enum') ! ## enumlist.sort() ! ## for k, v in enumlist: ! ## self.fp.write(" %s : %s,\n" % (`k`, v)) ! ## self.fp.write("}\n") def compiledata(data): --- 1107,1130 ---- self.fp.write("}\n") ! self.fp.write("\n_propdeclarations = {\n") ! proplist = self.namemappers[0].getall('property') ! proplist.sort() ! for k, v in proplist: ! self.fp.write(" %s : _Prop_%s,\n" % (`k`, v)) ! self.fp.write("}\n") ! ! self.fp.write("\n_compdeclarations = {\n") ! complist = self.namemappers[0].getall('comparison') ! complist.sort() ! for k, v in complist: ! self.fp.write(" %s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") ! ! self.fp.write("\n_enumdeclarations = {\n") ! enumlist = self.namemappers[0].getall('enum') ! enumlist.sort() ! for k, v in enumlist: ! self.fp.write(" %s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") def compiledata(data): From jackjansen@users.sourceforge.net Sat Apr 12 23:27:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.6,1.7 Metrowerks_Shell_Suite.py,1.6,1.7 Required.py,1.3,1.4 Standard_Suite.py,1.5,1.6 __init__.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CodeWarrior_suite.py 1 Apr 2003 22:04:25 -0000 1.6 --- CodeWarrior_suite.py 12 Apr 2003 22:27:05 -0000 1.7 *************** *** 13,319 **** class CodeWarrior_suite_Events: ! _argmap_add = { ! 'new' : 'kocl', ! 'with_data' : 'data', ! 'to_targets' : 'TTGT', ! 'to_group' : 'TGRP', ! } ! def add(self, _object, _attributes={}, **_arguments): [...1278 lines suppressed...] ! 'PRER' : _Prop_prerequisites, ! 'Path' : _Prop_path, ! 'PrjD' : _Prop_project_document, ! 'TrgT' : _Prop_target, ! 'WEAK' : _Prop_weak_link, ! 'c@#^' : _Prop_inherits, ! 'imod' : _Prop_modified, ! 'pnam' : _Prop_name, ! 'sele' : _Prop_selection, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { ! 'DKND' : _Enum_DKND, ! 'FTYP' : _Enum_FTYP, ! 'Inte' : _Enum_Inte, ! 'PERM' : _Enum_PERM, } Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Metrowerks_Shell_Suite.py 1 Apr 2003 22:04:26 -0000 1.6 --- Metrowerks_Shell_Suite.py 12 Apr 2003 22:27:05 -0000 1.7 *************** *** 13,944 **** class Metrowerks_Shell_Suite_Events: ! _argmap_Add_Files = { ! 'To_Segment' : 'Segm', ! } ! def Add_Files(self, _object, _attributes={}, **_arguments): ! """Add Files: Add the specified file(s) to the current project ! Required argument: List of files to add ! Keyword argument To_Segment: Segment number into which to add the file(s) [...4518 lines suppressed...] ! } ! ! _enumdeclarations = { ! 'Acce' : _Enum_Acce, ! 'BXbr' : _Enum_BXbr, ! 'DbSA' : _Enum_DbSA, ! 'DgBL' : _Enum_DgBL, ! 'ErrT' : _Enum_ErrT, ! 'Inte' : _Enum_Inte, ! 'Lang' : _Enum_Lang, ! 'PPrm' : _Enum_PPrm, ! 'PXdg' : _Enum_PXdg, ! 'PthF' : _Enum_PthF, ! 'RefP' : _Enum_RefP, ! 'STKd' : _Enum_STKd, ! 'SrcT' : _Enum_SrcT, ! 'TmpB' : _Enum_TmpB, ! 'TxtF' : _Enum_TxtF, ! 'savo' : _Enum_savo, } Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Required.py 1 Apr 2003 22:04:27 -0000 1.3 --- Required.py 12 Apr 2003 22:27:06 -0000 1.4 *************** *** 14,46 **** class Required_Events(Required_Suite_Events): ! _argmap_open = { ! 'converting' : 'Conv', ! } ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument converting: Whether to convert project to latest version (yes/no; default is ask). ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! aetools.keysubst(_arguments, self._argmap_open) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'Conv', _Enum_Conv) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_Conv = { ! 'yes' : 'yes ', # Convert the project if necessary on open ! 'no' : 'no ', # Do not convert the project if needed on open } --- 14,46 ---- class Required_Events(Required_Suite_Events): ! _argmap_open = { ! 'converting' : 'Conv', ! } ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument converting: Whether to convert project to latest version (yes/no; default is ask). ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! aetools.keysubst(_arguments, self._argmap_open) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'Conv', _Enum_Conv) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_Conv = { ! 'yes' : 'yes ', # Convert the project if necessary on open ! 'no' : 'no ', # Do not convert the project if needed on open } *************** *** 50,52 **** --- 50,62 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { + 'Conv' : _Enum_Conv, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 1 Apr 2003 22:04:28 -0000 1.5 --- Standard_Suite.py 12 Apr 2003 22:27:06 -0000 1.6 *************** *** 14,209 **** class Standard_Suite_Events(Standard_Suite_Events): ! _argmap_close = { ! 'saving' : 'savo', ! 'saving_in' : 'kfil', ! } ! def close(self, _object, _attributes={}, **_arguments): ! """close: close an object ! Required argument: the object to close ! Keyword argument saving: specifies whether or not changes should be saved before closing ! Keyword argument saving_in: the file in which to save the object ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'clos' ! aetools.keysubst(_arguments, self._argmap_close) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'savo', _Enum_savo) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_count = { ! 'each' : 'kocl', ! } ! def count(self, _object, _attributes={}, **_arguments): ! """count: return the number of elements of a particular class within an object ! Required argument: the object whose elements are to be counted ! Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the number of elements ! """ ! _code = 'core' ! _subcode = 'cnte' ! aetools.keysubst(_arguments, self._argmap_count) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_get = { ! 'as' : 'rtyp', ! } ! def get(self, _object, _attributes={}, **_arguments): ! """get: get the data for an object ! Required argument: the object whose data is to be returned ! Keyword argument as: the desired types for the data, in order of preference ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The data from the object ! """ ! _code = 'core' ! _subcode = 'getd' ! aetools.keysubst(_arguments, self._argmap_get) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_make = { ! 'new' : 'kocl', ! 'as' : 'rtyp', ! 'at' : 'insh', ! 'with_data' : 'data', ! 'with_properties' : 'prdt', ! } ! def make(self, _no_object=None, _attributes={}, **_arguments): ! """make: make a new element ! Keyword argument new: the class of the new element\xd1keyword 'new' is optional in AppleScript ! Keyword argument as: the desired types for the data, in order of preference ! Keyword argument at: the location at which to insert the element ! Keyword argument with_data: the initial data for the element ! Keyword argument with_properties: the initial values for the properties of the element ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the new object(s) ! """ ! _code = 'core' ! _subcode = 'crel' ! aetools.keysubst(_arguments, self._argmap_make) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def select(self, _object=None, _attributes={}, **_arguments): ! """select: select the specified object ! Required argument: the object to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_set = { ! 'to' : 'data', ! } ! def set(self, _object, _attributes={}, **_arguments): ! """set: set an object's data ! Required argument: the object to change ! Keyword argument to: the new value ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! aetools.keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - an application program """ ! want = 'capp' class _Prop_user_interaction(aetools.NProperty): ! """user interaction - user interaction level """ ! which = 'inte' ! want = 'Inte' # element 'cwin' as ['indx', 'name', 'rang'] # element 'docu' as ['indx', 'name', 'rang'] class character(aetools.ComponentItem): ! """character - a character """ ! want = 'cha ' class _Prop_length(aetools.NProperty): ! """length - length in characters of this object """ ! which = 'pLen' ! want = 'long' class _Prop_offset(aetools.NProperty): ! """offset - offset of a text object from the beginning of the document (first char has offset 1) """ ! which = 'pOff' ! want = 'long' class insertion_point(aetools.ComponentItem): ! """insertion point - An insertion location between two objects """ ! want = 'cins' class line(aetools.ComponentItem): ! """line - lines of text """ ! want = 'clin' class _Prop_index(aetools.NProperty): ! """index - index of a line object from the beginning of the document (first line has index 1) """ ! which = 'pidx' ! want = 'long' # element 'cha ' as ['indx', 'rang', 'rele'] --- 14,209 ---- class Standard_Suite_Events(Standard_Suite_Events): ! _argmap_close = { ! 'saving' : 'savo', ! 'saving_in' : 'kfil', ! } ! def close(self, _object, _attributes={}, **_arguments): ! """close: close an object ! Required argument: the object to close ! Keyword argument saving: specifies whether or not changes should be saved before closing ! Keyword argument saving_in: the file in which to save the object ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'clos' ! aetools.keysubst(_arguments, self._argmap_close) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'savo', _Enum_savo) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_count = { ! 'each' : 'kocl', ! } ! def count(self, _object, _attributes={}, **_arguments): ! """count: return the number of elements of a particular class within an object ! Required argument: the object whose elements are to be counted ! Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the number of elements ! """ ! _code = 'core' ! _subcode = 'cnte' ! aetools.keysubst(_arguments, self._argmap_count) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_get = { ! 'as' : 'rtyp', ! } ! def get(self, _object, _attributes={}, **_arguments): ! """get: get the data for an object ! Required argument: the object whose data is to be returned ! Keyword argument as: the desired types for the data, in order of preference ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The data from the object ! """ ! _code = 'core' ! _subcode = 'getd' ! aetools.keysubst(_arguments, self._argmap_get) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_make = { ! 'new' : 'kocl', ! 'as' : 'rtyp', ! 'at' : 'insh', ! 'with_data' : 'data', ! 'with_properties' : 'prdt', ! } ! def make(self, _no_object=None, _attributes={}, **_arguments): ! """make: make a new element ! Keyword argument new: the class of the new element\xd1keyword 'new' is optional in AppleScript ! Keyword argument as: the desired types for the data, in order of preference ! Keyword argument at: the location at which to insert the element ! Keyword argument with_data: the initial data for the element ! Keyword argument with_properties: the initial values for the properties of the element ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the new object(s) ! """ ! _code = 'core' ! _subcode = 'crel' ! aetools.keysubst(_arguments, self._argmap_make) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def select(self, _object=None, _attributes={}, **_arguments): ! """select: select the specified object ! Required argument: the object to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_set = { ! 'to' : 'data', ! } ! def set(self, _object, _attributes={}, **_arguments): ! """set: set an object's data ! Required argument: the object to change ! Keyword argument to: the new value ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! aetools.keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - an application program """ ! want = 'capp' class _Prop_user_interaction(aetools.NProperty): ! """user interaction - user interaction level """ ! which = 'inte' ! want = 'Inte' # element 'cwin' as ['indx', 'name', 'rang'] # element 'docu' as ['indx', 'name', 'rang'] class character(aetools.ComponentItem): ! """character - a character """ ! want = 'cha ' class _Prop_length(aetools.NProperty): ! """length - length in characters of this object """ ! which = 'pLen' ! want = 'long' class _Prop_offset(aetools.NProperty): ! """offset - offset of a text object from the beginning of the document (first char has offset 1) """ ! which = 'pOff' ! want = 'long' class insertion_point(aetools.ComponentItem): ! """insertion point - An insertion location between two objects """ ! want = 'cins' class line(aetools.ComponentItem): ! """line - lines of text """ ! want = 'clin' class _Prop_index(aetools.NProperty): ! """index - index of a line object from the beginning of the document (first line has index 1) """ ! which = 'pidx' ! want = 'long' # element 'cha ' as ['indx', 'rang', 'rele'] *************** *** 211,220 **** class selection_2d_object(aetools.ComponentItem): ! """selection-object - the selection visible to the user """ ! want = 'csel' class _Prop_contents(aetools.NProperty): ! """contents - the contents of the selection """ ! which = 'pcnt' ! want = 'type' # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'clin' as ['indx', 'rang', 'rele'] --- 211,220 ---- class selection_2d_object(aetools.ComponentItem): ! """selection-object - the selection visible to the user """ ! want = 'csel' class _Prop_contents(aetools.NProperty): ! """contents - the contents of the selection """ ! which = 'pcnt' ! want = 'type' # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'clin' as ['indx', 'rang', 'rele'] *************** *** 222,227 **** class text(aetools.ComponentItem): ! """text - Text """ ! want = 'ctxt' # element 'cha ' as ['indx', 'rele', 'rang'] # element 'cins' as ['rele'] --- 222,227 ---- class text(aetools.ComponentItem): ! """text - Text """ ! want = 'ctxt' # element 'cha ' as ['indx', 'rele', 'rang'] # element 'cins' as ['rele'] *************** *** 230,301 **** class window(aetools.ComponentItem): ! """window - A window """ ! want = 'cwin' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_document(aetools.NProperty): ! """document - the document that owns this window """ ! which = 'docu' ! want = 'docu' class _Prop_name(aetools.NProperty): ! """name - the title of the window """ ! which = 'pnam' ! want = 'itxt' class _Prop_position(aetools.NProperty): ! """position - upper left coordinates of window """ ! which = 'ppos' ! want = 'QDpt' class _Prop_visible(aetools.NProperty): ! """visible - is the window visible? """ ! which = 'pvis' ! want = 'bool' class _Prop_zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' windows = window class document(aetools.ComponentItem): ! """document - a document """ ! want = 'docu' class _Prop_file_permissions(aetools.NProperty): ! """file permissions - the file permissions for the document """ ! which = 'PERM' ! want = 'PERM' class _Prop_kind(aetools.NProperty): ! """kind - the kind of document """ ! which = 'DKND' ! want = 'DKND' class _Prop_location(aetools.NProperty): ! """location - the file of the document """ ! which = 'FILE' ! want = 'fss ' class _Prop_window(aetools.NProperty): ! """window - the window of the document. """ ! which = 'cwin' ! want = 'cwin' documents = document class files(aetools.ComponentItem): ! """files - Every file """ ! want = 'file' file = files application._superclassnames = [] application._privpropdict = { ! 'user_interaction' : _Prop_user_interaction, } application._privelemdict = { ! 'document' : document, ! 'window' : window, } character._superclassnames = [] character._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } character._privelemdict = { --- 230,301 ---- class window(aetools.ComponentItem): ! """window - A window """ ! want = 'cwin' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_document(aetools.NProperty): ! """document - the document that owns this window """ ! which = 'docu' ! want = 'docu' class _Prop_name(aetools.NProperty): ! """name - the title of the window """ ! which = 'pnam' ! want = 'itxt' class _Prop_position(aetools.NProperty): ! """position - upper left coordinates of window """ ! which = 'ppos' ! want = 'QDpt' class _Prop_visible(aetools.NProperty): ! """visible - is the window visible? """ ! which = 'pvis' ! want = 'bool' class _Prop_zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' windows = window class document(aetools.ComponentItem): ! """document - a document """ ! want = 'docu' class _Prop_file_permissions(aetools.NProperty): ! """file permissions - the file permissions for the document """ ! which = 'PERM' ! want = 'PERM' class _Prop_kind(aetools.NProperty): ! """kind - the kind of document """ ! which = 'DKND' ! want = 'DKND' class _Prop_location(aetools.NProperty): ! """location - the file of the document """ ! which = 'FILE' ! want = 'fss ' class _Prop_window(aetools.NProperty): ! """window - the window of the document. """ ! which = 'cwin' ! want = 'cwin' documents = document class files(aetools.ComponentItem): ! """files - Every file """ ! want = 'file' file = files application._superclassnames = [] application._privpropdict = { ! 'user_interaction' : _Prop_user_interaction, } application._privelemdict = { ! 'document' : document, ! 'window' : window, } character._superclassnames = [] character._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } character._privelemdict = { *************** *** 303,308 **** insertion_point._superclassnames = [] insertion_point._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } insertion_point._privelemdict = { --- 303,308 ---- insertion_point._superclassnames = [] insertion_point._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } insertion_point._privelemdict = { *************** *** 310,351 **** line._superclassnames = [] line._privpropdict = { ! 'index' : _Prop_index, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } line._privelemdict = { ! 'character' : character, } selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : _Prop_contents, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } selection_2d_object._privelemdict = { ! 'character' : character, ! 'line' : line, ! 'text' : text, } text._superclassnames = [] text._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } text._privelemdict = { ! 'character' : character, ! 'insertion_point' : insertion_point, ! 'line' : line, ! 'text' : text, } window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'document' : _Prop_document, ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'visible' : _Prop_visible, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { --- 310,351 ---- line._superclassnames = [] line._privpropdict = { ! 'index' : _Prop_index, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } line._privelemdict = { ! 'character' : character, } selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : _Prop_contents, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } selection_2d_object._privelemdict = { ! 'character' : character, ! 'line' : line, ! 'text' : text, } text._superclassnames = [] text._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } text._privelemdict = { ! 'character' : character, ! 'insertion_point' : insertion_point, ! 'line' : line, ! 'text' : text, } window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'document' : _Prop_document, ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'visible' : _Prop_visible, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 353,362 **** document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : _Prop_file_permissions, ! 'index' : _Prop_index, ! 'kind' : _Prop_kind, ! 'location' : _Prop_location, ! 'name' : _Prop_name, ! 'window' : _Prop_window, } document._privelemdict = { --- 353,362 ---- document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : _Prop_file_permissions, ! 'index' : _Prop_index, ! 'kind' : _Prop_kind, ! 'location' : _Prop_location, ! 'name' : _Prop_name, ! 'window' : _Prop_window, } document._privelemdict = { *************** *** 372,383 **** # _classdeclarations = { ! 'capp' : application, ! 'cha ' : character, ! 'cins' : insertion_point, ! 'clin' : line, ! 'csel' : selection_2d_object, ! 'ctxt' : text, ! 'cwin' : window, ! 'docu' : document, ! 'file' : files, } --- 372,407 ---- # _classdeclarations = { ! 'capp' : application, ! 'cha ' : character, ! 'cins' : insertion_point, ! 'clin' : line, ! 'csel' : selection_2d_object, ! 'ctxt' : text, ! 'cwin' : window, ! 'docu' : document, ! 'file' : files, ! } ! ! _propdeclarations = { ! 'DKND' : _Prop_kind, ! 'FILE' : _Prop_location, ! 'PERM' : _Prop_file_permissions, ! 'cwin' : _Prop_window, ! 'docu' : _Prop_document, ! 'inte' : _Prop_user_interaction, ! 'pLen' : _Prop_length, ! 'pOff' : _Prop_offset, ! 'pbnd' : _Prop_bounds, ! 'pcnt' : _Prop_contents, ! 'pidx' : _Prop_index, ! 'pnam' : _Prop_name, ! 'ppos' : _Prop_position, ! 'pvis' : _Prop_visible, ! 'pzum' : _Prop_zoomed, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 1 Apr 2003 22:04:29 -0000 1.7 --- __init__.py 12 Apr 2003 22:27:06 -0000 1.8 *************** *** 11,18 **** _code_to_module = { ! 'CWIE' : CodeWarrior_suite, ! 'CoRe' : Standard_Suite, ! 'MMPR' : Metrowerks_Shell_Suite, ! 'reqd' : Required, } --- 11,18 ---- _code_to_module = { ! 'CWIE' : CodeWarrior_suite, ! 'CoRe' : Standard_Suite, ! 'MMPR' : Metrowerks_Shell_Suite, ! 'reqd' : Required, } *************** *** 20,27 **** _code_to_fullname = { ! 'CWIE' : ('CodeWarrior.CodeWarrior_suite', 'CodeWarrior_suite'), ! 'CoRe' : ('CodeWarrior.Standard_Suite', 'Standard_Suite'), ! 'MMPR' : ('CodeWarrior.Metrowerks_Shell_Suite', 'Metrowerks_Shell_Suite'), ! 'reqd' : ('CodeWarrior.Required', 'Required'), } --- 20,27 ---- _code_to_fullname = { ! 'CWIE' : ('CodeWarrior.CodeWarrior_suite', 'CodeWarrior_suite'), ! 'CoRe' : ('CodeWarrior.Standard_Suite', 'Standard_Suite'), ! 'MMPR' : ('CodeWarrior.Metrowerks_Shell_Suite', 'Metrowerks_Shell_Suite'), ! 'reqd' : ('CodeWarrior.Required', 'Required'), } *************** *** 32,45 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 32,45 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 48,60 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(character) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) getbaseclasses(single_class_browser) getbaseclasses(project_document) --- 48,51 ---- *************** *** 110,113 **** --- 101,113 ---- getbaseclasses(Debugger_Display) getbaseclasses(class_) + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) # *************** *** 115,190 **** # _classdeclarations = { ! 'cha ' : character, ! 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'clin' : line, ! 'csel' : selection_2d_object, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, ! '1BRW' : single_class_browser, ! 'PRJD' : project_document, ! 'SYMB' : symbol_browser, ! 'EDIT' : editor_document, ! 'COMP' : file_compare_document, ! 'BROW' : class_browser, ! 'SBTG' : subtarget, ! 'MSSG' : message_document, ! 'INSP' : project_inspector, ! 'TXTD' : text_document, ! 'CTLG' : catalog_document, ! 'HIER' : class_hierarchy, ! 'TRGT' : target, ! 'PRGS' : build_progress_document, ! 'SRCF' : target_file, ! 'TOOL' : ToolServer_worksheet, ! '1HIR' : single_class_hierarchy, ! 'FMap' : File_Mapping, ! 'Cata' : browser_catalog, ! 'BSTG' : Build_Settings, ! 'SrcF' : ProjectFile, ! 'BRKW' : Browser_Coloring, ! 'ErrM' : Error_Information, ! 'VCSs' : VCS_Setup, ! 'EDTR' : Editor, ! 'SHFL' : Shielded_Folders, ! 'SFit' : Shielded_Folder, ! 'CUKW' : Custom_Keywords, ! 'PInf' : Path_Information, ! 'FLMP' : File_Mappings, ! 'Seg ' : Segment, ! 'DbTG' : Debugger_Target, ! 'FDef' : Function_Information, ! 'PATH' : Access_Paths, ! 'GXTR' : Extras, ! 'DbWN' : Debugger_Windowing, ! 'GSTs' : Global_Source_Trees, ! 'SNTX' : Syntax_Coloring, ! 'BsCl' : base_class, ! 'RlPt' : Relative_Path, ! 'TARG' : Target_Settings, ! 'EnvV' : Environment_Variable, ! 'SrcT' : Source_Tree, ! 'DbGL' : Debugger_Global, ! 'MbFn' : member_function, ! 'RSTG' : Runtime_Settings, ! 'PSTG' : Plugin_Settings, ! 'DtMb' : data_member, ! 'LXTR' : Build_Extras, ! 'mFNT' : Font, ! 'TSTs' : Target_Source_Trees, ! 'DbDS' : Debugger_Display, ! 'Clas' : class_, } class CodeWarrior(CodeWarrior_suite_Events, ! Standard_Suite_Events, ! Metrowerks_Shell_Suite_Events, ! Required_Events, ! aetools.TalkTo): ! _signature = 'CWIE' ! _moduleName = 'CodeWarrior' --- 115,190 ---- # _classdeclarations = { ! '1BRW' : single_class_browser, ! 'PRJD' : project_document, ! 'SYMB' : symbol_browser, ! 'EDIT' : editor_document, ! 'COMP' : file_compare_document, ! 'BROW' : class_browser, ! 'SBTG' : subtarget, ! 'MSSG' : message_document, ! 'INSP' : project_inspector, ! 'TXTD' : text_document, ! 'CTLG' : catalog_document, ! 'HIER' : class_hierarchy, ! 'TRGT' : target, ! 'PRGS' : build_progress_document, ! 'SRCF' : target_file, ! 'TOOL' : ToolServer_worksheet, ! '1HIR' : single_class_hierarchy, ! 'FMap' : File_Mapping, ! 'Cata' : browser_catalog, ! 'BSTG' : Build_Settings, ! 'SrcF' : ProjectFile, ! 'BRKW' : Browser_Coloring, ! 'ErrM' : Error_Information, ! 'VCSs' : VCS_Setup, ! 'EDTR' : Editor, ! 'SHFL' : Shielded_Folders, ! 'SFit' : Shielded_Folder, ! 'CUKW' : Custom_Keywords, ! 'PInf' : Path_Information, ! 'FLMP' : File_Mappings, ! 'Seg ' : Segment, ! 'DbTG' : Debugger_Target, ! 'FDef' : Function_Information, ! 'PATH' : Access_Paths, ! 'GXTR' : Extras, ! 'DbWN' : Debugger_Windowing, ! 'GSTs' : Global_Source_Trees, ! 'SNTX' : Syntax_Coloring, ! 'BsCl' : base_class, ! 'RlPt' : Relative_Path, ! 'TARG' : Target_Settings, ! 'EnvV' : Environment_Variable, ! 'SrcT' : Source_Tree, ! 'DbGL' : Debugger_Global, ! 'MbFn' : member_function, ! 'RSTG' : Runtime_Settings, ! 'PSTG' : Plugin_Settings, ! 'DtMb' : data_member, ! 'LXTR' : Build_Extras, ! 'mFNT' : Font, ! 'TSTs' : Target_Source_Trees, ! 'DbDS' : Debugger_Display, ! 'Clas' : class_, ! 'cha ' : character, ! 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'clin' : line, ! 'csel' : selection_2d_object, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, } class CodeWarrior(CodeWarrior_suite_Events, ! Standard_Suite_Events, ! Metrowerks_Shell_Suite_Events, ! Required_Events, ! aetools.TalkTo): ! _signature = 'CWIE' ! _moduleName = 'CodeWarrior' From jackjansen@users.sourceforge.net Sat Apr 12 23:27:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.5,1.6 Netscape_Suite.py,1.4,1.5 Required_Suite.py,1.5,1.6 Standard_Suite.py,1.4,1.5 URL_Suite.py,1.4,1.5 Web_Browser_Suite.py,1.5,1.6 __init__.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/Explorer Modified Files: Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py Standard_Suite.py URL_Suite.py Web_Browser_Suite.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Microsoft_Internet_Explorer.py 1 Apr 2003 22:04:31 -0000 1.5 --- Microsoft_Internet_Explorer.py 12 Apr 2003 22:27:06 -0000 1.6 *************** *** 13,82 **** class Microsoft_Internet_Explorer_Events: ! def GetSource(self, _object=None, _attributes={}, **_arguments): ! """GetSource: Get the HTML source of a browser window ! Required argument: Window Identifier of window from which to get the source. No value means get the source from the frontmost window. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'TEXT' ! """ ! _code = 'MSIE' ! _subcode = 'SORC' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def PrintBrowserWindow(self, _object=None, _attributes={}, **_arguments): ! """PrintBrowserWindow: Print contents of browser window (HTML) ! Required argument: Window Identifier of the window to print. No value means print the frontmost browser window. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'pWND' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_do_script = { ! 'window' : 'WIND', ! } ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Execute script commands ! Required argument: JavaScript text to execute ! Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Return value ! """ ! _code = 'misc' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,82 ---- class Microsoft_Internet_Explorer_Events: ! def GetSource(self, _object=None, _attributes={}, **_arguments): ! """GetSource: Get the HTML source of a browser window ! Required argument: Window Identifier of window from which to get the source. No value means get the source from the frontmost window. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'TEXT' ! """ ! _code = 'MSIE' ! _subcode = 'SORC' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def PrintBrowserWindow(self, _object=None, _attributes={}, **_arguments): ! """PrintBrowserWindow: Print contents of browser window (HTML) ! Required argument: Window Identifier of the window to print. No value means print the frontmost browser window. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'pWND' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_do_script = { ! 'window' : 'WIND', ! } ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Execute script commands ! Required argument: JavaScript text to execute ! Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Return value ! """ ! _code = 'misc' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 85,87 **** --- 85,96 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Netscape_Suite.py 1 Apr 2003 22:04:32 -0000 1.4 --- Netscape_Suite.py 12 Apr 2003 22:27:06 -0000 1.5 *************** *** 13,35 **** class Netscape_Suite_Events: ! def Open_bookmark(self, _object=None, _attributes={}, **_arguments): ! """Open bookmark: Opens a bookmark file ! Required argument: If not available, reloads the current bookmark file ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'book' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,35 ---- class Netscape_Suite_Events: ! def Open_bookmark(self, _object=None, _attributes={}, **_arguments): ! """Open bookmark: Opens a bookmark file ! Required argument: If not available, reloads the current bookmark file ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'MOSS' ! _subcode = 'book' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 38,40 **** --- 38,49 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Required_Suite.py 1 Apr 2003 22:04:33 -0000 1.5 --- Required_Suite.py 12 Apr 2003 22:27:06 -0000 1.6 *************** *** 14,94 **** class Required_Suite_Events(Required_Suite_Events): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open documents ! Required argument: undocumented, typecode 'alis' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print documents ! Required argument: undocumented, typecode 'alis' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'pdoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'oapp' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 14,94 ---- class Required_Suite_Events(Required_Suite_Events): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open documents ! Required argument: undocumented, typecode 'alis' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print documents ! Required argument: undocumented, typecode 'alis' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'pdoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'oapp' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 97,99 **** --- 97,108 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 1 Apr 2003 22:04:34 -0000 1.4 --- Standard_Suite.py 12 Apr 2003 22:27:06 -0000 1.5 *************** *** 13,53 **** class Standard_Suite_Events: ! _argmap_get = { ! 'as' : 'rtyp', ! } ! def get(self, _object, _attributes={}, **_arguments): ! """get: ! Required argument: an AE object reference ! Keyword argument as: undocumented, typecode 'type' ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: anything ! """ ! _code = 'core' ! _subcode = 'getd' ! aetools.keysubst(_arguments, self._argmap_get) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - An application program """ ! want = 'capp' class _Prop_selected_text(aetools.NProperty): ! """selected text - the selected text """ ! which = 'stxt' ! want = 'TEXT' application._superclassnames = [] application._privpropdict = { ! 'selected_text' : _Prop_selected_text, } application._privelemdict = { --- 13,53 ---- class Standard_Suite_Events: ! _argmap_get = { ! 'as' : 'rtyp', ! } ! def get(self, _object, _attributes={}, **_arguments): ! """get: ! Required argument: an AE object reference ! Keyword argument as: undocumented, typecode 'type' ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: anything ! """ ! _code = 'core' ! _subcode = 'getd' ! aetools.keysubst(_arguments, self._argmap_get) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - An application program """ ! want = 'capp' class _Prop_selected_text(aetools.NProperty): ! """selected text - the selected text """ ! which = 'stxt' ! want = 'TEXT' application._superclassnames = [] application._privpropdict = { ! 'selected_text' : _Prop_selected_text, } application._privelemdict = { *************** *** 58,61 **** # _classdeclarations = { ! 'capp' : application, } --- 58,71 ---- # _classdeclarations = { ! 'capp' : application, ! } ! ! _propdeclarations = { ! 'stxt' : _Prop_selected_text, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** URL_Suite.py 1 Apr 2003 22:04:34 -0000 1.4 --- URL_Suite.py 12 Apr 2003 22:27:06 -0000 1.5 *************** *** 13,40 **** class URL_Suite_Events: ! _argmap_GetURL = { ! 'to' : 'dest', ! } ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Open the URL (and optionally save it to disk) ! Required argument: URL to open ! Keyword argument to: File into which to save resource located at URL. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'GURL' ! _subcode = 'GURL' ! aetools.keysubst(_arguments, self._argmap_GetURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,40 ---- class URL_Suite_Events: ! _argmap_GetURL = { ! 'to' : 'dest', ! } ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Open the URL (and optionally save it to disk) ! Required argument: URL to open ! Keyword argument to: File into which to save resource located at URL. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'GURL' ! _subcode = 'GURL' ! aetools.keysubst(_arguments, self._argmap_GetURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 43,45 **** --- 43,54 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Web_Browser_Suite.py 1 Apr 2003 22:04:34 -0000 1.5 --- Web_Browser_Suite.py 12 Apr 2003 22:27:06 -0000 1.6 *************** *** 13,212 **** class Web_Browser_Suite_Events: ! def Activate(self, _object=None, _attributes={}, **_arguments): ! """Activate: Activate Internet Explorer and optionally select window designated by Window Identifier. ! Required argument: Window Identifier ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Window Identifier of window to activate ! """ ! _code = 'WWW!' ! _subcode = 'ACTV' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): ! """CloseAllWindows: Closes all windows ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'CLSA' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_CloseWindow = { ! 'ID' : 'WIND', ! 'Title' : 'TITL', ! } ! def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): ! """CloseWindow: Close the window specified by either Window Identifier or Title. If no parameter is specified, close the top window. ! Keyword argument ID: ID of the window to close. (Can use -1 for top window) ! Keyword argument Title: Title of the window to close ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'CLOS' ! aetools.keysubst(_arguments, self._argmap_CloseWindow) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def GetWindowInfo(self, _object, _attributes={}, **_arguments): ! """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. ! Required argument: Window Identifier of the window ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: ! """ ! _code = 'WWW!' ! _subcode = 'WNFO' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def ListWindows(self, _no_object=None, _attributes={}, **_arguments): ! """ListWindows: Returns list of Window Identifiers for all open windows. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'list' ! """ ! _code = 'WWW!' ! _subcode = 'LSTW' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_OpenURL = { ! 'to' : 'INTO', ! 'toWindow' : 'WIND', ! 'Flags' : 'FLGS', ! 'FormData' : 'POST', ! 'MIME_Type' : 'MIME', ! } ! def OpenURL(self, _object, _attributes={}, **_arguments): ! """OpenURL: Retrieves URL off the Web. ! Required argument: Fully-qualified URL ! Keyword argument to: Target file for saving downloaded data ! Keyword argument toWindow: Target window for resource at URL (-1 for top window, 0 for new window) ! Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. ! Keyword argument FormData: data to post ! Keyword argument MIME_Type: MIME type of data being posted ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'OURL' ! aetools.keysubst(_arguments, self._argmap_OpenURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_ParseAnchor = { ! 'withURL' : 'RELA', ! } ! def ParseAnchor(self, _object, _attributes={}, **_arguments): ! """ParseAnchor: Combines a base URL and a relative URL to produce a fully-qualified URL ! Required argument: Base URL ! Keyword argument withURL: Relative URL that is combined with the Base URL (in the direct object) to produce a fully-qualified URL. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Fully-qualified URL ! """ ! _code = 'WWW!' ! _subcode = 'PRSA' ! aetools.keysubst(_arguments, self._argmap_ParseAnchor) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_ShowFile = { ! 'MIME_Type' : 'MIME', ! 'Window_Identifier' : 'WIND', ! 'URL' : 'URL ', ! } ! def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: FileSpec containing data of specified MIME type to be rendered in window specified by Window Identifier. ! Required argument: The file ! Keyword argument MIME_Type: MIME type ! Keyword argument Window_Identifier: Identifier of the target window for the URL. (Can use -1 for top window) ! Keyword argument URL: URL that allows this document to be reloaded. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'SHWF' ! aetools.keysubst(_arguments, self._argmap_ShowFile) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] --- 13,212 ---- class Web_Browser_Suite_Events: ! def Activate(self, _object=None, _attributes={}, **_arguments): ! """Activate: Activate Internet Explorer and optionally select window designated by Window Identifier. ! Required argument: Window Identifier ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Window Identifier of window to activate ! """ ! _code = 'WWW!' ! _subcode = 'ACTV' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): ! """CloseAllWindows: Closes all windows ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'CLSA' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_CloseWindow = { ! 'ID' : 'WIND', ! 'Title' : 'TITL', ! } ! def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): ! """CloseWindow: Close the window specified by either Window Identifier or Title. If no parameter is specified, close the top window. ! Keyword argument ID: ID of the window to close. (Can use -1 for top window) ! Keyword argument Title: Title of the window to close ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'CLOS' ! aetools.keysubst(_arguments, self._argmap_CloseWindow) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def GetWindowInfo(self, _object, _attributes={}, **_arguments): ! """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. ! Required argument: Window Identifier of the window ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: ! """ ! _code = 'WWW!' ! _subcode = 'WNFO' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def ListWindows(self, _no_object=None, _attributes={}, **_arguments): ! """ListWindows: Returns list of Window Identifiers for all open windows. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'list' ! """ ! _code = 'WWW!' ! _subcode = 'LSTW' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_OpenURL = { ! 'to' : 'INTO', ! 'toWindow' : 'WIND', ! 'Flags' : 'FLGS', ! 'FormData' : 'POST', ! 'MIME_Type' : 'MIME', ! } ! def OpenURL(self, _object, _attributes={}, **_arguments): ! """OpenURL: Retrieves URL off the Web. ! Required argument: Fully-qualified URL ! Keyword argument to: Target file for saving downloaded data ! Keyword argument toWindow: Target window for resource at URL (-1 for top window, 0 for new window) ! Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. ! Keyword argument FormData: data to post ! Keyword argument MIME_Type: MIME type of data being posted ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'OURL' ! aetools.keysubst(_arguments, self._argmap_OpenURL) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_ParseAnchor = { ! 'withURL' : 'RELA', ! } ! def ParseAnchor(self, _object, _attributes={}, **_arguments): ! """ParseAnchor: Combines a base URL and a relative URL to produce a fully-qualified URL ! Required argument: Base URL ! Keyword argument withURL: Relative URL that is combined with the Base URL (in the direct object) to produce a fully-qualified URL. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Fully-qualified URL ! """ ! _code = 'WWW!' ! _subcode = 'PRSA' ! aetools.keysubst(_arguments, self._argmap_ParseAnchor) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_ShowFile = { ! 'MIME_Type' : 'MIME', ! 'Window_Identifier' : 'WIND', ! 'URL' : 'URL ', ! } ! def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: FileSpec containing data of specified MIME type to be rendered in window specified by Window Identifier. ! Required argument: The file ! Keyword argument MIME_Type: MIME type ! Keyword argument Window_Identifier: Identifier of the target window for the URL. (Can use -1 for top window) ! Keyword argument URL: URL that allows this document to be reloaded. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'SHWF' ! aetools.keysubst(_arguments, self._argmap_ShowFile) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 215,217 **** --- 215,226 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 29 Mar 2003 00:13:12 -0000 1.4 --- __init__.py 12 Apr 2003 22:27:07 -0000 1.5 *************** *** 13,22 **** _code_to_module = { ! '****' : Standard_Suite, ! 'GURL' : URL_Suite, ! 'MOSS' : Netscape_Suite, ! 'MSIE' : Microsoft_Internet_Explorer, ! 'WWW!' : Web_Browser_Suite, ! 'reqd' : Required_Suite, } --- 13,22 ---- _code_to_module = { ! '****' : Standard_Suite, ! 'GURL' : URL_Suite, ! 'MOSS' : Netscape_Suite, ! 'MSIE' : Microsoft_Internet_Explorer, ! 'WWW!' : Web_Browser_Suite, ! 'reqd' : Required_Suite, } *************** *** 24,33 **** _code_to_fullname = { ! '****' : ('Explorer.Standard_Suite', 'Standard_Suite'), ! 'GURL' : ('Explorer.URL_Suite', 'URL_Suite'), ! 'MOSS' : ('Explorer.Netscape_Suite', 'Netscape_Suite'), ! 'MSIE' : ('Explorer.Microsoft_Internet_Explorer', 'Microsoft_Internet_Explorer'), ! 'WWW!' : ('Explorer.Web_Browser_Suite', 'Web_Browser_Suite'), ! 'reqd' : ('Explorer.Required_Suite', 'Required_Suite'), } --- 24,33 ---- _code_to_fullname = { ! '****' : ('Explorer.Standard_Suite', 'Standard_Suite'), ! 'GURL' : ('Explorer.URL_Suite', 'URL_Suite'), ! 'MOSS' : ('Explorer.Netscape_Suite', 'Netscape_Suite'), ! 'MSIE' : ('Explorer.Microsoft_Internet_Explorer', 'Microsoft_Internet_Explorer'), ! 'WWW!' : ('Explorer.Web_Browser_Suite', 'Web_Browser_Suite'), ! 'reqd' : ('Explorer.Required_Suite', 'Required_Suite'), } *************** *** 40,53 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 40,53 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 62,78 **** # _classdeclarations = { ! 'capp' : application, } class Explorer(Standard_Suite_Events, ! URL_Suite_Events, ! Netscape_Suite_Events, ! Microsoft_Internet_Explorer_Events, ! Web_Browser_Suite_Events, ! Required_Suite_Events, ! aetools.TalkTo): ! _signature = 'MSIE' ! _moduleName = 'Explorer' --- 62,78 ---- # _classdeclarations = { ! 'capp' : application, } class Explorer(Standard_Suite_Events, ! URL_Suite_Events, ! Netscape_Suite_Events, ! Microsoft_Internet_Explorer_Events, ! Web_Browser_Suite_Events, ! Required_Suite_Events, ! aetools.TalkTo): ! _signature = 'MSIE' ! _moduleName = 'Explorer' From jackjansen@users.sourceforge.net Sat Apr 12 23:27:42 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 12 Apr 2003 15:27:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Containers_and_folders.py,1.7,1.8 Enumerations.py,1.6,1.7 Files.py,1.2,1.3 Finder_Basics.py,1.5,1.6 Finder_items.py,1.5,1.6 Legacy_suite.py,1.2,1.3 Standard_Suite.py,1.5,1.6 Type_Definitions.py,1.7,1.8 Window_classes.py,1.7,1.8 __init__.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv30892/lib-scriptpackages/Finder Modified Files: Containers_and_folders.py Enumerations.py Files.py Finder_Basics.py Finder_items.py Legacy_suite.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Log Message: Oops, _propdeclarations and friends are needed: gensuitemodule uses them to lookup properties declared in base classes. Looking at it I'm not sure what the official scope if the property codes is, maybe it is only the (OSA) class in which they are used. But giving them global scope hasn't been a problem so far. Regenerated the standard suites, which are now also space-indented. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Containers_and_folders.py 1 Apr 2003 22:04:35 -0000 1.7 --- Containers_and_folders.py 12 Apr 2003 22:27:07 -0000 1.8 *************** *** 13,54 **** class Containers_and_folders_Events: ! pass class disk(aetools.ComponentItem): ! """disk - A disk """ ! want = 'cdis' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the container class """ ! which = 'c@#^' ! want = 'ctnr' class _Prop_capacity(aetools.NProperty): ! """capacity - the total number of bytes (free or used) on the disk """ ! which = 'capa' ! want = 'comp' class _Prop_ejectable(aetools.NProperty): ! """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ ! which = 'isej' ! want = 'bool' class _Prop_format(aetools.NProperty): ! """format - the filesystem format of this disk """ ! which = 'dfmt' ! want = 'edfm' class _Prop_free_space(aetools.NProperty): ! """free space - the number of free bytes left on the disk """ ! which = 'frsp' ! want = 'comp' class _Prop_ignore_privileges(aetools.NProperty): ! """ignore privileges - Ignore permissions on this disk? """ ! which = 'igpr' ! want = 'bool' class _Prop_local_volume(aetools.NProperty): ! """local volume - Is the media a local volume (as opposed to a file server)? """ ! which = 'isrv' ! want = 'bool' class _Prop_startup(aetools.NProperty): ! """startup - Is this disk the boot disk? """ ! which = 'istd' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 13,54 ---- class Containers_and_folders_Events: ! pass class disk(aetools.ComponentItem): ! """disk - A disk """ ! want = 'cdis' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the container class """ ! which = 'c@#^' ! want = 'ctnr' class _Prop_capacity(aetools.NProperty): ! """capacity - the total number of bytes (free or used) on the disk """ ! which = 'capa' ! want = 'comp' class _Prop_ejectable(aetools.NProperty): ! """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ ! which = 'isej' ! want = 'bool' class _Prop_format(aetools.NProperty): ! """format - the filesystem format of this disk """ ! which = 'dfmt' ! want = 'edfm' class _Prop_free_space(aetools.NProperty): ! """free space - the number of free bytes left on the disk """ ! which = 'frsp' ! want = 'comp' class _Prop_ignore_privileges(aetools.NProperty): ! """ignore privileges - Ignore permissions on this disk? """ ! which = 'igpr' ! want = 'bool' class _Prop_local_volume(aetools.NProperty): ! """local volume - Is the media a local volume (as opposed to a file server)? """ ! which = 'isrv' ! want = 'bool' class _Prop_startup(aetools.NProperty): ! """startup - Is this disk the boot disk? """ ! which = 'istd' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 65,70 **** class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ ! want = 'cdsk' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 65,70 ---- class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ ! want = 'cdsk' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 80,85 **** class folder(aetools.ComponentItem): ! """folder - A folder """ ! want = 'cfol' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 80,85 ---- class folder(aetools.ComponentItem): ! """folder - A folder """ ! want = 'cfol' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 96,121 **** class container(aetools.ComponentItem): ! """container - An item that contains other items """ ! want = 'ctnr' class _Prop_completely_expanded(aetools.NProperty): ! """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ ! which = 'pexc' ! want = 'bool' class _Prop_container_window(aetools.NProperty): ! """container window - the container window for this folder """ ! which = 'cwnd' ! want = 'obj ' class _Prop_entire_contents(aetools.NProperty): ! """entire contents - the entire contents of the container, including the contents of its children """ ! which = 'ects' ! want = 'obj ' class _Prop_expandable(aetools.NProperty): ! """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ ! which = 'pexa' ! want = 'bool' class _Prop_expanded(aetools.NProperty): ! """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ ! which = 'pexp' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 96,121 ---- class container(aetools.ComponentItem): ! """container - An item that contains other items """ ! want = 'ctnr' class _Prop_completely_expanded(aetools.NProperty): ! """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ ! which = 'pexc' ! want = 'bool' class _Prop_container_window(aetools.NProperty): ! """container window - the container window for this folder """ ! which = 'cwnd' ! want = 'obj ' class _Prop_entire_contents(aetools.NProperty): ! """entire contents - the entire contents of the container, including the contents of its children """ ! which = 'ects' ! want = 'obj ' class _Prop_expandable(aetools.NProperty): ! """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ ! which = 'pexa' ! want = 'bool' class _Prop_expanded(aetools.NProperty): ! """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ ! which = 'pexp' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 132,141 **** class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ ! want = 'ctrs' class _Prop_warns_before_emptying(aetools.NProperty): ! """warns before emptying - Display a dialog when emptying the trash? """ ! which = 'warn' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 132,141 ---- class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ ! want = 'ctrs' class _Prop_warns_before_emptying(aetools.NProperty): ! """warns before emptying - Display a dialog when emptying the trash? """ ! which = 'warn' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 152,246 **** import Finder_items disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'startup' : _Prop_startup, } disk._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'disk' : disk, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } folder._superclassnames = ['container'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } folder._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } container._superclassnames = ['item'] container._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'completely_expanded' : _Prop_completely_expanded, ! 'container_window' : _Prop_container_window, ! 'entire_contents' : _Prop_entire_contents, ! 'expandable' : _Prop_expandable, ! 'expanded' : _Prop_expanded, } container._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'warns_before_emptying' : _Prop_warns_before_emptying, } trash_2d_object._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } --- 152,246 ---- import Finder_items disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'startup' : _Prop_startup, } disk._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'disk' : disk, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } folder._superclassnames = ['container'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } folder._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } container._superclassnames = ['item'] container._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'completely_expanded' : _Prop_completely_expanded, ! 'container_window' : _Prop_container_window, ! 'entire_contents' : _Prop_entire_contents, ! 'expandable' : _Prop_expandable, ! 'expanded' : _Prop_expanded, } container._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'warns_before_emptying' : _Prop_warns_before_emptying, } trash_2d_object._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } *************** *** 249,256 **** # _classdeclarations = { ! 'cdis' : disk, ! 'cdsk' : desktop_2d_object, ! 'cfol' : folder, ! 'ctnr' : container, ! 'ctrs' : trash_2d_object, } --- 249,279 ---- # _classdeclarations = { ! 'cdis' : disk, ! 'cdsk' : desktop_2d_object, ! 'cfol' : folder, ! 'ctnr' : container, ! 'ctrs' : trash_2d_object, ! } ! ! _propdeclarations = { ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'capa' : _Prop_capacity, ! 'cwnd' : _Prop_container_window, ! 'dfmt' : _Prop_format, ! 'ects' : _Prop_entire_contents, ! 'frsp' : _Prop_free_space, ! 'igpr' : _Prop_ignore_privileges, ! 'isej' : _Prop_ejectable, ! 'isrv' : _Prop_local_volume, ! 'istd' : _Prop_startup, ! 'pexa' : _Prop_expandable, ! 'pexc' : _Prop_completely_expanded, ! 'pexp' : _Prop_expanded, ! 'warn' : _Prop_warns_before_emptying, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Enumerations.py 1 Apr 2003 22:04:36 -0000 1.6 --- Enumerations.py 12 Apr 2003 22:27:08 -0000 1.7 *************** *** 14,120 **** class Enumerations_Events(Type_Names_Suite_Events): ! pass _Enum_earr = { ! 'not_arranged' : 'narr', # ! 'snap_to_grid' : 'grda', # ! 'arranged_by_name' : 'nama', # ! 'arranged_by_modification_date' : 'mdta', # ! 'arranged_by_creation_date' : 'cdta', # ! 'arranged_by_size' : 'siza', # ! 'arranged_by_kind' : 'kina', # ! 'arranged_by_label' : 'laba', # } _Enum_ecvw = { ! 'icon_view' : 'icnv', # ! 'list_view' : 'lsvw', # ! 'column_view' : 'clvw', # } _Enum_edfm = { ! 'Mac_OS_format' : 'dfhf', # ! 'Mac_OS_Extended_format' : 'dfh+', # ! 'UFS_format' : 'dfuf', # ! 'NFS_format' : 'dfnf', # ! 'audio_format' : 'dfau', # ! 'ProDOS_format' : 'dfpr', # ! 'MS_2d_DOS_format' : 'dfms', # ! 'ISO_9660_format' : 'df96', # ! 'High_Sierra_format' : 'dfhs', # ! 'QuickTake_format' : 'dfqt', # ! 'Apple_Photo_format' : 'dfph', # ! 'AppleShare_format' : 'dfas', # ! 'UDF_format' : 'dfud', # ! 'WebDAV_format' : 'dfwd', # ! 'FTP_format' : 'dfft', # ! 'Packet_2d_written_UDF_format' : 'dfpu', # ! 'unknown_format' : 'df??', # } _Enum_elsv = { ! 'name_column' : 'elsn', # ! 'modification_date_column' : 'elsm', # ! 'creation_date_column' : 'elsc', # ! 'size_column' : 'elss', # ! 'kind_column' : 'elsk', # ! 'label_column' : 'elsl', # ! 'version_column' : 'elsv', # ! 'comment_column' : 'elsC', # } _Enum_ipnl = { ! 'General_Information_panel' : 'gpnl', # ! 'Sharing_panel' : 'spnl', # ! 'Memory_panel' : 'mpnl', # ! 'Preview_panel' : 'vpnl', # ! 'Application_panel' : 'apnl', # ! 'Languages_panel' : 'pklg', # ! 'Plugins_panel' : 'pkpg', # ! 'Name__26__Extension_panel' : 'npnl', # ! 'Comments_panel' : 'cpnl', # ! 'Content_Index_panel' : 'cinl', # } _Enum_isiz = { ! 'mini' : 'miic', # ! 'small' : 'smic', # ! 'large' : 'lgic', # } _Enum_lvic = { ! 'small_icon' : 'smic', # ! 'large_icon' : 'lgic', # } _Enum_priv = { ! 'read_only' : 'read', # ! 'read_write' : 'rdwr', # ! 'write_only' : 'writ', # ! 'none' : 'none', # } _Enum_sodr = { ! 'normal' : 'snrm', # ! 'reversed' : 'srvs', # } _Enum_vwby = { ! 'conflicts' : 'cflc', # ! 'existing_items' : 'exsi', # ! 'small_icon' : 'smic', # ! 'icon' : 'iimg', # ! 'name' : 'pnam', # ! 'modification_date' : 'asmo', # ! 'size' : 'ptsz', # ! 'kind' : 'kind', # ! 'comment' : 'comt', # ! 'label' : 'labi', # ! 'version' : 'vers', # ! 'creation_date' : 'ascd', # ! 'small_button' : 'smbu', # ! 'large_button' : 'lgbu', # ! 'grid' : 'grid', # ! 'all' : 'kyal', # } --- 14,120 ---- class Enumerations_Events(Type_Names_Suite_Events): ! pass _Enum_earr = { ! 'not_arranged' : 'narr', # ! 'snap_to_grid' : 'grda', # ! 'arranged_by_name' : 'nama', # ! 'arranged_by_modification_date' : 'mdta', # ! 'arranged_by_creation_date' : 'cdta', # ! 'arranged_by_size' : 'siza', # ! 'arranged_by_kind' : 'kina', # ! 'arranged_by_label' : 'laba', # } _Enum_ecvw = { ! 'icon_view' : 'icnv', # ! 'list_view' : 'lsvw', # ! 'column_view' : 'clvw', # } _Enum_edfm = { ! 'Mac_OS_format' : 'dfhf', # ! 'Mac_OS_Extended_format' : 'dfh+', # ! 'UFS_format' : 'dfuf', # ! 'NFS_format' : 'dfnf', # ! 'audio_format' : 'dfau', # ! 'ProDOS_format' : 'dfpr', # ! 'MS_2d_DOS_format' : 'dfms', # ! 'ISO_9660_format' : 'df96', # ! 'High_Sierra_format' : 'dfhs', # ! 'QuickTake_format' : 'dfqt', # ! 'Apple_Photo_format' : 'dfph', # ! 'AppleShare_format' : 'dfas', # ! 'UDF_format' : 'dfud', # ! 'WebDAV_format' : 'dfwd', # ! 'FTP_format' : 'dfft', # ! 'Packet_2d_written_UDF_format' : 'dfpu', # ! 'unknown_format' : 'df??', # } _Enum_elsv = { ! 'name_column' : 'elsn', # ! 'modification_date_column' : 'elsm', # ! 'creation_date_column' : 'elsc', # ! 'size_column' : 'elss', # ! 'kind_column' : 'elsk', # ! 'label_column' : 'elsl', # ! 'version_column' : 'elsv', # ! 'comment_column' : 'elsC', # } _Enum_ipnl = { ! 'General_Information_panel' : 'gpnl', # ! 'Sharing_panel' : 'spnl', # ! 'Memory_panel' : 'mpnl', # ! 'Preview_panel' : 'vpnl', # ! 'Application_panel' : 'apnl', # ! 'Languages_panel' : 'pklg', # ! 'Plugins_panel' : 'pkpg', # ! 'Name__26__Extension_panel' : 'npnl', # ! 'Comments_panel' : 'cpnl', # ! 'Content_Index_panel' : 'cinl', # } _Enum_isiz = { ! 'mini' : 'miic', # ! 'small' : 'smic', # ! 'large' : 'lgic', # } _Enum_lvic = { ! 'small_icon' : 'smic', # ! 'large_icon' : 'lgic', # } _Enum_priv = { ! 'read_only' : 'read', # ! 'read_write' : 'rdwr', # ! 'write_only' : 'writ', # ! 'none' : 'none', # } _Enum_sodr = { ! 'normal' : 'snrm', # ! 'reversed' : 'srvs', # } _Enum_vwby = { ! 'conflicts' : 'cflc', # ! 'existing_items' : 'exsi', # ! 'small_icon' : 'smic', # ! 'icon' : 'iimg', # ! 'name' : 'pnam', # ! 'modification_date' : 'asmo', # ! 'size' : 'ptsz', # ! 'kind' : 'kind', # ! 'comment' : 'comt', # ! 'label' : 'labi', # ! 'version' : 'vers', # ! 'creation_date' : 'ascd', # ! 'small_button' : 'smbu', # ! 'large_button' : 'lgbu', # ! 'grid' : 'grid', # ! 'all' : 'kyal', # } *************** *** 124,126 **** --- 124,145 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { + 'earr' : _Enum_earr, + 'ecvw' : _Enum_ecvw, + 'edfm' : _Enum_edfm, + 'elsv' : _Enum_elsv, + 'ipnl' : _Enum_ipnl, + 'isiz' : _Enum_isiz, + 'lvic' : _Enum_lvic, + 'priv' : _Enum_priv, + 'sodr' : _Enum_sodr, + 'vwby' : _Enum_vwby, } Index: Files.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Files.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Files.py 1 Apr 2003 22:04:37 -0000 1.2 --- Files.py 12 Apr 2003 22:27:08 -0000 1.3 *************** *** 13,124 **** class Files_Events: ! pass class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with \xd2Make Alias\xd3) """ ! want = 'alia' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the file class """ ! which = 'c@#^' ! want = 'file' class _Prop_original_item(aetools.NProperty): ! """original item - the original item pointed to by the alias """ ! which = 'orig' ! want = 'obj ' alias_files = alias_file class application_file(aetools.ComponentItem): ! """application file - An application's file on disk """ ! want = 'appf' class _Prop_accepts_high_level_events(aetools.NProperty): ! """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ ! which = 'isab' ! want = 'bool' class _Prop_has_scripting_terminology(aetools.NProperty): ! """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ ! which = 'hscr' ! want = 'bool' class _Prop_minimum_size(aetools.NProperty): ! """minimum size - the smallest memory size with which the application can be launched """ ! which = 'mprt' ! want = 'long' class _Prop_opens_in_Classic(aetools.NProperty): ! """opens in Classic - Should the application launch in the Classic environment? """ ! which = 'Clsc' ! want = 'bool' class _Prop_preferred_size(aetools.NProperty): ! """preferred size - the memory size with which the application will be launched """ ! which = 'appt' ! want = 'long' class _Prop_suggested_size(aetools.NProperty): ! """suggested size - the memory size with which the developer recommends the application be launched """ ! which = 'sprt' ! want = 'long' application_files = application_file class clipping(aetools.ComponentItem): ! """clipping - A clipping """ ! want = 'clpf' class _Prop_clipping_window(aetools.NProperty): ! """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ ! which = 'lwnd' ! want = 'obj ' clippings = clipping class document_file(aetools.ComponentItem): ! """document file - A document file """ ! want = 'docf' document_files = document_file class file(aetools.ComponentItem): ! """file - A file """ ! want = 'file' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType identifying the application that created the item """ ! which = 'fcrt' ! want = 'type' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType identifying the type of data contained in the item """ ! which = 'asty' ! want = 'type' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ ! which = 'ver2' ! want = 'utxt' class _Prop_stationery(aetools.NProperty): ! """stationery - Is the file a stationery pad? """ ! which = 'pspd' ! want = 'bool' class _Prop_version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ ! which = 'vers' ! want = 'utxt' files = file class internet_location_file(aetools.ComponentItem): ! """internet location file - An file containing an internet location """ ! want = 'inlf' class _Prop_location(aetools.NProperty): ! """location - the internet location """ ! which = 'iloc' ! want = 'utxt' internet_location_files = internet_location_file class package(aetools.ComponentItem): ! """package - A package """ ! want = 'pack' packages = package alias_file._superclassnames = ['file'] alias_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'original_item' : _Prop_original_item, } alias_file._privelemdict = { --- 13,124 ---- class Files_Events: ! pass class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with \xd2Make Alias\xd3) """ ! want = 'alia' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the file class """ ! which = 'c@#^' ! want = 'file' class _Prop_original_item(aetools.NProperty): ! """original item - the original item pointed to by the alias """ ! which = 'orig' ! want = 'obj ' alias_files = alias_file class application_file(aetools.ComponentItem): ! """application file - An application's file on disk """ ! want = 'appf' class _Prop_accepts_high_level_events(aetools.NProperty): ! """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ ! which = 'isab' ! want = 'bool' class _Prop_has_scripting_terminology(aetools.NProperty): ! """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ ! which = 'hscr' ! want = 'bool' class _Prop_minimum_size(aetools.NProperty): ! """minimum size - the smallest memory size with which the application can be launched """ ! which = 'mprt' ! want = 'long' class _Prop_opens_in_Classic(aetools.NProperty): ! """opens in Classic - Should the application launch in the Classic environment? """ ! which = 'Clsc' ! want = 'bool' class _Prop_preferred_size(aetools.NProperty): ! """preferred size - the memory size with which the application will be launched """ ! which = 'appt' ! want = 'long' class _Prop_suggested_size(aetools.NProperty): ! """suggested size - the memory size with which the developer recommends the application be launched """ ! which = 'sprt' ! want = 'long' application_files = application_file class clipping(aetools.ComponentItem): ! """clipping - A clipping """ ! want = 'clpf' class _Prop_clipping_window(aetools.NProperty): ! """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ ! which = 'lwnd' ! want = 'obj ' clippings = clipping class document_file(aetools.ComponentItem): ! """document file - A document file """ ! want = 'docf' document_files = document_file class file(aetools.ComponentItem): ! """file - A file """ ! want = 'file' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType identifying the application that created the item """ ! which = 'fcrt' ! want = 'type' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType identifying the type of data contained in the item """ ! which = 'asty' ! want = 'type' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ ! which = 'ver2' ! want = 'utxt' class _Prop_stationery(aetools.NProperty): ! """stationery - Is the file a stationery pad? """ ! which = 'pspd' ! want = 'bool' class _Prop_version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ ! which = 'vers' ! want = 'utxt' files = file class internet_location_file(aetools.ComponentItem): ! """internet location file - An file containing an internet location """ ! want = 'inlf' class _Prop_location(aetools.NProperty): ! """location - the internet location """ ! which = 'iloc' ! want = 'utxt' internet_location_files = internet_location_file class package(aetools.ComponentItem): ! """package - A package """ ! want = 'pack' packages = package alias_file._superclassnames = ['file'] alias_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'original_item' : _Prop_original_item, } alias_file._privelemdict = { *************** *** 126,136 **** application_file._superclassnames = ['file'] application_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'minimum_size' : _Prop_minimum_size, ! 'opens_in_Classic' : _Prop_opens_in_Classic, ! 'preferred_size' : _Prop_preferred_size, ! 'suggested_size' : _Prop_suggested_size, } application_file._privelemdict = { --- 126,136 ---- application_file._superclassnames = ['file'] application_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'minimum_size' : _Prop_minimum_size, ! 'opens_in_Classic' : _Prop_opens_in_Classic, ! 'preferred_size' : _Prop_preferred_size, ! 'suggested_size' : _Prop_suggested_size, } application_file._privelemdict = { *************** *** 138,143 **** clipping._superclassnames = ['file'] clipping._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'clipping_window' : _Prop_clipping_window, } clipping._privelemdict = { --- 138,143 ---- clipping._superclassnames = ['file'] clipping._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'clipping_window' : _Prop_clipping_window, } clipping._privelemdict = { *************** *** 145,149 **** document_file._superclassnames = ['file'] document_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } document_file._privelemdict = { --- 145,149 ---- document_file._superclassnames = ['file'] document_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } document_file._privelemdict = { *************** *** 152,161 **** file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'product_version' : _Prop_product_version, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { --- 152,161 ---- file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'product_version' : _Prop_product_version, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { *************** *** 163,168 **** internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'location' : _Prop_location, } internet_location_file._privelemdict = { --- 163,168 ---- internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'location' : _Prop_location, } internet_location_file._privelemdict = { *************** *** 170,174 **** package._superclassnames = ['item'] package._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } package._privelemdict = { --- 170,174 ---- package._superclassnames = ['item'] package._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } package._privelemdict = { *************** *** 179,188 **** # _classdeclarations = { ! 'alia' : alias_file, ! 'appf' : application_file, ! 'clpf' : clipping, ! 'docf' : document_file, ! 'file' : file, ! 'inlf' : internet_location_file, ! 'pack' : package, } --- 179,212 ---- # _classdeclarations = { ! 'alia' : alias_file, ! 'appf' : application_file, ! 'clpf' : clipping, ! 'docf' : document_file, ! 'file' : file, ! 'inlf' : internet_location_file, ! 'pack' : package, ! } ! ! _propdeclarations = { ! 'Clsc' : _Prop_opens_in_Classic, ! 'appt' : _Prop_preferred_size, ! 'asty' : _Prop_file_type, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'fcrt' : _Prop_creator_type, ! 'hscr' : _Prop_has_scripting_terminology, ! 'iloc' : _Prop_location, ! 'isab' : _Prop_accepts_high_level_events, ! 'lwnd' : _Prop_clipping_window, ! 'mprt' : _Prop_minimum_size, ! 'orig' : _Prop_original_item, ! 'pspd' : _Prop_stationery, ! 'sprt' : _Prop_suggested_size, ! 'ver2' : _Prop_product_version, ! 'vers' : _Prop_version, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Finder_Basics.py 1 Apr 2003 22:04:38 -0000 1.5 --- Finder_Basics.py 12 Apr 2003 22:27:09 -0000 1.6 *************** *** 13,117 **** class Finder_Basics_Events: ! def copy(self, _no_object=None, _attributes={}, **_arguments): ! """copy: (NOT AVAILABLE YET) Copy the selected items to the clipboard (the Finder must be the front application) ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'copy' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_sort = { ! 'by' : 'by ', ! } ! def sort(self, _object, _attributes={}, **_arguments): ! """sort: (NOT AVAILABLE YET) Return the specified object(s) in a sorted list ! Required argument: a list of finder objects to sort ! Keyword argument by: the property to sort the items by (name, index, date, etc.) ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the sorted items in their new order ! """ ! _code = 'DATA' ! _subcode = 'SORT' ! aetools.keysubst(_arguments, self._argmap_sort) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - The Finder """ ! want = 'capp' class _Prop_Finder_preferences(aetools.NProperty): ! """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ ! which = 'pfrp' ! want = 'cprf' class _Prop_clipboard(aetools.NProperty): ! """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ ! which = 'pcli' ! want = 'obj ' class _Prop_desktop(aetools.NProperty): ! """desktop - the desktop """ ! which = 'desk' ! want = 'cdsk' class _Prop_frontmost(aetools.NProperty): ! """frontmost - Is the Finder the frontmost process? """ ! which = 'pisf' ! want = 'bool' class _Prop_home(aetools.NProperty): ! """home - the home directory """ ! which = 'home' ! want = 'cfol' class _Prop_insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ ! which = 'pins' ! want = 'obj ' class _Prop_name(aetools.NProperty): ! """name - the Finder\xd5s name """ ! which = 'pnam' ! want = 'itxt' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the System software running on this computer """ ! which = 'ver2' ! want = 'utxt' class _Prop_selection(aetools.NProperty): ! """selection - the selection in the frontmost Finder window """ ! which = 'sele' ! want = 'obj ' class _Prop_startup_disk(aetools.NProperty): ! """startup disk - the startup disk """ ! which = 'sdsk' ! want = 'cdis' class _Prop_trash(aetools.NProperty): ! """trash - the trash """ ! which = 'trsh' ! want = 'ctrs' class _Prop_version(aetools.NProperty): ! """version - the version of the Finder """ ! which = 'vers' ! want = 'utxt' class _Prop_visible(aetools.NProperty): ! """visible - Is the Finder\xd5s layer visible? """ ! which = 'pvis' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 13,117 ---- class Finder_Basics_Events: ! def copy(self, _no_object=None, _attributes={}, **_arguments): ! """copy: (NOT AVAILABLE YET) Copy the selected items to the clipboard (the Finder must be the front application) ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'copy' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_sort = { ! 'by' : 'by ', ! } ! def sort(self, _object, _attributes={}, **_arguments): ! """sort: (NOT AVAILABLE YET) Return the specified object(s) in a sorted list ! Required argument: a list of finder objects to sort ! Keyword argument by: the property to sort the items by (name, index, date, etc.) ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the sorted items in their new order ! """ ! _code = 'DATA' ! _subcode = 'SORT' ! aetools.keysubst(_arguments, self._argmap_sort) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - The Finder """ ! want = 'capp' class _Prop_Finder_preferences(aetools.NProperty): ! """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ ! which = 'pfrp' ! want = 'cprf' class _Prop_clipboard(aetools.NProperty): ! """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ ! which = 'pcli' ! want = 'obj ' class _Prop_desktop(aetools.NProperty): ! """desktop - the desktop """ ! which = 'desk' ! want = 'cdsk' class _Prop_frontmost(aetools.NProperty): ! """frontmost - Is the Finder the frontmost process? """ ! which = 'pisf' ! want = 'bool' class _Prop_home(aetools.NProperty): ! """home - the home directory """ ! which = 'home' ! want = 'cfol' class _Prop_insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ ! which = 'pins' ! want = 'obj ' class _Prop_name(aetools.NProperty): ! """name - the Finder\xd5s name """ ! which = 'pnam' ! want = 'itxt' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the System software running on this computer """ ! which = 'ver2' ! want = 'utxt' class _Prop_selection(aetools.NProperty): ! """selection - the selection in the frontmost Finder window """ ! which = 'sele' ! want = 'obj ' class _Prop_startup_disk(aetools.NProperty): ! """startup disk - the startup disk """ ! which = 'sdsk' ! want = 'cdis' class _Prop_trash(aetools.NProperty): ! """trash - the trash """ ! which = 'trsh' ! want = 'ctrs' class _Prop_version(aetools.NProperty): ! """version - the version of the Finder """ ! which = 'vers' ! want = 'utxt' class _Prop_visible(aetools.NProperty): ! """visible - Is the Finder\xd5s layer visible? """ ! which = 'pvis' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 134,166 **** import Finder_items application._privpropdict = { ! 'Finder_preferences' : _Prop_Finder_preferences, ! 'clipboard' : _Prop_clipboard, ! 'desktop' : _Prop_desktop, ! 'frontmost' : _Prop_frontmost, ! 'home' : _Prop_home, ! 'insertion_location' : _Prop_insertion_location, ! 'name' : _Prop_name, ! 'product_version' : _Prop_product_version, ! 'selection' : _Prop_selection, ! 'startup_disk' : _Prop_startup_disk, ! 'trash' : _Prop_trash, ! 'version' : _Prop_version, ! 'visible' : _Prop_visible, } application._privelemdict = { ! 'Finder_window' : Window_classes.Finder_window, ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'clipping_window' : Window_classes.clipping_window, ! 'container' : Containers_and_folders.container, ! 'disk' : Containers_and_folders.disk, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : Containers_and_folders.folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, ! 'window' : Window_classes.window, } --- 134,166 ---- import Finder_items application._privpropdict = { ! 'Finder_preferences' : _Prop_Finder_preferences, ! 'clipboard' : _Prop_clipboard, ! 'desktop' : _Prop_desktop, ! 'frontmost' : _Prop_frontmost, ! 'home' : _Prop_home, ! 'insertion_location' : _Prop_insertion_location, ! 'name' : _Prop_name, ! 'product_version' : _Prop_product_version, ! 'selection' : _Prop_selection, ! 'startup_disk' : _Prop_startup_disk, ! 'trash' : _Prop_trash, ! 'version' : _Prop_version, ! 'visible' : _Prop_visible, } application._privelemdict = { ! 'Finder_window' : Window_classes.Finder_window, ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, ! 'clipping_window' : Window_classes.clipping_window, ! 'container' : Containers_and_folders.container, ! 'disk' : Containers_and_folders.disk, ! 'document_file' : Files.document_file, ! 'file' : Files.file, ! 'folder' : Containers_and_folders.folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, ! 'window' : Window_classes.window, } *************** *** 169,172 **** # _classdeclarations = { ! 'capp' : application, } --- 169,194 ---- # _classdeclarations = { ! 'capp' : application, ! } ! ! _propdeclarations = { ! 'desk' : _Prop_desktop, ! 'home' : _Prop_home, ! 'pcli' : _Prop_clipboard, ! 'pfrp' : _Prop_Finder_preferences, ! 'pins' : _Prop_insertion_location, ! 'pisf' : _Prop_frontmost, ! 'pnam' : _Prop_name, ! 'pvis' : _Prop_visible, ! 'sdsk' : _Prop_startup_disk, ! 'sele' : _Prop_selection, ! 'trsh' : _Prop_trash, ! 'ver2' : _Prop_product_version, ! 'vers' : _Prop_version, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Finder_items.py 1 Apr 2003 22:04:39 -0000 1.5 --- Finder_items.py 12 Apr 2003 22:27:09 -0000 1.6 *************** *** 13,311 **** class Finder_items_Events: ! def add_to_favorites(self, _object, _attributes={}, **_arguments): ! """add to favorites: (NOT AVAILABLE YET) Add the items to the user\xd5s Favorites ! Required argument: the items to add to the collection of Favorites ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'ffav' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_clean_up = { ! 'by' : 'by ', ! } ! def clean_up(self, _object, _attributes={}, **_arguments): ! """clean up: (NOT AVAILABLE YET) Arrange items in window nicely (only applies to open windows in icon view that are not kept arranged) ! Required argument: the window to clean up ! Keyword argument by: the order in which to clean up the objects (name, index, date, etc.) ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'fclu' ! aetools.keysubst(_arguments, self._argmap_clean_up) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def eject(self, _object=None, _attributes={}, **_arguments): ! """eject: Eject the specified disk(s) ! Required argument: the disk(s) to eject ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'ejct' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def empty(self, _object=None, _attributes={}, **_arguments): ! """empty: Empty the trash ! Required argument: \xd2empty\xd3 and \xd2empty trash\xd3 both do the same thing ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'empt' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def erase(self, _object, _attributes={}, **_arguments): ! """erase: (NOT AVAILABLE) Erase the specified disk(s) ! Required argument: the items to erase ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'fera' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def reveal(self, _object, _attributes={}, **_arguments): ! """reveal: Bring the specified object(s) into view ! Required argument: the object to be made visible ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'mvis' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_update = { ! 'necessity' : 'nec?', ! 'registering_applications' : 'reg?', ! } ! def update(self, _object, _attributes={}, **_arguments): ! """update: Update the display of the specified object(s) to match their on-disk representation ! Required argument: the item to update ! Keyword argument necessity: only update if necessary (i.e. a finder window is open). default is false ! Keyword argument registering_applications: register applications. default is true ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'fupd' ! aetools.keysubst(_arguments, self._argmap_update) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class item(aetools.ComponentItem): ! """item - An item """ ! want = 'cobj' class _Prop_bounds(aetools.NProperty): ! """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ ! which = 'comt' ! want = 'utxt' class _Prop_container(aetools.NProperty): ! """container - the container of the item """ ! which = 'ctnr' ! want = 'obj ' class _Prop_creation_date(aetools.NProperty): ! """creation date - the date on which the item was created """ ! which = 'ascd' ! want = 'ldt ' class _Prop_description(aetools.NProperty): ! """description - a description of the item """ ! which = 'dscr' ! want = 'utxt' class _Prop_disk(aetools.NProperty): ! """disk - the disk on which the item is stored """ ! which = 'cdis' ! want = 'obj ' class _Prop_displayed_name(aetools.NProperty): ! """displayed name - the user-visible name of the item """ ! which = 'dnam' ! want = 'utxt' class _Prop_everyones_privileges(aetools.NProperty): ! """everyones privileges - """ ! which = 'gstp' ! want = 'priv' class _Prop_extension_hidden(aetools.NProperty): ! """extension hidden - Is the item's extension hidden from the user? """ ! which = 'hidx' ! want = 'bool' class _Prop_group(aetools.NProperty): ! """group - the user or group that has special access to the container """ ! which = 'sgrp' ! want = 'utxt' class _Prop_group_privileges(aetools.NProperty): ! """group privileges - """ ! which = 'gppr' ! want = 'priv' class _Prop_icon(aetools.NProperty): ! """icon - the icon bitmap of the item """ ! which = 'iimg' ! want = 'ifam' class _Prop_index(aetools.NProperty): ! """index - the index in the front-to-back ordering within its container """ ! which = 'pidx' ! want = 'long' class _Prop_information_window(aetools.NProperty): ! """information window - the information window for the item """ ! which = 'iwnd' ! want = 'obj ' class _Prop_kind(aetools.NProperty): ! """kind - the kind of the item """ ! which = 'kind' ! want = 'utxt' class _Prop_label_index(aetools.NProperty): ! """label index - the label of the item """ ! which = 'labi' ! want = 'long' class _Prop_locked(aetools.NProperty): ! """locked - Is the file locked? """ ! which = 'aslk' ! want = 'bool' class _Prop_modification_date(aetools.NProperty): ! """modification date - the date on which the item was last modified """ ! which = 'asmo' ! want = 'ldt ' class _Prop_name(aetools.NProperty): ! """name - the name of the item """ ! which = 'pnam' ! want = 'utxt' class _Prop_name_extension(aetools.NProperty): ! """name extension - the name extension of the item (such as \xd2txt\xd3) """ ! which = 'nmxt' ! want = 'utxt' class _Prop_owner(aetools.NProperty): ! """owner - the user that owns the container """ ! which = 'sown' ! want = 'utxt' class _Prop_owner_privileges(aetools.NProperty): ! """owner privileges - """ ! which = 'ownr' ! want = 'priv' class _Prop_physical_size(aetools.NProperty): ! """physical size - the actual space used by the item on disk """ ! which = 'phys' ! want = 'comp' class _Prop_position(aetools.NProperty): ! """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'posn' ! want = 'QDpt' class _Prop_properties(aetools.NProperty): ! """properties - every property of an item """ ! which = 'pALL' ! want = 'reco' class _Prop_size(aetools.NProperty): ! """size - the logical size of the item """ ! which = 'ptsz' ! want = 'comp' class _Prop_url(aetools.NProperty): ! """url - the url of the item """ ! which = 'pURL' ! want = 'utxt' items = item item._superclassnames = [] item._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'comment' : _Prop_comment, ! 'container' : _Prop_container, ! 'creation_date' : _Prop_creation_date, ! 'description' : _Prop_description, ! 'disk' : _Prop_disk, ! 'displayed_name' : _Prop_displayed_name, ! 'everyones_privileges' : _Prop_everyones_privileges, ! 'extension_hidden' : _Prop_extension_hidden, ! 'group' : _Prop_group, ! 'group_privileges' : _Prop_group_privileges, ! 'icon' : _Prop_icon, ! 'index' : _Prop_index, ! 'information_window' : _Prop_information_window, ! 'kind' : _Prop_kind, ! 'label_index' : _Prop_label_index, ! 'locked' : _Prop_locked, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'owner' : _Prop_owner, ! 'owner_privileges' : _Prop_owner_privileges, ! 'physical_size' : _Prop_physical_size, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'url' : _Prop_url, } item._privelemdict = { --- 13,311 ---- class Finder_items_Events: ! def add_to_favorites(self, _object, _attributes={}, **_arguments): ! """add to favorites: (NOT AVAILABLE YET) Add the items to the user\xd5s Favorites ! Required argument: the items to add to the collection of Favorites ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'ffav' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_clean_up = { ! 'by' : 'by ', ! } ! def clean_up(self, _object, _attributes={}, **_arguments): ! """clean up: (NOT AVAILABLE YET) Arrange items in window nicely (only applies to open windows in icon view that are not kept arranged) ! Required argument: the window to clean up ! Keyword argument by: the order in which to clean up the objects (name, index, date, etc.) ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'fclu' ! aetools.keysubst(_arguments, self._argmap_clean_up) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def eject(self, _object=None, _attributes={}, **_arguments): ! """eject: Eject the specified disk(s) ! Required argument: the disk(s) to eject ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'ejct' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def empty(self, _object=None, _attributes={}, **_arguments): ! """empty: Empty the trash ! Required argument: \xd2empty\xd3 and \xd2empty trash\xd3 both do the same thing ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'empt' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def erase(self, _object, _attributes={}, **_arguments): ! """erase: (NOT AVAILABLE) Erase the specified disk(s) ! Required argument: the items to erase ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'fera' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def reveal(self, _object, _attributes={}, **_arguments): ! """reveal: Bring the specified object(s) into view ! Required argument: the object to be made visible ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'mvis' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_update = { ! 'necessity' : 'nec?', ! 'registering_applications' : 'reg?', ! } ! def update(self, _object, _attributes={}, **_arguments): ! """update: Update the display of the specified object(s) to match their on-disk representation ! Required argument: the item to update ! Keyword argument necessity: only update if necessary (i.e. a finder window is open). default is false ! Keyword argument registering_applications: register applications. default is true ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'fupd' ! aetools.keysubst(_arguments, self._argmap_update) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class item(aetools.ComponentItem): ! """item - An item """ ! want = 'cobj' class _Prop_bounds(aetools.NProperty): ! """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ ! which = 'comt' ! want = 'utxt' class _Prop_container(aetools.NProperty): ! """container - the container of the item """ ! which = 'ctnr' ! want = 'obj ' class _Prop_creation_date(aetools.NProperty): ! """creation date - the date on which the item was created """ ! which = 'ascd' ! want = 'ldt ' class _Prop_description(aetools.NProperty): ! """description - a description of the item """ ! which = 'dscr' ! want = 'utxt' class _Prop_disk(aetools.NProperty): ! """disk - the disk on which the item is stored """ ! which = 'cdis' ! want = 'obj ' class _Prop_displayed_name(aetools.NProperty): ! """displayed name - the user-visible name of the item """ ! which = 'dnam' ! want = 'utxt' class _Prop_everyones_privileges(aetools.NProperty): ! """everyones privileges - """ ! which = 'gstp' ! want = 'priv' class _Prop_extension_hidden(aetools.NProperty): ! """extension hidden - Is the item's extension hidden from the user? """ ! which = 'hidx' ! want = 'bool' class _Prop_group(aetools.NProperty): ! """group - the user or group that has special access to the container """ ! which = 'sgrp' ! want = 'utxt' class _Prop_group_privileges(aetools.NProperty): ! """group privileges - """ ! which = 'gppr' ! want = 'priv' class _Prop_icon(aetools.NProperty): ! """icon - the icon bitmap of the item """ ! which = 'iimg' ! want = 'ifam' class _Prop_index(aetools.NProperty): ! """index - the index in the front-to-back ordering within its container """ ! which = 'pidx' ! want = 'long' class _Prop_information_window(aetools.NProperty): ! """information window - the information window for the item """ ! which = 'iwnd' ! want = 'obj ' class _Prop_kind(aetools.NProperty): ! """kind - the kind of the item """ ! which = 'kind' ! want = 'utxt' class _Prop_label_index(aetools.NProperty): ! """label index - the label of the item """ ! which = 'labi' ! want = 'long' class _Prop_locked(aetools.NProperty): ! """locked - Is the file locked? """ ! which = 'aslk' ! want = 'bool' class _Prop_modification_date(aetools.NProperty): ! """modification date - the date on which the item was last modified """ ! which = 'asmo' ! want = 'ldt ' class _Prop_name(aetools.NProperty): ! """name - the name of the item """ ! which = 'pnam' ! want = 'utxt' class _Prop_name_extension(aetools.NProperty): ! """name extension - the name extension of the item (such as \xd2txt\xd3) """ ! which = 'nmxt' ! want = 'utxt' class _Prop_owner(aetools.NProperty): ! """owner - the user that owns the container """ ! which = 'sown' ! want = 'utxt' class _Prop_owner_privileges(aetools.NProperty): ! """owner privileges - """ ! which = 'ownr' ! want = 'priv' class _Prop_physical_size(aetools.NProperty): ! """physical size - the actual space used by the item on disk """ ! which = 'phys' ! want = 'comp' class _Prop_position(aetools.NProperty): ! """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'posn' ! want = 'QDpt' class _Prop_properties(aetools.NProperty): ! """properties - every property of an item """ ! which = 'pALL' ! want = 'reco' class _Prop_size(aetools.NProperty): ! """size - the logical size of the item """ ! which = 'ptsz' ! want = 'comp' class _Prop_url(aetools.NProperty): ! """url - the url of the item """ ! which = 'pURL' ! want = 'utxt' items = item item._superclassnames = [] item._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'comment' : _Prop_comment, ! 'container' : _Prop_container, ! 'creation_date' : _Prop_creation_date, ! 'description' : _Prop_description, ! 'disk' : _Prop_disk, ! 'displayed_name' : _Prop_displayed_name, ! 'everyones_privileges' : _Prop_everyones_privileges, ! 'extension_hidden' : _Prop_extension_hidden, ! 'group' : _Prop_group, ! 'group_privileges' : _Prop_group_privileges, ! 'icon' : _Prop_icon, ! 'index' : _Prop_index, ! 'information_window' : _Prop_information_window, ! 'kind' : _Prop_kind, ! 'label_index' : _Prop_label_index, ! 'locked' : _Prop_locked, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'owner' : _Prop_owner, ! 'owner_privileges' : _Prop_owner_privileges, ! 'physical_size' : _Prop_physical_size, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'url' : _Prop_url, } item._privelemdict = { *************** *** 316,319 **** # _classdeclarations = { ! 'cobj' : item, } --- 316,355 ---- # _classdeclarations = { ! 'cobj' : item, ! } ! ! _propdeclarations = { ! 'ascd' : _Prop_creation_date, ! 'aslk' : _Prop_locked, ! 'asmo' : _Prop_modification_date, ! 'cdis' : _Prop_disk, ! 'comt' : _Prop_comment, ! 'ctnr' : _Prop_container, ! 'dnam' : _Prop_displayed_name, ! 'dscr' : _Prop_description, ! 'gppr' : _Prop_group_privileges, ! 'gstp' : _Prop_everyones_privileges, ! 'hidx' : _Prop_extension_hidden, ! 'iimg' : _Prop_icon, ! 'iwnd' : _Prop_information_window, ! 'kind' : _Prop_kind, ! 'labi' : _Prop_label_index, ! 'nmxt' : _Prop_name_extension, ! 'ownr' : _Prop_owner_privileges, ! 'pALL' : _Prop_properties, ! 'pURL' : _Prop_url, ! 'pbnd' : _Prop_bounds, ! 'phys' : _Prop_physical_size, ! 'pidx' : _Prop_index, ! 'pnam' : _Prop_name, ! 'posn' : _Prop_position, ! 'ptsz' : _Prop_size, ! 'sgrp' : _Prop_group, ! 'sown' : _Prop_owner, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Legacy_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Legacy_suite.py 1 Apr 2003 22:04:40 -0000 1.2 --- Legacy_suite.py 12 Apr 2003 22:27:09 -0000 1.3 *************** *** 13,158 **** class Legacy_suite_Events: ! def restart(self, _no_object=None, _attributes={}, **_arguments): ! """restart: Restart the computer ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'rest' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def shut_down(self, _no_object=None, _attributes={}, **_arguments): ! """shut down: Shut Down the computer ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'shut' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def sleep(self, _no_object=None, _attributes={}, **_arguments): ! """sleep: Put the computer to sleep ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'slep' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - The Finder """ ! want = 'capp' class _Prop_desktop_picture(aetools.NProperty): ! """desktop picture - the desktop picture of the main monitor """ ! which = 'dpic' ! want = 'file' class application_process(aetools.ComponentItem): ! """application process - A process launched from an application file """ ! want = 'pcap' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the process class """ ! which = 'c@#^' ! want = 'prcs' class _Prop_application_file(aetools.NProperty): ! """application file - the application file from which this process was launched """ ! which = 'appf' ! want = 'appf' application_processes = application_process class desk_accessory_process(aetools.ComponentItem): ! """desk accessory process - A process launched from a desk accessory file """ ! want = 'pcda' class _Prop_desk_accessory_file(aetools.NProperty): ! """desk accessory file - the desk accessory file from which this process was launched """ ! which = 'dafi' ! want = 'obj ' desk_accessory_processes = desk_accessory_process class process(aetools.ComponentItem): ! """process - A process running on this computer """ ! want = 'prcs' class _Prop_accepts_high_level_events(aetools.NProperty): ! """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ ! which = 'isab' ! want = 'bool' class _Prop_accepts_remote_events(aetools.NProperty): ! """accepts remote events - Does the process accept remote events? """ ! which = 'revt' ! want = 'bool' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType of the creator of the process (the signature) """ ! which = 'fcrt' ! want = 'type' class _Prop_file(aetools.NProperty): ! """file - the file from which the process was launched """ ! which = 'file' ! want = 'obj ' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType of the file type of the process """ ! which = 'asty' ! want = 'type' class _Prop_frontmost(aetools.NProperty): ! """frontmost - Is the process the frontmost process? """ ! which = 'pisf' ! want = 'bool' class _Prop_has_scripting_terminology(aetools.NProperty): ! """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ ! which = 'hscr' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the name of the process """ ! which = 'pnam' ! want = 'itxt' class _Prop_partition_space_used(aetools.NProperty): ! """partition space used - the number of bytes currently used in the process' partition """ ! which = 'pusd' ! want = 'long' class _Prop_total_partition_size(aetools.NProperty): ! """total partition size - the size of the partition with which the process was launched """ ! which = 'appt' ! want = 'long' class _Prop_visible(aetools.NProperty): ! """visible - Is the process' layer visible? """ ! which = 'pvis' ! want = 'bool' processes = process application._superclassnames = [] application._privpropdict = { ! 'desktop_picture' : _Prop_desktop_picture, } application._privelemdict = { --- 13,158 ---- class Legacy_suite_Events: ! def restart(self, _no_object=None, _attributes={}, **_arguments): ! """restart: Restart the computer ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'rest' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def shut_down(self, _no_object=None, _attributes={}, **_arguments): ! """shut down: Shut Down the computer ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'shut' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def sleep(self, _no_object=None, _attributes={}, **_arguments): ! """sleep: Put the computer to sleep ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'fndr' ! _subcode = 'slep' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] class application(aetools.ComponentItem): ! """application - The Finder """ ! want = 'capp' class _Prop_desktop_picture(aetools.NProperty): ! """desktop picture - the desktop picture of the main monitor """ ! which = 'dpic' ! want = 'file' class application_process(aetools.ComponentItem): ! """application process - A process launched from an application file """ ! want = 'pcap' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the process class """ ! which = 'c@#^' ! want = 'prcs' class _Prop_application_file(aetools.NProperty): ! """application file - the application file from which this process was launched """ ! which = 'appf' ! want = 'appf' application_processes = application_process class desk_accessory_process(aetools.ComponentItem): ! """desk accessory process - A process launched from a desk accessory file """ ! want = 'pcda' class _Prop_desk_accessory_file(aetools.NProperty): ! """desk accessory file - the desk accessory file from which this process was launched """ ! which = 'dafi' ! want = 'obj ' desk_accessory_processes = desk_accessory_process class process(aetools.ComponentItem): ! """process - A process running on this computer """ ! want = 'prcs' class _Prop_accepts_high_level_events(aetools.NProperty): ! """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ ! which = 'isab' ! want = 'bool' class _Prop_accepts_remote_events(aetools.NProperty): ! """accepts remote events - Does the process accept remote events? """ ! which = 'revt' ! want = 'bool' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType of the creator of the process (the signature) """ ! which = 'fcrt' ! want = 'type' class _Prop_file(aetools.NProperty): ! """file - the file from which the process was launched """ ! which = 'file' ! want = 'obj ' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType of the file type of the process """ ! which = 'asty' ! want = 'type' class _Prop_frontmost(aetools.NProperty): ! """frontmost - Is the process the frontmost process? """ ! which = 'pisf' ! want = 'bool' class _Prop_has_scripting_terminology(aetools.NProperty): ! """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ ! which = 'hscr' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the name of the process """ ! which = 'pnam' ! want = 'itxt' class _Prop_partition_space_used(aetools.NProperty): ! """partition space used - the number of bytes currently used in the process' partition """ ! which = 'pusd' ! want = 'long' class _Prop_total_partition_size(aetools.NProperty): ! """total partition size - the size of the partition with which the process was launched """ ! which = 'appt' ! want = 'long' class _Prop_visible(aetools.NProperty): ! """visible - Is the process' layer visible? """ ! which = 'pvis' ! want = 'bool' processes = process application._superclassnames = [] application._privpropdict = { ! 'desktop_picture' : _Prop_desktop_picture, } application._privelemdict = { *************** *** 160,165 **** application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'application_file' : _Prop_application_file, } application_process._privelemdict = { --- 160,165 ---- application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'application_file' : _Prop_application_file, } application_process._privelemdict = { *************** *** 167,172 **** desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'desk_accessory_file' : _Prop_desk_accessory_file, } desk_accessory_process._privelemdict = { --- 167,172 ---- desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'desk_accessory_file' : _Prop_desk_accessory_file, } desk_accessory_process._privelemdict = { *************** *** 174,188 **** process._superclassnames = [] process._privpropdict = { ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'accepts_remote_events' : _Prop_accepts_remote_events, ! 'creator_type' : _Prop_creator_type, ! 'file' : _Prop_file, ! 'file_type' : _Prop_file_type, ! 'frontmost' : _Prop_frontmost, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'name' : _Prop_name, ! 'partition_space_used' : _Prop_partition_space_used, ! 'total_partition_size' : _Prop_total_partition_size, ! 'visible' : _Prop_visible, } process._privelemdict = { --- 174,188 ---- process._superclassnames = [] process._privpropdict = { ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'accepts_remote_events' : _Prop_accepts_remote_events, ! 'creator_type' : _Prop_creator_type, ! 'file' : _Prop_file, ! 'file_type' : _Prop_file_type, ! 'frontmost' : _Prop_frontmost, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'name' : _Prop_name, ! 'partition_space_used' : _Prop_partition_space_used, ! 'total_partition_size' : _Prop_total_partition_size, ! 'visible' : _Prop_visible, } process._privelemdict = { *************** *** 193,199 **** # _classdeclarations = { ! 'capp' : application, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, ! 'prcs' : process, } --- 193,223 ---- # _classdeclarations = { ! 'capp' : application, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, ! 'prcs' : process, ! } ! ! _propdeclarations = { ! 'appf' : _Prop_application_file, ! 'appt' : _Prop_total_partition_size, ! 'asty' : _Prop_file_type, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'dafi' : _Prop_desk_accessory_file, ! 'dpic' : _Prop_desktop_picture, ! 'fcrt' : _Prop_creator_type, ! 'file' : _Prop_file, ! 'hscr' : _Prop_has_scripting_terminology, ! 'isab' : _Prop_accepts_high_level_events, ! 'pisf' : _Prop_frontmost, ! 'pnam' : _Prop_name, ! 'pusd' : _Prop_partition_space_used, ! 'pvis' : _Prop_visible, ! 'revt' : _Prop_accepts_remote_events, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 1 Apr 2003 22:04:41 -0000 1.5 --- Standard_Suite.py 12 Apr 2003 22:27:09 -0000 1.6 *************** *** 14,319 **** class Standard_Suite_Events(Standard_Suite_Events): ! def close(self, _object, _attributes={}, **_arguments): ! """close: Close an object ! Required argument: the object to close ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'clos' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_count = { ! 'each' : 'kocl', ! } ! def count(self, _object, _attributes={}, **_arguments): ! """count: Return the number of elements of a particular class within an object ! Required argument: the object whose elements are to be counted ! Keyword argument each: the class of the elements to be counted ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the number of elements ! """ ! _code = 'core' ! _subcode = 'cnte' ! aetools.keysubst(_arguments, self._argmap_count) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_data_size = { ! 'as' : 'rtyp', ! } ! def data_size(self, _object, _attributes={}, **_arguments): ! """data size: Return the size in bytes of an object ! Required argument: the object whose data size is to be returned ! Keyword argument as: the data type for which the size is calculated ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the size of the object in bytes ! """ ! _code = 'core' ! _subcode = 'dsiz' ! aetools.keysubst(_arguments, self._argmap_data_size) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def delete(self, _object, _attributes={}, **_arguments): ! """delete: Move an item from its container to the trash ! Required argument: the item to delete ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the item that was just deleted ! """ ! _code = 'core' ! _subcode = 'delo' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_duplicate = { ! 'to' : 'insh', ! 'replacing' : 'alrp', ! 'routing_suppressed' : 'rout', ! } ! def duplicate(self, _object, _attributes={}, **_arguments): ! """duplicate: Duplicate one or more object(s) ! Required argument: the object(s) to duplicate ! Keyword argument to: the new location for the object(s) ! Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being duplicated ! Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when copying to the system folder. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the duplicated object(s) ! """ ! _code = 'core' ! _subcode = 'clon' ! aetools.keysubst(_arguments, self._argmap_duplicate) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'alrp', _Enum_bool) ! aetools.enumsubst(_arguments, 'rout', _Enum_bool) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def exists(self, _object, _attributes={}, **_arguments): ! """exists: Verify if an object exists ! Required argument: the object in question ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if it exists, false if not ! """ ! _code = 'core' ! _subcode = 'doex' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_make = { ! 'new' : 'kocl', ! 'at' : 'insh', ! 'to' : 'to ', ! 'with_properties' : 'prdt', ! } ! def make(self, _no_object=None, _attributes={}, **_arguments): ! """make: Make a new element ! Keyword argument new: the class of the new element ! Keyword argument at: the location at which to insert the element ! Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window ! Keyword argument with_properties: the initial values for the properties of the element ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the new object(s) ! """ ! _code = 'core' ! _subcode = 'crel' ! aetools.keysubst(_arguments, self._argmap_make) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_move = { ! 'to' : 'insh', ! 'replacing' : 'alrp', ! 'positioned_at' : 'mvpl', ! 'routing_suppressed' : 'rout', ! } ! def move(self, _object, _attributes={}, **_arguments): ! """move: Move object(s) to a new location ! Required argument: the object(s) to move ! Keyword argument to: the new location for the object(s) ! Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being moved ! Keyword argument positioned_at: Gives a list (in local window coordinates) of positions for the destination items ! Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when moving to the system folder. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the object(s) after they have been moved ! """ ! _code = 'core' ! _subcode = 'move' ! aetools.keysubst(_arguments, self._argmap_move) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'alrp', _Enum_bool) ! aetools.enumsubst(_arguments, 'mvpl', _Enum_list) ! aetools.enumsubst(_arguments, 'rout', _Enum_bool) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_open = { ! 'using' : 'usin', ! 'with_properties' : 'prdt', ! } ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument using: the application file to open the object with ! Keyword argument with_properties: the initial values for the properties, to be included with the open command sent to the application that opens the direct object ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! aetools.keysubst(_arguments, self._argmap_open) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_print_ = { ! 'with_properties' : 'prdt', ! } ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print the specified object(s) ! Required argument: list of objects to print ! Keyword argument with_properties: optional properties to be included with the print command sent to the application that prints the direct object ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'pdoc' ! aetools.keysubst(_arguments, self._argmap_print_) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit the Finder ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def select(self, _object, _attributes={}, **_arguments): ! """select: Select the specified object(s) ! Required argument: the object to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_list = None # XXXX enum list not found!! --- 14,319 ---- class Standard_Suite_Events(Standard_Suite_Events): ! def close(self, _object, _attributes={}, **_arguments): ! """close: Close an object ! Required argument: the object to close ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'clos' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_count = { ! 'each' : 'kocl', ! } ! def count(self, _object, _attributes={}, **_arguments): ! """count: Return the number of elements of a particular class within an object ! Required argument: the object whose elements are to be counted ! Keyword argument each: the class of the elements to be counted ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the number of elements ! """ ! _code = 'core' ! _subcode = 'cnte' ! aetools.keysubst(_arguments, self._argmap_count) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_data_size = { ! 'as' : 'rtyp', ! } ! def data_size(self, _object, _attributes={}, **_arguments): ! """data size: Return the size in bytes of an object ! Required argument: the object whose data size is to be returned ! Keyword argument as: the data type for which the size is calculated ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the size of the object in bytes ! """ ! _code = 'core' ! _subcode = 'dsiz' ! aetools.keysubst(_arguments, self._argmap_data_size) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def delete(self, _object, _attributes={}, **_arguments): ! """delete: Move an item from its container to the trash ! Required argument: the item to delete ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the item that was just deleted ! """ ! _code = 'core' ! _subcode = 'delo' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_duplicate = { ! 'to' : 'insh', ! 'replacing' : 'alrp', ! 'routing_suppressed' : 'rout', ! } ! def duplicate(self, _object, _attributes={}, **_arguments): ! """duplicate: Duplicate one or more object(s) ! Required argument: the object(s) to duplicate ! Keyword argument to: the new location for the object(s) ! Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being duplicated ! Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when copying to the system folder. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the duplicated object(s) ! """ ! _code = 'core' ! _subcode = 'clon' ! aetools.keysubst(_arguments, self._argmap_duplicate) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'alrp', _Enum_bool) ! aetools.enumsubst(_arguments, 'rout', _Enum_bool) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def exists(self, _object, _attributes={}, **_arguments): ! """exists: Verify if an object exists ! Required argument: the object in question ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if it exists, false if not ! """ ! _code = 'core' ! _subcode = 'doex' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_make = { ! 'new' : 'kocl', ! 'at' : 'insh', ! 'to' : 'to ', ! 'with_properties' : 'prdt', ! } ! def make(self, _no_object=None, _attributes={}, **_arguments): ! """make: Make a new element ! Keyword argument new: the class of the new element ! Keyword argument at: the location at which to insert the element ! Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window ! Keyword argument with_properties: the initial values for the properties of the element ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the new object(s) ! """ ! _code = 'core' ! _subcode = 'crel' ! aetools.keysubst(_arguments, self._argmap_make) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_move = { ! 'to' : 'insh', ! 'replacing' : 'alrp', ! 'positioned_at' : 'mvpl', ! 'routing_suppressed' : 'rout', ! } ! def move(self, _object, _attributes={}, **_arguments): ! """move: Move object(s) to a new location ! Required argument: the object(s) to move ! Keyword argument to: the new location for the object(s) ! Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being moved ! Keyword argument positioned_at: Gives a list (in local window coordinates) of positions for the destination items ! Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when moving to the system folder. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: to the object(s) after they have been moved ! """ ! _code = 'core' ! _subcode = 'move' ! aetools.keysubst(_arguments, self._argmap_move) ! _arguments['----'] = _object ! aetools.enumsubst(_arguments, 'alrp', _Enum_bool) ! aetools.enumsubst(_arguments, 'mvpl', _Enum_list) ! aetools.enumsubst(_arguments, 'rout', _Enum_bool) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_open = { ! 'using' : 'usin', ! 'with_properties' : 'prdt', ! } ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument using: the application file to open the object with ! Keyword argument with_properties: the initial values for the properties, to be included with the open command sent to the application that opens the direct object ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! aetools.keysubst(_arguments, self._argmap_open) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! _argmap_print_ = { ! 'with_properties' : 'prdt', ! } ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print the specified object(s) ! Required argument: list of objects to print ! Keyword argument with_properties: optional properties to be included with the print command sent to the application that prints the direct object ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'pdoc' ! aetools.keysubst(_arguments, self._argmap_print_) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit the Finder ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! def select(self, _object, _attributes={}, **_arguments): ! """select: Select the specified object(s) ! Required argument: the object to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] _Enum_list = None # XXXX enum list not found!! *************** *** 324,326 **** --- 324,335 ---- # _classdeclarations = { + } + + _propdeclarations = { + } + + _compdeclarations = { + } + + _enumdeclarations = { } Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Type_Definitions.py 1 Apr 2003 22:04:41 -0000 1.7 --- Type_Definitions.py 12 Apr 2003 22:27:09 -0000 1.8 *************** *** 13,205 **** class Type_Definitions_Events: ! pass class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use \xd4as alias list\xd5 when a list of aliases is needed (instead of a list of file system item references). """ ! want = 'alst' class label(aetools.ComponentItem): ! """label - (NOT AVAILABLE YET) A Finder label (name and color) """ ! want = 'clbl' class _Prop_color(aetools.NProperty): ! """color - the color associated with the label """ ! which = 'colr' ! want = 'cRGB' class _Prop_index(aetools.NProperty): ! """index - the index in the front-to-back ordering within its container """ ! which = 'pidx' ! want = 'long' class _Prop_name(aetools.NProperty): ! """name - the name associated with the label """ ! which = 'pnam' ! want = 'utxt' class preferences(aetools.ComponentItem): ! """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ ! want = 'cprf' class _Prop_button_view_arrangement(aetools.NProperty): ! """button view arrangement - the method of arrangement of icons in default Finder button view windows """ ! which = 'barr' ! want = 'earr' class _Prop_button_view_icon_size(aetools.NProperty): ! """button view icon size - the size of icons displayed in Finder button view windows. """ ! which = 'bisz' ! want = 'long' class _Prop_calculates_folder_sizes(aetools.NProperty): ! """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ ! which = 'sfsz' ! want = 'bool' class _Prop_delay_before_springing(aetools.NProperty): ! """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ ! which = 'dela' ! want = 'shor' class _Prop_list_view_icon_size(aetools.NProperty): ! """list view icon size - the size of icons displayed in Finder list view windows. """ ! which = 'lisz' ! want = 'long' class _Prop_shows_comments(aetools.NProperty): ! """shows comments - Are comments displayed in default Finder list view windows? """ ! which = 'scom' ! want = 'bool' class _Prop_shows_creation_date(aetools.NProperty): ! """shows creation date - Are creation dates displayed in default Finder list view windows? """ ! which = 'scda' ! want = 'bool' class _Prop_shows_kind(aetools.NProperty): ! """shows kind - Are document kinds displayed in default Finder list view windows? """ ! which = 'sknd' ! want = 'bool' class _Prop_shows_label(aetools.NProperty): ! """shows label - Are labels displayed in default Finder list view windows? """ ! which = 'slbl' ! want = 'bool' class _Prop_shows_modification_date(aetools.NProperty): ! """shows modification date - Are modification dates displayed in default Finder list view windows? """ ! which = 'sdat' ! want = 'bool' class _Prop_shows_size(aetools.NProperty): ! """shows size - Are file sizes displayed in default Finder list view windows? """ ! which = 'ssiz' ! want = 'bool' class _Prop_shows_version(aetools.NProperty): ! """shows version - Are file versions displayed in default Finder list view windows? """ ! which = 'svrs' ! want = 'bool' class _Prop_spatial_view_arrangement(aetools.NProperty): ! """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ ! which = 'iarr' ! want = 'earr' class _Prop_spatial_view_icon_size(aetools.NProperty): ! """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ ! which = 'iisz' ! want = 'long' class _Prop_spring_open_folders(aetools.NProperty): ! """spring open folders - Spring open folders after the specified delay? """ ! which = 'sprg' ! want = 'bool' class _Prop_uses_relative_dates(aetools.NProperty): ! """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ ! which = 'urdt' ! want = 'bool' class _Prop_uses_simple_menus(aetools.NProperty): ! """uses simple menus - Use simplified Finder menus? """ ! which = 'usme' ! want = 'bool' class _Prop_uses_wide_grid(aetools.NProperty): ! """uses wide grid - Space icons on a wide grid? """ ! which = 'uswg' ! want = 'bool' class _Prop_view_font(aetools.NProperty): ! """view font - the id of the font used in Finder views. """ ! which = 'vfnt' ! want = 'long' class _Prop_view_font_size(aetools.NProperty): ! """view font size - the size of the font used in Finder views """ ! which = 'vfsz' ! want = 'long' class _Prop_window(aetools.NProperty): ! """window - the window that would open if Finder preferences was opened """ ! which = 'cwin' ! want = 'pwnd' # element 'clbl' as ['indx', 'name'] class icon_view_options(aetools.ComponentItem): ! """icon view options - the icon view options """ ! want = 'icop' _Prop_arrangement = _Prop_spatial_view_arrangement class _Prop_icon_size(aetools.NProperty): ! """icon size - the size of icons displayed in the icon view """ ! which = 'lvis' ! want = 'shor' class icon_family(aetools.ComponentItem): ! """icon family - (NOT AVAILABLE YET) A family of icons """ ! want = 'ifam' class _Prop_large_32_bit_icon(aetools.NProperty): ! """large 32 bit icon - the large 32-bit color icon """ ! which = 'il32' ! want = 'il32' class _Prop_large_4_bit_icon(aetools.NProperty): ! """large 4 bit icon - the large 4-bit color icon """ ! which = 'icl4' ! want = 'icl4' class _Prop_large_8_bit_icon(aetools.NProperty): ! """large 8 bit icon - the large 8-bit color icon """ ! which = 'icl8' ! want = 'icl8' class _Prop_large_8_bit_mask(aetools.NProperty): ! """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ ! which = 'l8mk' ! want = 'l8mk' class _Prop_large_monochrome_icon_and_mask(aetools.NProperty): ! """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ ! which = 'ICN#' ! want = 'ICN#' class _Prop_small_32_bit_icon(aetools.NProperty): ! """small 32 bit icon - the small 32-bit color icon """ ! which = 'is32' ! want = 'is32' class _Prop_small_4_bit_icon(aetools.NProperty): ! """small 4 bit icon - the small 4-bit color icon """ ! which = 'ics4' ! want = 'ics4' class _Prop_small_8_bit_icon(aetools.NProperty): ! """small 8 bit icon - the small 8-bit color icon """ ! which = 'ics8' ! want = 'ics8' _Prop_small_8_bit_mask = _Prop_small_8_bit_icon class _Prop_small_monochrome_icon_and_mask(aetools.NProperty): ! """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ ! which = 'ics#' ! want = 'ics#' class column(aetools.ComponentItem): ! """column - a column of a list view """ ! want = 'lvcl' class _Prop_sort_direction(aetools.NProperty): ! """sort direction - The direction in which the window is sorted """ ! which = 'sord' ! want = 'sodr' class _Prop_visible(aetools.NProperty): ! """visible - is this column visible """ ! which = 'pvis' ! want = 'bool' class _Prop_width(aetools.NProperty): ! """width - the width of this column """ ! which = 'clwd' ! want = 'shor' columns = column class list_view_options(aetools.ComponentItem): ! """list view options - the list view options """ ! want = 'lvop' class _Prop_sort_column(aetools.NProperty): ! """sort column - the column that the list view is sorted on """ ! which = 'srtc' ! want = 'lvcl' # element 'lvcl' as ['indx', 'rele', 'rang', 'test'] alias_list._superclassnames = [] --- 13,205 ---- class Type_Definitions_Events: ! pass class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use \xd4as alias list\xd5 when a list of aliases is needed (instead of a list of file system item references). """ ! want = 'alst' class label(aetools.ComponentItem): ! """label - (NOT AVAILABLE YET) A Finder label (name and color) """ ! want = 'clbl' class _Prop_color(aetools.NProperty): ! """color - the color associated with the label """ ! which = 'colr' ! want = 'cRGB' class _Prop_index(aetools.NProperty): ! """index - the index in the front-to-back ordering within its container """ ! which = 'pidx' ! want = 'long' class _Prop_name(aetools.NProperty): ! """name - the name associated with the label """ ! which = 'pnam' ! want = 'utxt' class preferences(aetools.ComponentItem): ! """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ ! want = 'cprf' class _Prop_button_view_arrangement(aetools.NProperty): ! """button view arrangement - the method of arrangement of icons in default Finder button view windows """ ! which = 'barr' ! want = 'earr' class _Prop_button_view_icon_size(aetools.NProperty): ! """button view icon size - the size of icons displayed in Finder button view windows. """ ! which = 'bisz' ! want = 'long' class _Prop_calculates_folder_sizes(aetools.NProperty): ! """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ ! which = 'sfsz' ! want = 'bool' class _Prop_delay_before_springing(aetools.NProperty): ! """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ ! which = 'dela' ! want = 'shor' class _Prop_list_view_icon_size(aetools.NProperty): ! """list view icon size - the size of icons displayed in Finder list view windows. """ ! which = 'lisz' ! want = 'long' class _Prop_shows_comments(aetools.NProperty): ! """shows comments - Are comments displayed in default Finder list view windows? """ ! which = 'scom' ! want = 'bool' class _Prop_shows_creation_date(aetools.NProperty): ! """shows creation date - Are creation dates displayed in default Finder list view windows? """ ! which = 'scda' ! want = 'bool' class _Prop_shows_kind(aetools.NProperty): ! """shows kind - Are document kinds displayed in default Finder list view windows? """ ! which = 'sknd' ! want = 'bool' class _Prop_shows_label(aetools.NProperty): ! """shows label - Are labels displayed in default Finder list view windows? """ ! which = 'slbl' ! want = 'bool' class _Prop_shows_modification_date(aetools.NProperty): ! """shows modification date - Are modification dates displayed in default Finder list view windows? """ ! which = 'sdat' ! want = 'bool' class _Prop_shows_size(aetools.NProperty): ! """shows size - Are file sizes displayed in default Finder list view windows? """ ! which = 'ssiz' ! want = 'bool' class _Prop_shows_version(aetools.NProperty): ! """shows version - Are file versions displayed in default Finder list view windows? """ ! which = 'svrs' ! want = 'bool' class _Prop_spatial_view_arrangement(aetools.NProperty): ! """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ ! which = 'iarr' ! want = 'earr' class _Prop_spatial_view_icon_size(aetools.NProperty): ! """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ ! which = 'iisz' ! want = 'long' class _Prop_spring_open_folders(aetools.NProperty): ! """spring open folders - Spring open folders after the specified delay? """ ! which = 'sprg' ! want = 'bool' class _Prop_uses_relative_dates(aetools.NProperty): ! """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ ! which = 'urdt' ! want = 'bool' class _Prop_uses_simple_menus(aetools.NProperty): ! """uses simple menus - Use simplified Finder menus? """ ! which = 'usme' ! want = 'bool' class _Prop_uses_wide_grid(aetools.NProperty): ! """uses wide grid - Space icons on a wide grid? """ ! which = 'uswg' ! want = 'bool' class _Prop_view_font(aetools.NProperty): ! """view font - the id of the font used in Finder views. """ ! which = 'vfnt' ! want = 'long' class _Prop_view_font_size(aetools.NProperty): ! """view font size - the size of the font used in Finder views """ ! which = 'vfsz' ! want = 'long' class _Prop_window(aetools.NProperty): ! """window - the window that would open if Finder preferences was opened """ ! which = 'cwin' ! want = 'pwnd' # element 'clbl' as ['indx', 'name'] class icon_view_options(aetools.ComponentItem): ! """icon view options - the icon view options """ ! want = 'icop' _Prop_arrangement = _Prop_spatial_view_arrangement class _Prop_icon_size(aetools.NProperty): ! """icon size - the size of icons displayed in the icon view """ ! which = 'lvis' ! want = 'shor' class icon_family(aetools.ComponentItem): ! """icon family - (NOT AVAILABLE YET) A family of icons """ ! want = 'ifam' class _Prop_large_32_bit_icon(aetools.NProperty): ! """large 32 bit icon - the large 32-bit color icon """ ! which = 'il32' ! want = 'il32' class _Prop_large_4_bit_icon(aetools.NProperty): ! """large 4 bit icon - the large 4-bit color icon """ ! which = 'icl4' ! want = 'icl4' class _Prop_large_8_bit_icon(aetools.NProperty): ! """large 8 bit icon - the large 8-bit color icon """ ! which = 'icl8' ! want = 'icl8' class _Prop_large_8_bit_mask(aetools.NProperty): ! """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ ! which = 'l8mk' ! want = 'l8mk' class _Prop_large_monochrome_icon_and_mask(aetools.NProperty): ! """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ ! which = 'ICN#' ! want = 'ICN#' class _Prop_small_32_bit_icon(aetools.NProperty): ! """small 32 bit icon - the small 32-bit color icon """ ! which = 'is32' ! want = 'is32' class _Prop_small_4_bit_icon(aetools.NProperty): ! """small 4 bit icon - the small 4-bit color icon """ ! which = 'ics4' ! want = 'ics4' class _Prop_small_8_bit_icon(aetools.NProperty): ! """small 8 bit icon - the small 8-bit color icon """ ! which = 'ics8' ! want = 'ics8' _Prop_small_8_bit_mask = _Prop_small_8_bit_icon class _Prop_small_monochrome_icon_and_mask(aetools.NProperty): ! """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ ! which = 'ics#' ! want = 'ics#' class column(aetools.ComponentItem): ! """column - a column of a list view """ ! want = 'lvcl' class _Prop_sort_direction(aetools.NProperty): ! """sort direction - The direction in which the window is sorted """ ! which = 'sord' ! want = 'sodr' class _Prop_visible(aetools.NProperty): ! """visible - is this column visible """ ! which = 'pvis' ! want = 'bool' class _Prop_width(aetools.NProperty): ! """width - the width of this column """ ! which = 'clwd' ! want = 'shor' columns = column class list_view_options(aetools.ComponentItem): ! """list view options - the list view options """ ! want = 'lvop' class _Prop_sort_column(aetools.NProperty): ! """sort column - the column that the list view is sorted on """ ! which = 'srtc' ! want = 'lvcl' # element 'lvcl' as ['indx', 'rele', 'rang', 'test'] alias_list._superclassnames = [] *************** *** 210,216 **** label._superclassnames = [] label._privpropdict = { ! 'color' : _Prop_color, ! 'index' : _Prop_index, ! 'name' : _Prop_name, } label._privelemdict = { --- 210,216 ---- label._superclassnames = [] label._privpropdict = { ! 'color' : _Prop_color, ! 'index' : _Prop_index, ! 'name' : _Prop_name, } label._privelemdict = { *************** *** 218,250 **** preferences._superclassnames = [] preferences._privpropdict = { ! 'button_view_arrangement' : _Prop_button_view_arrangement, ! 'button_view_icon_size' : _Prop_button_view_icon_size, ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'delay_before_springing' : _Prop_delay_before_springing, ! 'list_view_icon_size' : _Prop_list_view_icon_size, ! 'shows_comments' : _Prop_shows_comments, ! 'shows_creation_date' : _Prop_shows_creation_date, ! 'shows_kind' : _Prop_shows_kind, ! 'shows_label' : _Prop_shows_label, ! 'shows_modification_date' : _Prop_shows_modification_date, ! 'shows_size' : _Prop_shows_size, ! 'shows_version' : _Prop_shows_version, ! 'spatial_view_arrangement' : _Prop_spatial_view_arrangement, ! 'spatial_view_icon_size' : _Prop_spatial_view_icon_size, ! 'spring_open_folders' : _Prop_spring_open_folders, ! 'uses_relative_dates' : _Prop_uses_relative_dates, ! 'uses_simple_menus' : _Prop_uses_simple_menus, ! 'uses_wide_grid' : _Prop_uses_wide_grid, ! 'view_font' : _Prop_view_font, ! 'view_font_size' : _Prop_view_font_size, ! 'window' : _Prop_window, } preferences._privelemdict = { ! 'label' : label, } icon_view_options._superclassnames = [] icon_view_options._privpropdict = { ! 'arrangement' : _Prop_arrangement, ! 'icon_size' : _Prop_icon_size, } icon_view_options._privelemdict = { --- 218,250 ---- preferences._superclassnames = [] preferences._privpropdict = { ! 'button_view_arrangement' : _Prop_button_view_arrangement, ! 'button_view_icon_size' : _Prop_button_view_icon_size, ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'delay_before_springing' : _Prop_delay_before_springing, ! 'list_view_icon_size' : _Prop_list_view_icon_size, ! 'shows_comments' : _Prop_shows_comments, ! 'shows_creation_date' : _Prop_shows_creation_date, ! 'shows_kind' : _Prop_shows_kind, ! 'shows_label' : _Prop_shows_label, ! 'shows_modification_date' : _Prop_shows_modification_date, ! 'shows_size' : _Prop_shows_size, ! 'shows_version' : _Prop_shows_version, ! 'spatial_view_arrangement' : _Prop_spatial_view_arrangement, ! 'spatial_view_icon_size' : _Prop_spatial_view_icon_size, ! 'spring_open_folders' : _Prop_spring_open_folders, ! 'uses_relative_dates' : _Prop_uses_relative_dates, ! 'uses_simple_menus' : _Prop_uses_simple_menus, ! 'uses_wide_grid' : _Prop_uses_wide_grid, ! 'view_font' : _Prop_view_font, ! 'view_font_size' : _Prop_view_font_size, ! 'window' : _Prop_window, } preferences._privelemdict = { ! 'label' : label, } icon_view_options._superclassnames = [] icon_view_options._privpropdict = { ! 'arrangement' : _Prop_arrangement, ! 'icon_size' : _Prop_icon_size, } icon_view_options._privelemdict = { *************** *** 252,265 **** icon_family._superclassnames = [] icon_family._privpropdict = { ! 'large_32_bit_icon' : _Prop_large_32_bit_icon, ! 'large_4_bit_icon' : _Prop_large_4_bit_icon, ! 'large_8_bit_icon' : _Prop_large_8_bit_icon, ! 'large_8_bit_mask' : _Prop_large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : _Prop_large_monochrome_icon_and_mask, ! 'small_32_bit_icon' : _Prop_small_32_bit_icon, ! 'small_4_bit_icon' : _Prop_small_4_bit_icon, ! 'small_8_bit_icon' : _Prop_small_8_bit_icon, ! 'small_8_bit_mask' : _Prop_small_8_bit_mask, ! 'small_monochrome_icon_and_mask' : _Prop_small_monochrome_icon_and_mask, } icon_family._privelemdict = { --- 252,265 ---- icon_family._superclassnames = [] icon_family._privpropdict = { ! 'large_32_bit_icon' : _Prop_large_32_bit_icon, ! 'large_4_bit_icon' : _Prop_large_4_bit_icon, ! 'large_8_bit_icon' : _Prop_large_8_bit_icon, ! 'large_8_bit_mask' : _Prop_large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : _Prop_large_monochrome_icon_and_mask, ! 'small_32_bit_icon' : _Prop_small_32_bit_icon, ! 'small_4_bit_icon' : _Prop_small_4_bit_icon, ! 'small_8_bit_icon' : _Prop_small_8_bit_icon, ! 'small_8_bit_mask' : _Prop_small_8_bit_mask, ! 'small_monochrome_icon_and_mask' : _Prop_small_monochrome_icon_and_mask, } icon_family._privelemdict = { *************** *** 267,275 **** column._superclassnames = [] column._privpropdict = { ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'sort_direction' : _Prop_sort_direction, ! 'visible' : _Prop_visible, ! 'width' : _Prop_width, } column._privelemdict = { --- 267,275 ---- column._superclassnames = [] column._privpropdict = { ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'sort_direction' : _Prop_sort_direction, ! 'visible' : _Prop_visible, ! 'width' : _Prop_width, } column._privelemdict = { *************** *** 277,287 **** list_view_options._superclassnames = [] list_view_options._privpropdict = { ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'icon_size' : _Prop_icon_size, ! 'sort_column' : _Prop_sort_column, ! 'uses_relative_dates' : _Prop_uses_relative_dates, } list_view_options._privelemdict = { ! 'column' : column, } --- 277,287 ---- list_view_options._superclassnames = [] list_view_options._privpropdict = { ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'icon_size' : _Prop_icon_size, ! 'sort_column' : _Prop_sort_column, ! 'uses_relative_dates' : _Prop_uses_relative_dates, } list_view_options._privelemdict = { ! 'column' : column, } *************** *** 290,299 **** # _classdeclarations = { ! 'alst' : alias_list, ! 'clbl' : label, ! 'cprf' : preferences, ! 'icop' : icon_view_options, ! 'ifam' : icon_family, ! 'lvcl' : column, ! 'lvop' : list_view_options, } --- 290,346 ---- # _classdeclarations = { ! 'alst' : alias_list, ! 'clbl' : label, ! 'cprf' : preferences, ! 'icop' : icon_view_options, ! 'ifam' : icon_family, ! 'lvcl' : column, ! 'lvop' : list_view_options, ! } ! ! _propdeclarations = { ! 'ICN#' : _Prop_large_monochrome_icon_and_mask, ! 'barr' : _Prop_button_view_arrangement, ! 'bisz' : _Prop_button_view_icon_size, ! 'clwd' : _Prop_width, ! 'colr' : _Prop_color, ! 'cwin' : _Prop_window, ! 'dela' : _Prop_delay_before_springing, ! 'iarr' : _Prop_spatial_view_arrangement, ! 'icl4' : _Prop_large_4_bit_icon, ! 'icl8' : _Prop_large_8_bit_icon, ! 'ics#' : _Prop_small_monochrome_icon_and_mask, ! 'ics4' : _Prop_small_4_bit_icon, ! 'ics8' : _Prop_small_8_bit_icon, ! 'iisz' : _Prop_spatial_view_icon_size, ! 'il32' : _Prop_large_32_bit_icon, ! 'is32' : _Prop_small_32_bit_icon, ! 'l8mk' : _Prop_large_8_bit_mask, ! 'lisz' : _Prop_list_view_icon_size, ! 'lvis' : _Prop_icon_size, ! 'pidx' : _Prop_index, ! 'pnam' : _Prop_name, ! 'pvis' : _Prop_visible, ! 'scda' : _Prop_shows_creation_date, ! 'scom' : _Prop_shows_comments, ! 'sdat' : _Prop_shows_modification_date, ! 'sfsz' : _Prop_calculates_folder_sizes, ! 'sknd' : _Prop_shows_kind, ! 'slbl' : _Prop_shows_label, ! 'sord' : _Prop_sort_direction, ! 'sprg' : _Prop_spring_open_folders, ! 'srtc' : _Prop_sort_column, ! 'ssiz' : _Prop_shows_size, ! 'svrs' : _Prop_shows_version, ! 'urdt' : _Prop_uses_relative_dates, ! 'usme' : _Prop_uses_simple_menus, ! 'uswg' : _Prop_uses_wide_grid, ! 'vfnt' : _Prop_view_font, ! 'vfsz' : _Prop_view_font_size, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Window_classes.py 1 Apr 2003 22:04:43 -0000 1.7 --- Window_classes.py 12 Apr 2003 22:27:09 -0000 1.8 *************** *** 13,143 **** class Window_classes_Events: ! pass class Finder_window(aetools.ComponentItem): ! """Finder window - A file viewer window """ ! want = 'brow' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the window class """ ! which = 'c@#^' ! want = 'cwin' class _Prop_current_view(aetools.NProperty): ! """current view - the current view for the container window """ ! which = 'pvew' ! want = 'ecvw' class _Prop_icon_view_options(aetools.NProperty): ! """icon view options - the icon view options for the container window """ ! which = 'icop' ! want = 'icop' class _Prop_list_view_options(aetools.NProperty): ! """list view options - the list view options for the container window """ ! which = 'lvop' ! want = 'lvop' class _Prop_target(aetools.NProperty): ! """target - the container at which this file viewer is targeted """ ! which = 'fvtg' ! want = 'obj ' Finder_windows = Finder_window class window(aetools.ComponentItem): ! """window - A window """ ! want = 'cwin' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_closeable(aetools.NProperty): ! """closeable - Does the window have a close box? """ ! which = 'hclb' ! want = 'bool' class _Prop_collapsed(aetools.NProperty): ! """collapsed - Is the window collapsed """ ! which = 'wshd' ! want = 'bool' class _Prop_floating(aetools.NProperty): ! """floating - Does the window have a title bar? """ ! which = 'isfl' ! want = 'bool' class _Prop_id(aetools.NProperty): ! """id - the unique id for this window """ ! which = 'ID ' ! want = 'magn' class _Prop_index(aetools.NProperty): ! """index - the number of the window in the front-to-back layer ordering """ ! which = 'pidx' ! want = 'long' class _Prop_modal(aetools.NProperty): ! """modal - Is the window modal? """ ! which = 'pmod' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the name of the window """ ! which = 'pnam' ! want = 'utxt' class _Prop_position(aetools.NProperty): ! """position - the upper left position of the window """ ! which = 'posn' ! want = 'QDpt' class _Prop_properties(aetools.NProperty): ! """properties - every property of a window """ ! which = 'pALL' ! want = 'reco' class _Prop_resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class _Prop_titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' ! want = 'bool' class _Prop_visible(aetools.NProperty): ! """visible - Is the window visible (always true for open Finder windows)? """ ! which = 'pvis' ! want = 'bool' class _Prop_zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' ! want = 'bool' class _Prop_zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' class _Prop_zoomed_full_size(aetools.NProperty): ! """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ ! which = 'zumf' ! want = 'bool' windows = window class information_window(aetools.ComponentItem): ! """information window - An inspector window (opened by \xd2Show Info\xd3) """ ! want = 'iwnd' class _Prop_current_panel(aetools.NProperty): ! """current panel - the current panel in the information window """ ! which = 'panl' ! want = 'ipnl' class _Prop_item(aetools.NProperty): ! """item - the item from which this window was opened """ ! which = 'cobj' ! want = 'obj ' class clipping_window(aetools.ComponentItem): ! """clipping window - The window containing a clipping """ ! want = 'lwnd' clipping_windows = clipping_window class preferences_window(aetools.ComponentItem): ! """preferences window - (NOT AVAILABLE YET) The Finder Preferences window """ ! want = 'pwnd' Finder_window._superclassnames = ['window'] Finder_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_view' : _Prop_current_view, ! 'icon_view_options' : _Prop_icon_view_options, ! 'list_view_options' : _Prop_list_view_options, ! 'target' : _Prop_target, } Finder_window._privelemdict = { --- 13,143 ---- class Window_classes_Events: ! pass class Finder_window(aetools.ComponentItem): ! """Finder window - A file viewer window """ ! want = 'brow' class _Prop__3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the window class """ ! which = 'c@#^' ! want = 'cwin' class _Prop_current_view(aetools.NProperty): ! """current view - the current view for the container window """ ! which = 'pvew' ! want = 'ecvw' class _Prop_icon_view_options(aetools.NProperty): ! """icon view options - the icon view options for the container window """ ! which = 'icop' ! want = 'icop' class _Prop_list_view_options(aetools.NProperty): ! """list view options - the list view options for the container window """ ! which = 'lvop' ! want = 'lvop' class _Prop_target(aetools.NProperty): ! """target - the container at which this file viewer is targeted """ ! which = 'fvtg' ! want = 'obj ' Finder_windows = Finder_window class window(aetools.ComponentItem): ! """window - A window """ ! want = 'cwin' class _Prop_bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class _Prop_closeable(aetools.NProperty): ! """closeable - Does the window have a close box? """ ! which = 'hclb' ! want = 'bool' class _Prop_collapsed(aetools.NProperty): ! """collapsed - Is the window collapsed """ ! which = 'wshd' ! want = 'bool' class _Prop_floating(aetools.NProperty): ! """floating - Does the window have a title bar? """ ! which = 'isfl' ! want = 'bool' class _Prop_id(aetools.NProperty): ! """id - the unique id for this window """ ! which = 'ID ' ! want = 'magn' class _Prop_index(aetools.NProperty): ! """index - the number of the window in the front-to-back layer ordering """ ! which = 'pidx' ! want = 'long' class _Prop_modal(aetools.NProperty): ! """modal - Is the window modal? """ ! which = 'pmod' ! want = 'bool' class _Prop_name(aetools.NProperty): ! """name - the name of the window """ ! which = 'pnam' ! want = 'utxt' class _Prop_position(aetools.NProperty): ! """position - the upper left position of the window """ ! which = 'posn' ! want = 'QDpt' class _Prop_properties(aetools.NProperty): ! """properties - every property of a window """ ! which = 'pALL' ! want = 'reco' class _Prop_resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class _Prop_titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' ! want = 'bool' class _Prop_visible(aetools.NProperty): ! """visible - Is the window visible (always true for open Finder windows)? """ ! which = 'pvis' ! want = 'bool' class _Prop_zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' ! want = 'bool' class _Prop_zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' class _Prop_zoomed_full_size(aetools.NProperty): ! """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ ! which = 'zumf' ! want = 'bool' windows = window class information_window(aetools.ComponentItem): ! """information window - An inspector window (opened by \xd2Show Info\xd3) """ ! want = 'iwnd' class _Prop_current_panel(aetools.NProperty): ! """current panel - the current panel in the information window """ ! which = 'panl' ! want = 'ipnl' class _Prop_item(aetools.NProperty): ! """item - the item from which this window was opened """ ! which = 'cobj' ! want = 'obj ' class clipping_window(aetools.ComponentItem): ! """clipping window - The window containing a clipping """ ! want = 'lwnd' clipping_windows = clipping_window class preferences_window(aetools.ComponentItem): ! """preferences window - (NOT AVAILABLE YET) The Finder Preferences window """ ! want = 'pwnd' Finder_window._superclassnames = ['window'] Finder_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_view' : _Prop_current_view, ! 'icon_view_options' : _Prop_icon_view_options, ! 'list_view_options' : _Prop_list_view_options, ! 'target' : _Prop_target, } Finder_window._privelemdict = { *************** *** 145,164 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'collapsed' : _Prop_collapsed, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, ! 'zoomed_full_size' : _Prop_zoomed_full_size, } window._privelemdict = { --- 145,164 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'collapsed' : _Prop_collapsed, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, ! 'zoomed_full_size' : _Prop_zoomed_full_size, } window._privelemdict = { *************** *** 166,172 **** information_window._superclassnames = ['window'] information_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, ! 'item' : _Prop_item, } information_window._privelemdict = { --- 166,172 ---- information_window._superclassnames = ['window'] information_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, ! 'item' : _Prop_item, } information_window._privelemdict = { *************** *** 174,178 **** clipping_window._superclassnames = ['window'] clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } clipping_window._privelemdict = { --- 174,178 ---- clipping_window._superclassnames = ['window'] clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } clipping_window._privelemdict = { *************** *** 180,185 **** preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, } preferences_window._privelemdict = { --- 180,185 ---- preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, } preferences_window._privelemdict = { *************** *** 190,197 **** # _classdeclarations = { ! 'brow' : Finder_window, ! 'cwin' : window, ! 'iwnd' : information_window, ! 'lwnd' : clipping_window, ! 'pwnd' : preferences_window, } --- 190,229 ---- # _classdeclarations = { ! 'brow' : Finder_window, ! 'cwin' : window, ! 'iwnd' : information_window, ! 'lwnd' : clipping_window, ! 'pwnd' : preferences_window, ! } ! ! _propdeclarations = { ! 'ID ' : _Prop_id, ! 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'cobj' : _Prop_item, ! 'fvtg' : _Prop_target, ! 'hclb' : _Prop_closeable, ! 'icop' : _Prop_icon_view_options, ! 'isfl' : _Prop_floating, ! 'iszm' : _Prop_zoomable, ! 'lvop' : _Prop_list_view_options, ! 'pALL' : _Prop_properties, ! 'panl' : _Prop_current_panel, ! 'pbnd' : _Prop_bounds, ! 'pidx' : _Prop_index, ! 'pmod' : _Prop_modal, ! 'pnam' : _Prop_name, ! 'posn' : _Prop_position, ! 'prsz' : _Prop_resizable, ! 'ptit' : _Prop_titled, ! 'pvew' : _Prop_current_view, ! 'pvis' : _Prop_visible, ! 'pzum' : _Prop_zoomed, ! 'wshd' : _Prop_collapsed, ! 'zumf' : _Prop_zoomed_full_size, ! } ! ! _compdeclarations = { ! } ! ! _enumdeclarations = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 1 Apr 2003 22:04:44 -0000 1.7 --- __init__.py 12 Apr 2003 22:27:09 -0000 1.8 *************** *** 16,28 **** _code_to_module = { ! 'CoRe' : Standard_Suite, ! 'fleg' : Legacy_suite, ! 'fndr' : Containers_and_folders, ! 'fndr' : Files, ! 'fndr' : Finder_Basics, ! 'fndr' : Finder_items, ! 'fndr' : Window_classes, ! 'tpdf' : Type_Definitions, ! 'tpnm' : Enumerations, } --- 16,28 ---- _code_to_module = { ! 'CoRe' : Standard_Suite, ! 'fleg' : Legacy_suite, ! 'fndr' : Containers_and_folders, ! 'fndr' : Files, ! 'fndr' : Finder_Basics, ! 'fndr' : Finder_items, ! 'fndr' : Window_classes, ! 'tpdf' : Type_Definitions, ! 'tpnm' : Enumerations, } *************** *** 30,42 **** _code_to_fullname = { ! 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), ! 'fleg' : ('Finder.Legacy_suite', 'Legacy_suite'), ! 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), ! 'fndr' : ('Finder.Files', 'Files'), ! 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), ! 'fndr' : ('Finder.Finder_items', 'Finder_items'), ! 'fndr' : ('Finder.Window_classes', 'Window_classes'), ! 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), ! 'tpnm' : ('Finder.Enumerations', 'Enumerations'), } --- 30,42 ---- _code_to_fullname = { ! 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), ! 'fleg' : ('Finder.Legacy_suite', 'Legacy_suite'), ! 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), ! 'fndr' : ('Finder.Files', 'Files'), ! 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), ! 'fndr' : ('Finder.Finder_items', 'Finder_items'), ! 'fndr' : ('Finder.Window_classes', 'Window_classes'), ! 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), ! 'tpnm' : ('Finder.Enumerations', 'Enumerations'), } *************** *** 52,65 **** def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites --- 52,65 ---- def getbaseclasses(v): ! if not getattr(v, '_propdict', None): ! v._propdict = {} ! v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites *************** *** 68,78 **** # Set property and element dictionaries now that all classes have been defined # getbaseclasses(application) - getbaseclasses(trash_2d_object) - getbaseclasses(desktop_2d_object) - getbaseclasses(container) - getbaseclasses(folder) - getbaseclasses(disk) - getbaseclasses(item) getbaseclasses(package) getbaseclasses(file) --- 68,75 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(process) + getbaseclasses(application_process) + getbaseclasses(desk_accessory_process) getbaseclasses(application) getbaseclasses(package) getbaseclasses(file) *************** *** 82,94 **** getbaseclasses(document_file) getbaseclasses(clipping) - getbaseclasses(preferences_window) - getbaseclasses(Finder_window) - getbaseclasses(window) - getbaseclasses(clipping_window) - getbaseclasses(information_window) - getbaseclasses(process) - getbaseclasses(application_process) - getbaseclasses(desk_accessory_process) - getbaseclasses(application) getbaseclasses(icon_view_options) getbaseclasses(label) --- 79,82 ---- *************** *** 98,101 **** --- 86,101 ---- getbaseclasses(icon_family) getbaseclasses(list_view_options) + getbaseclasses(application) + getbaseclasses(item) + getbaseclasses(trash_2d_object) + getbaseclasses(desktop_2d_object) + getbaseclasses(container) + getbaseclasses(folder) + getbaseclasses(disk) + getbaseclasses(preferences_window) + getbaseclasses(Finder_window) + getbaseclasses(window) + getbaseclasses(clipping_window) + getbaseclasses(information_window) getbaseclasses(StdSuites.Type_Names_Suite.double_integer) getbaseclasses(StdSuites.Type_Names_Suite.version) *************** *** 143,231 **** # _classdeclarations = { ! 'capp' : application, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'ctnr' : container, ! 'cfol' : folder, ! 'cdis' : disk, ! 'cobj' : item, ! 'pack' : package, ! 'file' : file, ! 'appf' : application_file, ! 'alia' : alias_file, ! 'inlf' : internet_location_file, ! 'docf' : document_file, ! 'clpf' : clipping, ! 'pwnd' : preferences_window, ! 'brow' : Finder_window, ! 'cwin' : window, ! 'lwnd' : clipping_window, ! 'iwnd' : information_window, ! 'prcs' : process, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, ! 'capp' : application, ! 'icop' : icon_view_options, ! 'clbl' : label, ! 'lvcl' : column, ! 'cprf' : preferences, ! 'alst' : alias_list, ! 'ifam' : icon_family, ! 'lvop' : list_view_options, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } class Finder(Standard_Suite_Events, ! Legacy_suite_Events, ! Containers_and_folders_Events, ! Files_Events, ! Finder_Basics_Events, ! Finder_items_Events, ! Window_classes_Events, ! Type_Definitions_Events, ! Enumerations_Events, ! aetools.TalkTo): ! _signature = 'MACS' ! _moduleName = 'Finder' --- 143,231 ---- # _classdeclarations = { ! 'prcs' : process, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, ! 'capp' : application, ! 'pack' : package, ! 'file' : file, ! 'appf' : application_file, ! 'alia' : alias_file, ! 'inlf' : internet_location_file, ! 'docf' : document_file, ! 'clpf' : clipping, ! 'icop' : icon_view_options, ! 'clbl' : label, ! 'lvcl' : column, ! 'cprf' : preferences, ! 'alst' : alias_list, ! 'ifam' : icon_family, ! 'lvop' : list_view_options, ! 'capp' : application, ! 'cobj' : item, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'ctnr' : container, ! 'cfol' : folder, ! 'cdis' : disk, ! 'pwnd' : preferences_window, ! 'brow' : Finder_window, ! 'cwin' : window, ! 'lwnd' : clipping_window, ! 'iwnd' : information_window, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } class Finder(Standard_Suite_Events, ! Legacy_suite_Events, ! Containers_and_folders_Events, ! Files_Events, ! Finder_Basics_Events, ! Finder_items_Events, ! Window_classes_Events, ! Type_Definitions_Events, ! Enumerations_Events, ! aetools.TalkTo): ! _signature = 'MACS' ! _moduleName = 'Finder' From akuchling@users.sourceforge.net Sun Apr 13 02:46:32 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 12 Apr 2003 18:46:32 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv22372 Modified Files: pep-0314.txt Log Message: Remove post history Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0314.txt 12 Apr 2003 21:31:28 -0000 1.4 --- pep-0314.txt 13 Apr 2003 01:46:30 -0000 1.5 *************** *** 6,10 **** Created: 12-Apr-2003 Status: Draft ! Post-History: 12-Apr-2003 Introduction --- 6,10 ---- Created: 12-Apr-2003 Status: Draft ! Post-History: Introduction From tim_one@users.sourceforge.net Sun Apr 13 04:25:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 12 Apr 2003 20:25:17 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv12069/Modules Modified Files: _csv.c Log Message: Must declare vrbls at the tops of blocks in C89 (wouldn't compile). Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _csv.c 12 Apr 2003 19:23:46 -0000 1.9 --- _csv.c 13 Apr 2003 03:25:15 -0000 1.10 *************** *** 353,358 **** /* And extract the attributes */ for (i = 0; i < PyList_GET_SIZE(dir_list); ++i) { name_obj = PyList_GET_ITEM(dir_list, i); ! char *s = PyString_AsString(name_obj); if (s == NULL) return -1; --- 353,359 ---- /* And extract the attributes */ for (i = 0; i < PyList_GET_SIZE(dir_list); ++i) { + char *s; name_obj = PyList_GET_ITEM(dir_list, i); ! s = PyString_AsString(name_obj); if (s == NULL) return -1; From akuchling@users.sourceforge.net Sun Apr 13 22:13:04 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun, 13 Apr 2003 14:13:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.134,1.135 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv31609 Modified Files: whatsnew23.tex Log Message: Use simpler import Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** whatsnew23.tex 9 Apr 2003 17:26:38 -0000 1.134 --- whatsnew23.tex 13 Apr 2003 21:13:02 -0000 1.135 *************** *** 858,862 **** \begin{verbatim} ! from csv import csv input = open('datafile', 'rb') --- 858,862 ---- \begin{verbatim} ! import csv input = open('datafile', 'rb') From akuchling@users.sourceforge.net Sun Apr 13 22:44:31 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun, 13 Apr 2003 14:44:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv13986 Modified Files: whatsnew23.tex Log Message: Mention timeit module Fix error in description of logging package's 'propagate' Mention default arg to dict.pop() Link to more module docs (I wonder if I should adopt some convention such as linking the first mention of all new modules to the LibRef?) Various text changes Bump version number and Python version Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** whatsnew23.tex 13 Apr 2003 21:13:02 -0000 1.135 --- whatsnew23.tex 13 Apr 2003 21:44:28 -0000 1.136 *************** *** 4,8 **** \title{What's New in Python 2.3} ! \release{0.09} \author{A.M.\ Kuchling} \authoraddress{\email{amk@amk.ca}} --- 4,8 ---- \title{What's New in Python 2.3} ! \release{0.10} \author{A.M.\ Kuchling} \authoraddress{\email{amk@amk.ca}} *************** *** 12,15 **** --- 12,16 ---- \tableofcontents + % To do: % MacOS framework-related changes (section of its own, probably) *************** *** 17,21 **** {\large This article is a draft, and is currently up to date for ! Python 2.3alpha1. Please send any additions, comments or errata to the author.} --- 18,22 ---- {\large This article is a draft, and is currently up to date for ! Python 2.3alpha2. Please send any additions, comments or errata to the author.} *************** *** 512,516 **** Log records are usually propagated up the hierarchy, so a message logged to \samp{server.auth} is also seen by \samp{server} and ! \samp{root}, but a handler can prevent this by setting its \member{propagate} attribute to \constant{False}. --- 513,517 ---- Log records are usually propagated up the hierarchy, so a message logged to \samp{server.auth} is also seen by \samp{server} and ! \samp{root}, but a \class{Logger} can prevent this by setting its \member{propagate} attribute to \constant{False}. *************** *** 521,534 **** can also have an attached list of filters, and each filter can cause the \class{LogRecord} to be ignored or can modify the record before ! passing it along. \class{LogRecord} instances are converted to text ! for output by a \class{Formatter} class. All of these classes can be ! replaced by your own specially-written classes. With all of these features the \module{logging} package should provide enough flexibility for even the most complicated applications. This ! is only a partial overview of the \module{logging} package, so please ! see the \ulink{package's reference ! documentation}{../lib/module-logging.html} for all of the details. ! Reading \pep{282} will also be helpful. --- 522,534 ---- can also have an attached list of filters, and each filter can cause the \class{LogRecord} to be ignored or can modify the record before ! passing it along. When they're finally output, \class{LogRecord} ! instances are converted to text by a \class{Formatter} class. All of ! these classes can be replaced by your own specially-written classes. With all of these features the \module{logging} package should provide enough flexibility for even the most complicated applications. This ! is only an incomplete overview of its features, so please see the ! \ulink{package's reference documentation}{../lib/module-logging.html} ! for all of the details. Reading \pep{282} will also be helpful. *************** *** 1086,1094 **** as described in section~\ref{section-slices} of this document. ! \item Dictionaries have a new method, \method{pop(\var{key})}, that ! returns the value corresponding to \var{key} and removes that ! key/value pair from the dictionary. \method{pop()} will raise a ! \exception{KeyError} if the requested key isn't present in the ! dictionary: \begin{verbatim} --- 1086,1094 ---- as described in section~\ref{section-slices} of this document. ! \item Dictionaries have a new method, \method{pop(\var{key}\optional{, ! \var{default}})}, that returns the value corresponding to \var{key} ! and removes that key/value pair from the dictionary. If the requested ! key isn't present in the dictionary, \var{default} is returned if ! it's specified and \exception{KeyError} raised if it isn't. \begin{verbatim} *************** *** 1637,1643 **** \class{TextWrapper} class and the \function{wrap()} and \function{fill()} functions support a number of additional keyword ! arguments for fine-tuning the formatting; consult the module's ! documentation for details. ! %XXX add a link to the module docs? (Contributed by Greg Ward.) --- 1637,1642 ---- \class{TextWrapper} class and the \function{wrap()} and \function{fill()} functions support a number of additional keyword ! arguments for fine-tuning the formatting; consult the \ulink{module's ! documentation}{../lib/module-textwrap.html} for details. (Contributed by Greg Ward.) *************** *** 1649,1653 **** rely on threads to run) by putting the following code at the top: - % XXX why as _threading? \begin{verbatim} try: --- 1648,1651 ---- *************** *** 1662,1666 **** magically make multithreaded code run without threads; code that waits for another thread to return or to do something will simply hang ! forever. \item The \module{time} module's \function{strptime()} function has --- 1660,1666 ---- magically make multithreaded code run without threads; code that waits for another thread to return or to do something will simply hang ! forever. (In this example, \module{_threading} is used as the module ! name to make it clear that the module being used is not necessarily ! the actual \module{threading} module.) \item The \module{time} module's \function{strptime()} function has *************** *** 1671,1674 **** --- 1671,1698 ---- identically on all platforms. + \item The new \module{timeit} module helps measure how long snippets + of Python code take to execute. The \file{timeit.py} file can be run + directly from the command line, or the module's \class{Timer} class + can be imported and used directly. Here's a short example that + figures out whether it's faster to convert an 8-bit string to Unicode + by appending an empty Unicode string to it or by using the + \function{unicode()} function: + + \begin{verbatim} + import timeit + + timer1 = timeit.Timer('unicode("abc")') + timer2 = timeit.Timer('"abc" + u""') + + # Run three trials + print timer1.repeat(repeat=3, number=100000) + print timer2.repeat(repeat=3, number=100000) + + # On my laptop this outputs: + # [0.36831796169281006, 0.37441694736480713, 0.35304892063140869] + # [0.17574405670166016, 0.18193507194519043, 0.17565798759460449] + \end{verbatim} + + \item The \module{UserDict} module has a new \class{DictMixin} class which defines all dictionary methods for classes that already have a minimum *************** *** 1828,1832 **** For more information, refer to the \ulink{module's reference ! documentation}{..//lib/module-datetime.html}. (Contributed by Tim Peters.) --- 1852,1856 ---- For more information, refer to the \ulink{module's reference ! documentation}{../lib/module-datetime.html}. (Contributed by Tim Peters.) *************** *** 1901,1915 **** % $ prevent Emacs tex-mode from getting confused Optik was written by Greg Ward, with suggestions from the readers of the Getopt SIG. - \begin{seealso} - \seeurl{http://optik.sourceforge.net/} - {The Optik site has tutorial and reference documentation for - \module{optparse}. - % XXX change to point to Python docs, when those docs get written. - } - \end{seealso} - %====================================================================== --- 1925,1934 ---- % $ prevent Emacs tex-mode from getting confused + See the \ulink{module's documentation}{../lib/module-optparse.html} + for more details. + Optik was written by Greg Ward, with suggestions from the readers of the Getopt SIG. %====================================================================== *************** *** 2253,2261 **** The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Jeff Bauer, Simon Brunning, Michael Chermside, Andrew Dalke, Scott David ! Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael ! Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo ! Martins, Gustavo Niemeyer, Neal Norwitz, Hans Nowak, Chris Reedy, ! Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason Tishler, Just van~Rossum. \end{document} --- 2272,2281 ---- The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Jeff Bauer, Simon Brunning, Brett Cannon, Michael Chermside, ! Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, ! Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, ! Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, ! Neal Norwitz, Hans Nowak, Chris Reedy, Vinay Sajip, Neil Schemenauer, ! Roman Suzi, Jason Tishler, Just van~Rossum. \end{document} From tim_one@users.sourceforge.net Sun Apr 13 23:13:11 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 13 Apr 2003 15:13:11 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.285,2.286 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27848/Python Modified Files: bltinmodule.c Log Message: handle_range_longs(): refcount handling is very delicate here, and the code erroneously decrefed the istep argument in an error case. This caused a co_consts tuple to lose a float constant prematurely, which eventually caused gc to try executing static data in floatobject.c (don't ask ). So reworked this extensively to ensure refcount correctness. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.285 retrieving revision 2.286 diff -C2 -d -r2.285 -r2.286 *** bltinmodule.c 11 Apr 2003 18:43:06 -0000 2.285 --- bltinmodule.c 13 Apr 2003 22:13:08 -0000 2.286 *************** *** 1320,1326 **** { PyObject *ilow; ! PyObject *ihigh; ! PyObject *zero = NULL; PyObject *istep = NULL; PyObject *curnum = NULL; PyObject *v = NULL; --- 1320,1326 ---- { PyObject *ilow; ! PyObject *ihigh = NULL; PyObject *istep = NULL; + PyObject *curnum = NULL; PyObject *v = NULL; *************** *** 1329,1360 **** int cmp_result; ! zero = PyLong_FromLong(0L); if (zero == NULL) return NULL; ! ilow = zero; /* Default lower bound */ ! if (!PyArg_ParseTuple(args, "O", &ihigh, &istep)) { ! PyErr_Clear(); ! if (!PyArg_ParseTuple(args, ! "OO|O;range() requires 1-3 int arguments", ! &ilow, &ihigh, &istep)) ! goto Fail; ! } ! ! if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { ! PyErr_SetString(PyExc_ValueError, ! "integer start argument expected, got float."); ! goto Fail; return NULL; } ! if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { ! PyErr_SetString(PyExc_ValueError, ! "integer end argument expected, got float."); ! goto Fail; ! return NULL; } ! /* If no istep was supplied, default to 1. */ if (istep == NULL) { istep = PyLong_FromLong(1L); --- 1329,1361 ---- int cmp_result; ! PyObject *zero = PyLong_FromLong(0); ! if (zero == NULL) return NULL; ! if (!PyArg_UnpackTuple(args, "range", 1, 3, &ilow, &ihigh, &istep)) { ! Py_DECREF(zero); return NULL; } ! /* Figure out which way we were called, supply defaults, and be ! * sure to incref everything so that the decrefs at the end ! * are correct. ! */ ! assert(ilow != NULL); ! if (ihigh == NULL) { ! /* only 1 arg -- it's the upper limit */ ! ihigh = ilow; ! ilow = NULL; } + assert(ihigh != NULL); + Py_INCREF(ihigh); ! /* ihigh correct now; do ilow */ ! if (ilow == NULL) ! ilow = zero; ! Py_INCREF(ilow); ! ! /* ilow and ihigh correct now; do istep */ if (istep == NULL) { istep = PyLong_FromLong(1L); *************** *** 1363,1378 **** } else { - if (!PyInt_Check(istep) && !PyLong_Check(istep)) { - PyErr_SetString(PyExc_ValueError, - "integer step argument expected, got float."); - goto Fail; - } Py_INCREF(istep); } ! if (PyObject_Cmp(istep, zero, &cmp_result) == -1) { goto Fail; } if (cmp_result == 0) { PyErr_SetString(PyExc_ValueError, --- 1364,1393 ---- } else { Py_INCREF(istep); } ! /* XXX What reason do we have to believe that if an arg isn't an ! * XXX int, it must be a float? ! */ ! if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { ! PyErr_SetString(PyExc_ValueError, ! "integer start argument expected, got float."); ! goto Fail; ! } ! ! if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { ! PyErr_SetString(PyExc_ValueError, ! "integer end argument expected, got float."); ! goto Fail; ! } ! ! if (!PyInt_Check(istep) && !PyLong_Check(istep)) { ! PyErr_SetString(PyExc_ValueError, ! "integer step argument expected, got float."); goto Fail; } + if (PyObject_Cmp(istep, zero, &cmp_result) == -1) + goto Fail; if (cmp_result == 0) { PyErr_SetString(PyExc_ValueError, *************** *** 1420,1432 **** curnum = tmp_num; } ! Py_DECREF(curnum); Py_DECREF(istep); Py_DECREF(zero); return v; Fail: ! Py_XDECREF(curnum); Py_XDECREF(istep); ! Py_XDECREF(zero); Py_XDECREF(v); return NULL; --- 1435,1451 ---- curnum = tmp_num; } ! Py_DECREF(ilow); ! Py_DECREF(ihigh); Py_DECREF(istep); Py_DECREF(zero); + Py_DECREF(curnum); return v; Fail: ! Py_DECREF(ilow); ! Py_DECREF(ihigh); Py_XDECREF(istep); ! Py_DECREF(zero); ! Py_XDECREF(curnum); Py_XDECREF(v); return NULL; From nnorwitz@users.sourceforge.net Mon Apr 14 02:18:35 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 13 Apr 2003 18:18:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tarfile.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv645/Lib/test Modified Files: test_tarfile.py Log Message: Get test working if gzip support is not available Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_tarfile.py 7 Mar 2003 13:27:53 -0000 1.6 --- test_tarfile.py 14 Apr 2003 01:18:32 -0000 1.7 *************** *** 11,15 **** try: import gzip ! except ImportError: gzip = None try: --- 11,16 ---- try: import gzip ! gzip.GzipFile ! except (ImportError, AttributeError): gzip = None try: From jhylton@users.sourceforge.net Mon Apr 14 03:20:58 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 13 Apr 2003 19:20:58 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv5179/Modules Modified Files: _csv.c Log Message: Make readers and writers participate in garbage collection. Fix memory leak in dialect_init(). Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _csv.c 13 Apr 2003 03:25:15 -0000 1.10 --- _csv.c 14 Apr 2003 02:20:55 -0000 1.11 *************** *** 324,330 **** if (PyString_Check(dialect) #ifdef Py_USING_UNICODE ! || PyUnicode_Check(dialect) #endif ! ) { PyObject * new_dia; new_dia = get_dialect_from_registry(dialect); --- 324,330 ---- if (PyString_Check(dialect) #ifdef Py_USING_UNICODE ! || PyUnicode_Check(dialect) #endif ! ) { PyObject * new_dia; new_dia = get_dialect_from_registry(dialect); *************** *** 334,338 **** dialect = new_dia; } ! /* A class rather than an instance? Instanciate */ if (PyObject_TypeCheck(dialect, &PyClass_Type)) { PyObject * new_dia; --- 334,338 ---- dialect = new_dia; } ! /* A class rather than an instance? Instantiate */ if (PyObject_TypeCheck(dialect, &PyClass_Type)) { PyObject * new_dia; *************** *** 364,368 **** --- 364,370 ---- if (PyObject_SetAttr((PyObject *)self, name_obj, value_obj)) { + Py_DECREF(value_obj); Py_DECREF(dir_list); + Py_DECREF(dialect); return -1; } *************** *** 443,447 **** PyType_GenericAlloc, /* tp_alloc */ dialect_new, /* tp_new */ ! 0, /* tp_free */ }; --- 445,449 ---- PyType_GenericAlloc, /* tp_alloc */ dialect_new, /* tp_new */ ! 0, /* tp_free */ }; *************** *** 738,742 **** Py_XDECREF(self->input_iter); Py_XDECREF(self->fields); ! PyMem_DEL(self); } --- 740,772 ---- Py_XDECREF(self->input_iter); Py_XDECREF(self->fields); ! PyObject_GC_Del(self); ! } ! ! static int ! Reader_traverse(ReaderObj *self, visitproc visit, void *arg) ! { ! int err; ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->dialect); ! VISIT(self->input_iter); ! VISIT(self->fields); ! return 0; ! } ! ! static int ! Reader_clear(ReaderObj *self) ! { ! Py_XDECREF(self->dialect); ! Py_XDECREF(self->input_iter); ! Py_XDECREF(self->fields); ! self->dialect = NULL; ! self->input_iter = NULL; ! self->fields = NULL; ! return 0; } *************** *** 774,781 **** 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Reader_Type_doc, /*tp_doc*/ ! 0, /*tp_traverse*/ ! 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ --- 804,812 ---- 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | ! Py_TPFLAGS_HAVE_GC, /*tp_flags*/ Reader_Type_doc, /*tp_doc*/ ! (traverseproc)Reader_traverse, /*tp_traverse*/ ! (inquiry)Reader_clear, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ *************** *** 792,796 **** { PyObject * iterator, * dialect = NULL, *ctor_args; ! ReaderObj * self = PyObject_NEW(ReaderObj, &Reader_Type); if (!self) --- 823,827 ---- { PyObject * iterator, * dialect = NULL, *ctor_args; ! ReaderObj * self = PyObject_GC_New(ReaderObj, &Reader_Type); if (!self) *************** *** 1161,1165 **** Py_XDECREF(self->dialect); Py_XDECREF(self->writeline); ! PyMem_DEL(self); } --- 1192,1221 ---- Py_XDECREF(self->dialect); Py_XDECREF(self->writeline); ! PyObject_GC_Del(self); ! } ! ! static int ! Writer_traverse(WriterObj *self, visitproc visit, void *arg) ! { ! int err; ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->dialect); ! VISIT(self->writeline); ! return 0; ! } ! ! static int ! Writer_clear(WriterObj *self) ! { ! Py_XDECREF(self->dialect); ! Py_XDECREF(self->writeline); ! self->dialect = NULL; ! self->writeline = NULL; ! return 0; } *************** *** 1193,1200 **** 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ Writer_Type_doc, ! 0, /*tp_traverse*/ ! 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ --- 1249,1257 ---- 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | ! Py_TPFLAGS_HAVE_GC, /*tp_flags*/ Writer_Type_doc, ! (traverseproc)Writer_traverse, /*tp_traverse*/ ! (inquiry)Writer_clear, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ *************** *** 1210,1214 **** { PyObject * output_file, * dialect = NULL, *ctor_args; ! WriterObj * self = PyObject_NEW(WriterObj, &Writer_Type); if (!self) --- 1267,1271 ---- { PyObject * output_file, * dialect = NULL, *ctor_args; ! WriterObj * self = PyObject_GC_New(WriterObj, &Writer_Type); if (!self) From jlt63@users.sourceforge.net Mon Apr 14 13:51:31 2003 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Mon, 14 Apr 2003 05:51:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv8459 Modified Files: cygwinccompiler.py Log Message: Patch #709178: remove -static option from cygwinccompiler After some more reflection (and no negative feedback), I am reverting the original patch and applying my version, cygwinccompiler.py-shared.diff, instead. My reasons are the following: 1. support for older toolchains is retained 2. support for new toolchains (i.e., ld -shared) is added The goal of my approach is to avoid breaking older toolchains while adding better support for newer ones. Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** cygwinccompiler.py 9 Apr 2003 20:13:59 -0000 1.23 --- cygwinccompiler.py 14 Apr 2003 12:51:26 -0000 1.24 *************** *** 34,38 **** --- 34,48 ---- # - its dllwrap doesn't work, there is a bug in binutils 2.10.90 # see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html + # - using gcc -mdll instead dllwrap doesn't work without -static because + # it tries to link against dlls instead their import libraries. (If + # it finds the dll first.) + # By specifying -static we force ld to link against the import libraries, + # this is windows standard and there are normally not the necessary symbols + # in the dlls. # *** only the version of June 2000 shows these problems + # * cygwin gcc 3.2/ld 2.13.90 works + # (ld supports -shared) + # * mingw gcc 3.2/ld 2.13 works + # (ld supports -shared) # This module should be kept compatible with Python 1.5.2. *************** *** 78,82 **** self.dllwrap_version) ) ! # ld_version >= "2.10.90" should also be able to use # gcc -mdll instead of dllwrap # Older dllwraps had own version numbers, newer ones use the --- 88,92 ---- self.dllwrap_version) ) ! # ld_version >= "2.10.90" and < "2.13" should also be able to use # gcc -mdll instead of dllwrap # Older dllwraps had own version numbers, newer ones use the *************** *** 88,91 **** --- 98,108 ---- self.linker_dll = "dllwrap" + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static + if self.ld_version >= "2.13": + shared_option = "-shared" + else: + shared_option = "-mdll -static" + # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. *************** *** 93,98 **** compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', ! linker_so=('%s -mcygwin -mdll' % ! self.linker_dll)) # cygwin and mingw32 need different sets of libraries --- 110,115 ---- compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', ! linker_so=('%s -mcygwin %s' % ! (self.linker_dll, shared_option))) # cygwin and mingw32 need different sets of libraries *************** *** 263,266 **** --- 280,290 ---- CygwinCCompiler.__init__ (self, verbose, dry_run, force) + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static + if self.ld_version >= "2.13": + shared_option = "-shared" + else: + shared_option = "-mdll -static" + # A real mingw32 doesn't need to specify a different entry point, # but cygwin 2.91.57 in no-cygwin-mode needs it. *************** *** 273,278 **** compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', ! linker_so='%s -mno-cygwin -mdll %s' ! % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished # dlls need another dll (mingwm10.dll see Mingw32 docs) --- 297,303 ---- compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', ! linker_so='%s -mno-cygwin %s %s' ! % (self.linker_dll, shared_option, ! entry_point)) # Maybe we should also append -mthreads, but then the finished # dlls need another dll (mingwm10.dll see Mingw32 docs) From akuchling@users.sourceforge.net Mon Apr 14 16:31:31 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 14 Apr 2003 08:31:31 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13067 Modified Files: itertoolsmodule.c Log Message: Fix docstring typo Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** itertoolsmodule.c 17 Mar 2003 19:46:08 -0000 1.9 --- itertoolsmodule.c 14 Apr 2003 15:31:27 -0000 1.10 *************** *** 1767,1771 **** count([n]) --> n, n+1, n+2, ...\n\ cycle(p) --> p0, p1, ... plast, p0, p1, ...\n\ ! repeat(elem [,n]) --> elem, elem, elem, ... endlessly or upto n times\n\ \n\ Iterators terminating on the shortest input sequence:\n\ --- 1767,1771 ---- count([n]) --> n, n+1, n+2, ...\n\ cycle(p) --> p0, p1, ... plast, p0, p1, ...\n\ ! repeat(elem [,n]) --> elem, elem, elem, ... endlessly or up to n times\n\ \n\ Iterators terminating on the shortest input sequence:\n\ From akuchling@users.sourceforge.net Mon Apr 14 16:32:20 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 14 Apr 2003 08:32:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librlcompleter.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13489 Modified Files: librlcompleter.tex Log Message: Typo fix Index: librlcompleter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librlcompleter.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** librlcompleter.tex 10 Aug 2001 16:15:08 -0000 1.7 --- librlcompleter.tex 14 Apr 2003 15:32:18 -0000 1.8 *************** *** 59,63 **** If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but it ! can generate calls to \method{__getattr__()}) upto the last part, and find matches for the rest via the \function{dir()} function. \end{methoddesc} --- 59,63 ---- If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but it ! can generate calls to \method{__getattr__()}) up to the last part, and find matches for the rest via the \function{dir()} function. \end{methoddesc} From gvanrossum@users.sourceforge.net Mon Apr 14 18:59:38 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 10:59:38 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.87,2.88 sre_constants.h,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv12812/Modules Modified Files: _sre.c sre_constants.h Log Message: SF patch #720991 by Gary Herron: A small fix for bug #545855 and Greg Chapman's addition of op code SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of pattern '*?' on a long string. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -d -r2.87 -r2.88 *** _sre.c 22 Nov 2002 12:46:35 -0000 2.87 --- _sre.c 14 Apr 2003 17:59:34 -0000 2.88 *************** *** 994,997 **** --- 994,1057 ---- return 0; + case SRE_OP_MIN_REPEAT_ONE: + /* match repeated sequence (minimizing regexp) */ + + /* this operator only works if the repeated item is + exactly one character wide, and we're not already + collecting backtracking points. for other cases, + use the MIN_REPEAT operator */ + + /* <1=min> <2=max> item tail */ + + TRACE(("|%p|%p|MIN_REPEAT_ONE %d %d\n", pattern, ptr, + pattern[1], pattern[2])); + + if (ptr + pattern[1] > end) + return 0; /* cannot match */ + + state->ptr = ptr; + + if (pattern[1] == 0) + count = 0; + else { + /* count using pattern min as the maximum */ + count = SRE_COUNT(state, pattern + 3, pattern[1], level + 1); + + if (count < 0) + return count; /* exception */ + if (count < (int) pattern[1]) + return 0; /* did not match minimum number of times */ + ptr += count; /* advance past minimum matches of repeat */ + } + + if (pattern[pattern[0]] == SRE_OP_SUCCESS) { + /* tail is empty. we're finished */ + state->ptr = ptr; + return 1; + + } else { + /* general case */ + int matchmax = ((int)pattern[2] == 65535); + int c; + lastmark = state->lastmark; + while (matchmax || count <= (int) pattern[2]) { + state->ptr = ptr; + i = SRE_MATCH(state, pattern + pattern[0], level + 1); + if (i) + return i; + state->ptr = ptr; + c = SRE_COUNT(state, pattern+3, 1, level+1); + if (c < 0) + return c; + if (c == 0) + break; + assert(c == 1); + ptr++; + count++; + } + lastmark_restore(state, lastmark); + } + return 0; + case SRE_OP_REPEAT: /* create repeat context. all the hard work is done Index: sre_constants.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sre_constants.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** sre_constants.h 2 Jul 2001 16:58:38 -0000 2.13 --- sre_constants.h 14 Apr 2003 17:59:34 -0000 2.14 *************** *** 43,46 **** --- 43,47 ---- #define SRE_OP_REPEAT_ONE 28 #define SRE_OP_SUBPATTERN 29 + #define SRE_OP_MIN_REPEAT_ONE 30 #define SRE_AT_BEGINNING 0 #define SRE_AT_BEGINNING_LINE 1 From gvanrossum@users.sourceforge.net Mon Apr 14 19:00:04 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 11:00:04 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.720,1.721 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv12812/Misc Modified Files: NEWS Log Message: SF patch #720991 by Gary Herron: A small fix for bug #545855 and Greg Chapman's addition of op code SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of pattern '*?' on a long string. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.720 retrieving revision 1.721 diff -C2 -d -r1.720 -r1.721 *** NEWS 11 Apr 2003 18:43:03 -0000 1.720 --- NEWS 14 Apr 2003 17:59:29 -0000 1.721 *************** *** 55,58 **** --- 55,62 ---- ----------------- + - The .*? pattern in the re module is now special-cased to avoid the + recursion limit. (SF patch #720991 -- many thanks to Gary Herron + and Greg Chapman.) + - New function sys.call_tracing() allows pdb to debug code recursively. From gvanrossum@users.sourceforge.net Mon Apr 14 19:00:08 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 11:00:08 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.45,1.46 sre_constants.py,1.30,1.31 sre_parse.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12812/Lib Modified Files: sre_compile.py sre_constants.py sre_parse.py Log Message: SF patch #720991 by Gary Herron: A small fix for bug #545855 and Greg Chapman's addition of op code SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of pattern '*?' on a long string. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** sre_compile.py 24 Feb 2003 01:18:35 -0000 1.45 --- sre_compile.py 14 Apr 2003 17:59:31 -0000 1.46 *************** *** 56,61 **** emit(OPCODES[SUCCESS]) code[skip] = len(code) - skip ! elif _simple(av) and op == MAX_REPEAT: ! emit(OPCODES[REPEAT_ONE]) skip = len(code); emit(0) emit(av[0]) --- 56,64 ---- emit(OPCODES[SUCCESS]) code[skip] = len(code) - skip ! elif _simple(av) and op != REPEAT: ! if op == MAX_REPEAT: ! emit(OPCODES[REPEAT_ONE]) ! else: ! emit(OPCODES[MIN_REPEAT_ONE]) skip = len(code); emit(0) emit(av[0]) Index: sre_constants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_constants.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** sre_constants.py 4 Sep 2001 19:10:20 -0000 1.30 --- sre_constants.py 14 Apr 2003 17:59:32 -0000 1.31 *************** *** 61,64 **** --- 61,65 ---- REPEAT_ONE = "repeat_one" SUBPATTERN = "subpattern" + MIN_REPEAT_ONE = "min_repeat_one" # positions *************** *** 121,125 **** REPEAT, REPEAT_ONE, ! SUBPATTERN ] --- 122,127 ---- REPEAT, REPEAT_ONE, ! SUBPATTERN, ! MIN_REPEAT_ONE ] Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** sre_parse.py 2 Jun 2002 00:40:05 -0000 1.55 --- sre_parse.py 14 Apr 2003 17:59:32 -0000 1.56 *************** *** 420,424 **** set.append((LITERAL, ord("-"))) break ! else: if this[0] == "\\": code2 = _class_escape(source, this) --- 420,424 ---- set.append((LITERAL, ord("-"))) break ! elif this: if this[0] == "\\": code2 = _class_escape(source, this) *************** *** 432,435 **** --- 432,437 ---- raise error, "bad character range" set.append((RANGE, (lo, hi))) + else: + raise error, "unexpected end of regular expression" else: if code1[0] is IN: From gvanrossum@users.sourceforge.net Mon Apr 14 19:00:07 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 11:00:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sre.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12812/Lib/test Modified Files: test_sre.py Log Message: SF patch #720991 by Gary Herron: A small fix for bug #545855 and Greg Chapman's addition of op code SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of pattern '*?' on a long string. Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** test_sre.py 6 Nov 2002 14:06:52 -0000 1.38 --- test_sre.py 14 Apr 2003 17:59:33 -0000 1.39 *************** *** 84,87 **** --- 84,100 ---- test(r"""sre.match(r'(?Pa)(?Pb)?b','ab').lastgroup""", 'a') + # bug 545855 -- This pattern failed to cause a compile error as it + # should, instead provoking a TypeError. + test(r"""sre.compile('foo[a-')""", None, sre.error) + + # bugs 418626 at al. -- Testing Greg Chapman's addition of op code + # SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of + # pattern '*?' on a long string. + test(r"""sre.match('.*?c', 10000*'ab'+'cd').end(0)""", 20001) + test(r"""sre.match('.*?cd', 5000*'ab'+'c'+5000*'ab'+'cde').end(0)""", 20003) + test(r"""sre.match('.*?cd', 20000*'abc'+'de').end(0)""", 60001) + # non-simple '*?' still recurses and hits the recursion limit + test(r"""sre.search('(a|b)*?c', 10000*'ab'+'cd').end(0)""", None, RuntimeError) + if verbose: print 'Running tests on sre.sub' From gvanrossum@users.sourceforge.net Mon Apr 14 19:25:10 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 11:25:10 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.286,2.287 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24329 Modified Files: bltinmodule.c Log Message: Prompted by Tim's comment, when handle_range_longs() sees an unexpected type, report the actual type rather than 'float'. (It's hard to even reach this code with a float. :-) Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.286 retrieving revision 2.287 diff -C2 -d -r2.286 -r2.287 *** bltinmodule.c 13 Apr 2003 22:13:08 -0000 2.286 --- bltinmodule.c 14 Apr 2003 18:25:04 -0000 2.287 *************** *** 1367,1388 **** } - /* XXX What reason do we have to believe that if an arg isn't an - * XXX int, it must be a float? - */ if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { ! PyErr_SetString(PyExc_ValueError, ! "integer start argument expected, got float."); goto Fail; } if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { ! PyErr_SetString(PyExc_ValueError, ! "integer end argument expected, got float."); goto Fail; } if (!PyInt_Check(istep) && !PyLong_Check(istep)) { ! PyErr_SetString(PyExc_ValueError, ! "integer step argument expected, got float."); goto Fail; } --- 1367,1388 ---- } if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { ! PyErr_Format(PyExc_ValueError, ! "integer start argument expected, got %s.", ! ilow->ob_type->tp_name); goto Fail; } if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { ! PyErr_Format(PyExc_ValueError, ! "integer end argument expected, got %s.", ! ihigh->ob_type->tp_name); goto Fail; } if (!PyInt_Check(istep) && !PyLong_Check(istep)) { ! PyErr_Format(PyExc_ValueError, ! "integer step argument expected, got %s.", ! istep->ob_type->tp_name); goto Fail; } From akuchling@users.sourceforge.net Mon Apr 14 19:47:34 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 14 Apr 2003 11:47:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.136,1.137 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv2594 Modified Files: whatsnew23.tex Log Message: Add a name Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** whatsnew23.tex 13 Apr 2003 21:44:28 -0000 1.136 --- whatsnew23.tex 14 Apr 2003 18:47:28 -0000 1.137 *************** *** 2276,2280 **** Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, ! Neal Norwitz, Hans Nowak, Chris Reedy, Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason Tishler, Just van~Rossum. --- 2276,2281 ---- Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, ! Neal Norwitz, Hans Nowak, Chris Reedy, Francesco Ricciardi, ! Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason Tishler, Just van~Rossum. From gvanrossum@users.sourceforge.net Mon Apr 14 21:58:20 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 13:58:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv887/Doc/lib Modified Files: libstdtypes.tex Log Message: - list.insert(i, x) now interprets negative i as it would be interpreted by slicing, so negative values count from the end of the list. This was the only place where such an interpretation was not placed on a list index. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** libstdtypes.tex 20 Mar 2003 22:17:59 -0000 1.121 --- libstdtypes.tex 14 Apr 2003 20:58:14 -0000 1.122 *************** *** 942,947 **** {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)} \lineiii{\var{s}.insert(\var{i}, \var{x})} ! {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} ! if \code{\var{i} >= 0}}{(5)} \lineiii{\var{s}.pop(\optional{\var{i}})} {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(6)} --- 942,946 ---- {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)} \lineiii{\var{s}.insert(\var{i}, \var{x})} ! {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]}}{(5)} \lineiii{\var{s}.pop(\optional{\var{i}})} {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(6)} *************** *** 983,988 **** \item[(5)] When a negative index is passed as the first parameter to ! the \method{insert()} method, the new element is prepended to the ! sequence. \item[(6)] The \method{pop()} method is only supported by the list and --- 982,989 ---- \item[(5)] When a negative index is passed as the first parameter to ! the \method{insert()} method, the list length is added, as for slice ! indices. If it is still negative, it is truncated to zero, as for ! slice indices. \versionchanged[Previously, all negative indices ! were truncated to zero]{2.3} \item[(6)] The \method{pop()} method is only supported by the list and From gvanrossum@users.sourceforge.net Mon Apr 14 21:58:41 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 13:58:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv887/Lib/test Modified Files: test_types.py Log Message: - list.insert(i, x) now interprets negative i as it would be interpreted by slicing, so negative values count from the end of the list. This was the only place where such an interpretation was not placed on a list index. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** test_types.py 6 Mar 2003 23:54:27 -0000 1.47 --- test_types.py 14 Apr 2003 20:58:03 -0000 1.48 *************** *** 346,349 **** --- 346,354 ---- a.insert(2,0) if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert' + b = a[:] + b.insert(-2, "foo") + b.insert(-200, "left") + b.insert(200, "right") + if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2' if a.count(0) != 2: raise TestFailed, ' list count' if a.index(0) != 2: raise TestFailed, 'list index' From gvanrossum@users.sourceforge.net Mon Apr 14 21:58:46 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 13:58:46 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.721,1.722 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv887/Misc Modified Files: NEWS Log Message: - list.insert(i, x) now interprets negative i as it would be interpreted by slicing, so negative values count from the end of the list. This was the only place where such an interpretation was not placed on a list index. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.721 retrieving revision 1.722 diff -C2 -d -r1.721 -r1.722 *** NEWS 14 Apr 2003 17:59:29 -0000 1.721 --- NEWS 14 Apr 2003 20:58:08 -0000 1.722 *************** *** 13,16 **** --- 13,21 ---- ----------------- + - list.insert(i, x) now interprets negative i as it would be + interpreted by slicing, so negative values count from the end of the + list. This was the only place where such an interpretation was not + placed on a list index. + - range() now works even if the arguments are longs with magnitude larger than sys.maxint, as long as the total length of the sequence From gvanrossum@users.sourceforge.net Mon Apr 14 21:58:48 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 13:58:48 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.147,2.148 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv887/Objects Modified Files: listobject.c Log Message: - list.insert(i, x) now interprets negative i as it would be interpreted by slicing, so negative values count from the end of the list. This was the only place where such an interpretation was not placed on a list index. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.147 retrieving revision 2.148 diff -C2 -d -r2.147 -r2.148 *** listobject.c 17 Mar 2003 19:46:10 -0000 2.147 --- listobject.c 14 Apr 2003 20:58:13 -0000 2.148 *************** *** 160,165 **** return -1; } ! if (where < 0) ! where = 0; if (where > self->ob_size) where = self->ob_size; --- 160,168 ---- return -1; } ! if (where < 0) { ! where += self->ob_size; ! if (where < 0) ! where = 0; ! } if (where > self->ob_size) where = self->ob_size; From gvanrossum@users.sourceforge.net Mon Apr 14 22:20:35 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 14:20:35 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.222,2.223 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv12066 Modified Files: typeobject.c Log Message: super_getattro(): kill some dead code; explain a mystery. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.222 retrieving revision 2.223 diff -C2 -d -r2.222 -r2.223 *** typeobject.c 9 Apr 2003 21:01:42 -0000 2.222 --- typeobject.c 14 Apr 2003 21:20:26 -0000 2.223 *************** *** 5356,5376 **** break; } - #if 0 - if (i >= n && PyType_Check(su->obj)) { - starttype = (PyTypeObject *)(su->obj); - mro = starttype->tp_mro; - if (mro == NULL) - n = 0; - else { - assert(PyTuple_Check(mro)); - n = PyTuple_GET_SIZE(mro); - } - for (i = 0; i < n; i++) { - if ((PyObject *)(su->type) == - PyTuple_GET_ITEM(mro, i)) - break; - } - } - #endif i++; res = NULL; --- 5356,5359 ---- *************** *** 5384,5388 **** continue; res = PyDict_GetItem(dict, name); ! if (res != NULL && !PyDescr_IsData(res)) { Py_INCREF(res); f = res->ob_type->tp_descr_get; --- 5367,5374 ---- continue; res = PyDict_GetItem(dict, name); ! /* Skip data descriptors because when obj_type is a ! metaclass, we don't want to return its __class__ ! descriptor. See supers() in test_descr.py. */ ! if (res != NULL && !PyDescr_IsData(res)) { Py_INCREF(res); f = res->ob_type->tp_descr_get; From gvanrossum@users.sourceforge.net Mon Apr 14 22:46:05 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 14:46:05 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.223,2.224 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv22940/Objects Modified Files: typeobject.c Log Message: Close off the "Verre Carlo hack" as discussed on python-dev. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.223 retrieving revision 2.224 diff -C2 -d -r2.223 -r2.224 *** typeobject.c 14 Apr 2003 21:20:26 -0000 2.223 --- typeobject.c 14 Apr 2003 21:46:02 -0000 2.224 *************** *** 3575,3578 **** --- 3575,3596 ---- } + /* Helper to check for object.__setattr__ or __delattr__ applied to a type. + This is called the Verre Carlo hack after its discoverer. */ + static int + hackcheck(PyObject *self, setattrofunc func, char *what) + { + PyTypeObject *type = self->ob_type; + while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE) + type = type->tp_base; + if (type->tp_setattro != func) { + PyErr_Format(PyExc_TypeError, + "can't apply this %s to %s object", + what, + type->tp_name); + return 0; + } + return 1; + } + static PyObject * wrap_setattr(PyObject *self, PyObject *args, void *wrapped) *************** *** 3584,3587 **** --- 3602,3607 ---- if (!PyArg_ParseTuple(args, "OO", &name, &value)) return NULL; + if (!hackcheck(self, func, "__setattr__")) + return NULL; res = (*func)(self, name, value); if (res < 0) *************** *** 3599,3602 **** --- 3619,3624 ---- if (!PyArg_ParseTuple(args, "O", &name)) + return NULL; + if (!hackcheck(self, func, "__delattr__")) return NULL; res = (*func)(self, name, NULL); From gvanrossum@users.sourceforge.net Mon Apr 14 22:46:06 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 14:46:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.188,1.189 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22940/Lib/test Modified Files: test_descr.py Log Message: Close off the "Verre Carlo hack" as discussed on python-dev. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** test_descr.py 6 Apr 2003 19:13:40 -0000 1.188 --- test_descr.py 14 Apr 2003 21:46:03 -0000 1.189 *************** *** 3841,3844 **** --- 3841,3860 ---- vereq(C.__dict__["f"](p), "B.f->C.f") + def verrecarlo(): + if verbose: + print "Testing prohibition of Verre Carlo's hack..." + try: + object.__setattr__(str, "foo", 42) + except TypeError: + pass + else: + raise TestFailed, "Verre Carlo __setattr__ suceeded!" + try: + object.__delattr__(str, "lower") + except TypeError: + pass + else: + raise TestFailed, "Verre Carlo __delattr__ succeeded!" + def test_main(): *************** *** 3930,3933 **** --- 3946,3950 ---- isinst_isclass() proxysuper() + verrecarlo() if verbose: print "All OK" From gvanrossum@users.sourceforge.net Mon Apr 14 23:02:01 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 15:02:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28774/Lib/test Modified Files: test_datetime.py Log Message: The date class is now properly subclassable. (SF bug #720908) (This is only the tip of the iceberg; the time and datetime classes need the same treatment.) Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_datetime.py 19 Feb 2003 02:35:05 -0000 1.40 --- test_datetime.py 14 Apr 2003 22:01:58 -0000 1.41 *************** *** 480,483 **** --- 480,489 ---- self.assertEqual(dt2, dt - days) + def test_subclass_date(self): + class C(date): + theAnswer = 42 + dt = C(2003, 4, 14) + self.assertEqual(dt.__class__, C) + class TestDate(HarmlessMixedComparison): # Tests here should pass for both dates and datetimes, except for a From gvanrossum@users.sourceforge.net Mon Apr 14 23:02:00 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 15:02:00 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28774/Modules Modified Files: datetimemodule.c Log Message: The date class is now properly subclassable. (SF bug #720908) (This is only the tip of the iceberg; the time and datetime classes need the same treatment.) Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** datetimemodule.c 8 Feb 2003 03:28:59 -0000 1.59 --- datetimemodule.c 14 Apr 2003 22:01:57 -0000 1.60 *************** *** 1292,1300 **** /* Create a date instance with no range checking. */ static PyObject * ! new_date(int year, int month, int day) { PyDateTime_Date *self; ! self = PyObject_New(PyDateTime_Date, &PyDateTime_DateType); if (self != NULL) set_date_fields(self, year, month, day); --- 1292,1300 ---- /* Create a date instance with no range checking. */ static PyObject * ! new_date_ex(int year, int month, int day, PyTypeObject *type) { PyDateTime_Date *self; ! self = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (self != NULL) set_date_fields(self, year, month, day); *************** *** 1302,1305 **** --- 1302,1308 ---- } + #define new_date(year, month, day) \ + (new_date_ex(year, month, day, &PyDateTime_DateType)) + /* Create a datetime instance with no range checking. */ static PyObject * *************** *** 2169,2173 **** PyDateTime_Date *me; ! me = PyObject_New(PyDateTime_Date, &PyDateTime_DateType); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 2172,2176 ---- PyDateTime_Date *me; ! me = PyObject_New(PyDateTime_Date, type); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 2182,2186 **** if (check_date_args(year, month, day) < 0) return NULL; ! self = new_date(year, month, day); } return self; --- 2185,2189 ---- if (check_date_args(year, month, day) < 0) return NULL; ! self = new_date_ex(year, month, day, type); } return self; *************** *** 2633,2637 **** sizeof(PyDateTime_Date), /* tp_basicsize */ 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ --- 2636,2640 ---- sizeof(PyDateTime_Date), /* tp_basicsize */ 0, /* tp_itemsize */ ! 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ From gvanrossum@users.sourceforge.net Mon Apr 14 23:02:30 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 14 Apr 2003 15:02:30 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.722,1.723 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28774/Misc Modified Files: NEWS Log Message: The date class is now properly subclassable. (SF bug #720908) (This is only the tip of the iceberg; the time and datetime classes need the same treatment.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.722 retrieving revision 1.723 diff -C2 -d -r1.722 -r1.723 *** NEWS 14 Apr 2003 20:58:08 -0000 1.722 --- NEWS 14 Apr 2003 22:01:51 -0000 1.723 *************** *** 331,334 **** --- 331,336 ---- - datetime changes: + The date class is now properly subclassable. (SF bug #720908) + The datetime and datetimetz classes have been collapsed into a single datetime class, and likewise the time and timetz classes into a single From rhettinger@users.sourceforge.net Tue Apr 15 11:35:09 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 15 Apr 2003 03:35:09 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.278,2.279 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv32206 Modified Files: compile.c Log Message: Extend SF patch #707257: Improve code generation to cover the case for: "x,y,z=1,2,3". Gives a 30% speed-up. Also, added FOR_ITER to the list of opcodes that can jump. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.278 retrieving revision 2.279 diff -C2 -d -r2.278 -r2.279 *** compile.c 28 Mar 2003 12:05:00 -0000 2.278 --- compile.c 15 Apr 2003 10:35:07 -0000 2.279 *************** *** 365,368 **** --- 365,369 ---- /* Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2 JMP+2. + Replace BUILD_SEQN 3 UNPACK_SEQN 3 with ROT3 ROT2 JMP+1. Note, these opcodes occur together only in assignment statements. Accordingly, the unpack opcode is never *************** *** 370,385 **** case BUILD_TUPLE: case BUILD_LIST: ! if (codestr[i+3] != UNPACK_SEQUENCE || ! GETARG(codestr, i) != 2 || ! GETARG(codestr, i+3) != 2) continue; ! codestr[i] = ROT_TWO; ! codestr[i+1] = JUMP_FORWARD; ! SETARG(codestr, i+1, 2); ! codestr[i+4] = DUP_TOP; /* Filler codes used as NOPs */ ! codestr[i+5] = POP_TOP; break; /* Replace jumps to unconditional jumps */ case JUMP_FORWARD: case JUMP_IF_FALSE: --- 371,397 ---- case BUILD_TUPLE: case BUILD_LIST: ! if (codestr[i+3] != UNPACK_SEQUENCE) continue; ! if (GETARG(codestr, i) == 2 && \ ! GETARG(codestr, i+3) == 2) { ! codestr[i] = ROT_TWO; ! codestr[i+1] = JUMP_FORWARD; ! SETARG(codestr, i+1, 2); ! codestr[i+4] = DUP_TOP; /* Filler codes used as NOPs */ ! codestr[i+5] = POP_TOP; ! continue; ! } ! if (GETARG(codestr, i) == 3 && \ ! GETARG(codestr, i+3) == 3) { ! codestr[i] = ROT_THREE; ! codestr[i+1] = ROT_TWO; ! codestr[i+2] = JUMP_FORWARD; ! SETARG(codestr, i+2, 1); ! codestr[i+5] = DUP_TOP; ! } break; /* Replace jumps to unconditional jumps */ + case FOR_ITER: case JUMP_FORWARD: case JUMP_IF_FALSE: From doerwalter@users.sourceforge.net Tue Apr 15 12:10:34 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 15 Apr 2003 04:10:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_pwd,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv14955/Lib/test/output Removed Files: test_pwd Log Message: Port test_pwd.py to PyUnit. Check that getpwall() and getpwnam()/getpwuid() return consistent data. Change test_grp to check that getgrall() and getgrnam()/getgrgid() return consistent data. Add error checks similar to test_pwd.py. Port test___all__.py to PyUnit. >From SF patch #662807. --- test_pwd DELETED --- From doerwalter@users.sourceforge.net Tue Apr 15 12:10:38 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 15 Apr 2003 04:10:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pwd.py,1.12,1.13 test_grp.py,1.10,1.11 test___all__.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14955/Lib/test Modified Files: test_pwd.py test_grp.py test___all__.py Log Message: Port test_pwd.py to PyUnit. Check that getpwall() and getpwnam()/getpwuid() return consistent data. Change test_grp to check that getgrall() and getgrnam()/getgrgid() return consistent data. Add error checks similar to test_pwd.py. Port test___all__.py to PyUnit. >From SF patch #662807. Index: test_pwd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_pwd.py 23 Jul 2002 19:03:59 -0000 1.12 --- test_pwd.py 15 Apr 2003 11:10:32 -0000 1.13 *************** *** 1,71 **** ! from test.test_support import verbose import pwd ! print 'pwd.getpwall()' ! entries = pwd.getpwall() ! for e in entries: ! name = e[0] ! uid = e[2] ! if verbose: ! print name, uid ! print 'pwd.getpwuid()' ! dbuid = pwd.getpwuid(uid) ! if dbuid[0] != name: ! print 'Mismatch in pwd.getpwuid()' ! print 'pwd.getpwnam()' ! dbname = pwd.getpwnam(name) ! if dbname[2] != uid: ! print 'Mismatch in pwd.getpwnam()' ! else: ! print 'name matches uid' ! break ! # try to get some errors ! bynames = {} ! byuids = {} ! for n, p, u, g, gecos, d, s in entries: ! bynames[n] = u ! byuids[u] = n ! allnames = bynames.keys() ! namei = 0 ! fakename = allnames[namei] ! while bynames.has_key(fakename): ! chars = map(None, fakename) ! for i in range(len(chars)): ! if chars[i] == 'z': ! chars[i] = 'A' ! break ! elif chars[i] == 'Z': ! continue ! else: ! chars[i] = chr(ord(chars[i]) + 1) ! break ! else: ! namei = namei + 1 ! try: ! fakename = allnames[namei] ! except IndexError: ! # should never happen... if so, just forget it ! break ! fakename = ''.join(map(None, chars)) ! try: ! pwd.getpwnam(fakename) ! except KeyError: ! print 'caught expected exception' ! else: ! print 'fakename', fakename, 'did not except pwd.getpwnam()' ! # Choose a non-existent uid. ! fakeuid = 4127 ! while byuids.has_key(fakeuid): ! fakeuid = (fakeuid * 3) % 0x10000 - try: - pwd.getpwuid(fakeuid) - except KeyError: - print 'caught expected exception' - else: - print 'fakeuid', fakeuid, 'did not except pwd.getpwuid()' --- 1,82 ---- ! import unittest ! from test import test_support ! import pwd ! class PwdTest(unittest.TestCase): ! def test_values(self): ! entries = pwd.getpwall() ! for e in entries: ! self.assertEqual(len(e), 7) ! self.assertEqual(e[0], e.pw_name) ! self.assert_(isinstance(e.pw_name, basestring)) ! self.assertEqual(e[1], e.pw_passwd) ! self.assert_(isinstance(e.pw_passwd, basestring)) ! self.assertEqual(e[2], e.pw_uid) ! self.assert_(isinstance(e.pw_uid, int)) ! self.assertEqual(e[3], e.pw_gid) ! self.assert_(isinstance(e.pw_gid, int)) ! self.assertEqual(e[4], e.pw_gecos) ! self.assert_(isinstance(e.pw_gecos, basestring)) ! self.assertEqual(e[5], e.pw_dir) ! self.assert_(isinstance(e.pw_dir, basestring)) ! self.assertEqual(e[6], e.pw_shell) ! self.assert_(isinstance(e.pw_shell, basestring)) ! self.assertEqual(pwd.getpwnam(e.pw_name), e) ! self.assertEqual(pwd.getpwuid(e.pw_uid), e) ! def test_errors(self): ! self.assertRaises(TypeError, pwd.getpwuid) ! self.assertRaises(TypeError, pwd.getpwnam) ! self.assertRaises(TypeError, pwd.getpwall, 42) ! # try to get some errors ! bynames = {} ! byuids = {} ! for (n, p, u, g, gecos, d, s) in pwd.getpwall(): ! bynames[n] = u ! byuids[u] = n ! ! allnames = bynames.keys() ! namei = 0 ! fakename = allnames[namei] ! while fakename in bynames: ! chars = map(None, fakename) ! for i in xrange(len(chars)): ! if chars[i] == 'z': ! chars[i] = 'A' ! break ! elif chars[i] == 'Z': ! continue ! else: ! chars[i] = chr(ord(chars[i]) + 1) ! break ! else: ! namei = namei + 1 ! try: ! fakename = allnames[namei] ! except IndexError: ! # should never happen... if so, just forget it ! break ! fakename = ''.join(map(None, chars)) ! ! self.assertRaises(KeyError, pwd.getpwnam, fakename) ! ! # Choose a non-existent uid. ! fakeuid = 4127 ! while fakeuid in byuids: ! fakeuid = (fakeuid * 3) % 0x10000 ! ! self.assertRaises(KeyError, pwd.getpwuid, fakeuid) ! ! def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(PwdTest)) ! test_support.run_suite(suite) ! ! if __name__ == "__main__": ! test_main() Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_grp.py 23 Jul 2002 19:03:54 -0000 1.10 --- test_grp.py 15 Apr 2003 11:10:33 -0000 1.11 *************** *** 1,6 **** """Test script for the grp module.""" - # XXX This really needs some work, but what are the expected invariants? - import grp import unittest --- 1,4 ---- *************** *** 10,26 **** class GroupDatabaseTestCase(unittest.TestCase): ! def setUp(self): ! self.groups = grp.getgrall() ! def test_getgrgid(self): ! entry = grp.getgrgid(self.groups[0][2]) ! def test_getgrnam(self): ! entry = grp.getgrnam(self.groups[0][0]) ! def test_main(): ! test_support.run_unittest(GroupDatabaseTestCase) if __name__ == "__main__": --- 8,76 ---- class GroupDatabaseTestCase(unittest.TestCase): ! def test_values(self): ! entries = grp.getgrall() ! for e in entries: ! self.assertEqual(len(e), 4) ! self.assertEqual(e[0], e.gr_name) ! self.assert_(isinstance(e.gr_name, basestring)) ! self.assertEqual(e[1], e.gr_passwd) ! self.assert_(isinstance(e.gr_passwd, basestring)) ! self.assertEqual(e[2], e.gr_gid) ! self.assert_(isinstance(e.gr_gid, int)) ! self.assertEqual(e[3], e.gr_mem) ! self.assert_(isinstance(e.gr_mem, list)) ! self.assertEqual(grp.getgrnam(e.gr_name), e) ! self.assertEqual(grp.getgrgid(e.gr_gid), e) + def test_errors(self): + self.assertRaises(TypeError, grp.getgrgid) + self.assertRaises(TypeError, grp.getgrnam) + self.assertRaises(TypeError, grp.getgrall, 42) ! # try to get some errors ! bynames = {} ! bygids = {} ! for (n, p, g, mem) in grp.getgrall(): ! bynames[n] = g ! bygids[g] = n ! ! allnames = bynames.keys() ! namei = 0 ! fakename = allnames[namei] ! while fakename in bynames: ! chars = map(None, fakename) ! for i in xrange(len(chars)): ! if chars[i] == 'z': ! chars[i] = 'A' ! break ! elif chars[i] == 'Z': ! continue ! else: ! chars[i] = chr(ord(chars[i]) + 1) ! break ! else: ! namei = namei + 1 ! try: ! fakename = allnames[namei] ! except IndexError: ! # should never happen... if so, just forget it ! break ! fakename = ''.join(map(None, chars)) + self.assertRaises(KeyError, grp.getgrnam, fakename) + + # Choose a non-existent gid. + fakegid = 4127 + while fakegid in bygids: + fakegid = (fakegid * 3) % 0x10000 + + self.assertRaises(KeyError, grp.getgrgid, fakegid) + + def test_main(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(GroupDatabaseTestCase)) + test_support.run_suite(suite) if __name__ == "__main__": Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test___all__.py 9 Oct 2002 18:17:06 -0000 1.28 --- test___all__.py 15 Apr 2003 11:10:33 -0000 1.29 *************** *** 1,2 **** --- 1,5 ---- + import unittest + from test import test_support + from test.test_support import verify, verbose import sys *************** *** 10,174 **** r'statcache$') ! def check_all(modname): ! names = {} ! try: ! exec "import %s" % modname in names ! except ImportError: ! # Silent fail here seems the best route since some modules ! # may not be available in all environments. ! # Since an ImportError may leave a partial module object in ! # sys.modules, get rid of that first. Here's what happens if ! # you don't: importing pty fails on Windows because pty tries to ! # import FCNTL, which doesn't exist. That raises an ImportError, ! # caught here. It also leaves a partial pty module in sys.modules. ! # So when test_pty is called later, the import of pty succeeds, ! # but shouldn't. As a result, test_pty crashes with an ! # AttributeError instead of an ImportError, and regrtest interprets ! # the latter as a test failure (ImportError is treated as "test ! # skipped" -- which is what test_pty should say on Windows). try: ! del sys.modules[modname] ! except KeyError: ! pass ! return ! verify(hasattr(sys.modules[modname], "__all__"), ! "%s has no __all__ attribute" % modname) ! names = {} ! exec "from %s import *" % modname in names ! if names.has_key("__builtins__"): ! del names["__builtins__"] ! keys = names.keys() ! keys.sort() ! all = list(sys.modules[modname].__all__) # in case it's a tuple ! all.sort() ! verify(keys==all, "%s != %s" % (keys, all)) ! if not sys.platform.startswith('java'): ! # In case _socket fails to build, make this test fail more gracefully ! # than an AttributeError somewhere deep in CGIHTTPServer. ! import _socket ! check_all("BaseHTTPServer") ! check_all("CGIHTTPServer") ! check_all("ConfigParser") ! check_all("Cookie") ! check_all("MimeWriter") ! check_all("SimpleHTTPServer") ! check_all("SocketServer") ! check_all("StringIO") ! check_all("UserString") ! check_all("aifc") ! check_all("atexit") ! check_all("audiodev") ! check_all("base64") ! check_all("bdb") ! check_all("binhex") ! check_all("calendar") ! check_all("cgi") ! check_all("cmd") ! check_all("code") ! check_all("codecs") ! check_all("codeop") ! check_all("colorsys") ! check_all("commands") ! check_all("compileall") ! check_all("copy") ! check_all("copy_reg") ! check_all("dbhash") ! check_all("dircache") ! check_all("dis") ! check_all("doctest") ! check_all("dospath") ! check_all("filecmp") ! check_all("fileinput") ! check_all("fnmatch") ! check_all("fpformat") ! check_all("ftplib") ! check_all("getopt") ! check_all("getpass") ! check_all("gettext") ! check_all("glob") ! check_all("gopherlib") ! check_all("gzip") ! check_all("htmllib") ! check_all("httplib") ! check_all("ihooks") ! check_all("imaplib") ! check_all("imghdr") ! check_all("imputil") ! check_all("keyword") ! check_all("linecache") ! check_all("locale") ! check_all("macpath") ! check_all("macurl2path") ! check_all("mailbox") ! check_all("mhlib") ! check_all("mimetools") ! check_all("mimetypes") ! check_all("mimify") ! check_all("multifile") ! check_all("netrc") ! check_all("nntplib") ! check_all("ntpath") ! check_all("os") ! check_all("pdb") ! check_all("pickle") ! check_all("pipes") ! check_all("popen2") ! check_all("poplib") ! check_all("posixpath") ! check_all("pprint") ! check_all("pre") # deprecated ! check_all("profile") ! check_all("pstats") ! check_all("pty") ! check_all("py_compile") ! check_all("pyclbr") ! check_all("quopri") ! check_all("random") ! check_all("re") ! check_all("reconvert") ! check_all("regsub") ! check_all("repr") ! check_all("rexec") ! check_all("rfc822") ! check_all("robotparser") ! check_all("sched") ! check_all("sgmllib") ! check_all("shelve") ! check_all("shlex") ! check_all("shutil") ! check_all("smtpd") ! check_all("smtplib") ! check_all("sndhdr") ! check_all("socket") ! check_all("sre") ! check_all("stat_cache") ! check_all("tabnanny") ! check_all("telnetlib") ! check_all("tempfile") ! check_all("toaiff") ! check_all("tokenize") ! check_all("traceback") ! check_all("tty") ! check_all("urllib") ! check_all("urlparse") ! check_all("uu") ! check_all("warnings") ! check_all("wave") ! check_all("weakref") ! check_all("webbrowser") ! check_all("xdrlib") ! check_all("zipfile") ! # rlcompleter needs special consideration; it import readline which ! # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-( ! try: ! check_all("rlcompleter") ! finally: ! try: ! import locale ! except ImportError: ! pass ! else: ! locale.setlocale(locale.LC_CTYPE, 'C') --- 13,200 ---- r'statcache$') ! class AllTest(unittest.TestCase): ! ! def check_all(self, modname): ! names = {} try: ! exec "import %s" % modname in names ! except ImportError: ! # Silent fail here seems the best route since some modules ! # may not be available in all environments. ! # Since an ImportError may leave a partial module object in ! # sys.modules, get rid of that first. Here's what happens if ! # you don't: importing pty fails on Windows because pty tries to ! # import FCNTL, which doesn't exist. That raises an ImportError, ! # caught here. It also leaves a partial pty module in sys.modules. ! # So when test_pty is called later, the import of pty succeeds, ! # but shouldn't. As a result, test_pty crashes with an ! # AttributeError instead of an ImportError, and regrtest interprets ! # the latter as a test failure (ImportError is treated as "test ! # skipped" -- which is what test_pty should say on Windows). ! try: ! del sys.modules[modname] ! except KeyError: ! pass ! return ! verify(hasattr(sys.modules[modname], "__all__"), ! "%s has no __all__ attribute" % modname) ! names = {} ! exec "from %s import *" % modname in names ! if names.has_key("__builtins__"): ! del names["__builtins__"] ! keys = names.keys() ! keys.sort() ! all = list(sys.modules[modname].__all__) # in case it's a tuple ! all.sort() ! verify(keys==all, "%s != %s" % (keys, all)) ! def test_all(self): ! if not sys.platform.startswith('java'): ! # In case _socket fails to build, make this test fail more gracefully ! # than an AttributeError somewhere deep in CGIHTTPServer. ! import _socket ! self.check_all("BaseHTTPServer") ! self.check_all("CGIHTTPServer") ! self.check_all("ConfigParser") ! self.check_all("Cookie") ! self.check_all("MimeWriter") ! self.check_all("SimpleHTTPServer") ! self.check_all("SocketServer") ! self.check_all("StringIO") ! self.check_all("UserString") ! self.check_all("aifc") ! self.check_all("atexit") ! self.check_all("audiodev") ! self.check_all("base64") ! self.check_all("bdb") ! self.check_all("binhex") ! self.check_all("calendar") ! self.check_all("cgi") ! self.check_all("cmd") ! self.check_all("code") ! self.check_all("codecs") ! self.check_all("codeop") ! self.check_all("colorsys") ! self.check_all("commands") ! self.check_all("compileall") ! self.check_all("copy") ! self.check_all("copy_reg") ! self.check_all("dbhash") ! self.check_all("difflib") ! self.check_all("dircache") ! self.check_all("dis") ! self.check_all("doctest") ! self.check_all("dummy_thread") ! self.check_all("dummy_threading") ! self.check_all("filecmp") ! self.check_all("fileinput") ! self.check_all("fnmatch") ! self.check_all("fpformat") ! self.check_all("ftplib") ! self.check_all("getopt") ! self.check_all("getpass") ! self.check_all("gettext") ! self.check_all("glob") ! self.check_all("gopherlib") ! self.check_all("gzip") ! self.check_all("heapq") ! self.check_all("htmllib") ! self.check_all("httplib") ! self.check_all("ihooks") ! self.check_all("imaplib") ! self.check_all("imghdr") ! self.check_all("imputil") ! self.check_all("keyword") ! self.check_all("linecache") ! self.check_all("locale") ! self.check_all("macpath") ! self.check_all("macurl2path") ! self.check_all("mailbox") ! self.check_all("mailcap") ! self.check_all("mhlib") ! self.check_all("mimetools") ! self.check_all("mimetypes") ! self.check_all("mimify") ! self.check_all("multifile") ! self.check_all("netrc") ! self.check_all("nntplib") ! self.check_all("ntpath") ! self.check_all("opcode") ! self.check_all("os") ! self.check_all("os2emxpath") ! self.check_all("pdb") ! self.check_all("pickle") ! self.check_all("pipes") ! self.check_all("popen2") ! self.check_all("poplib") ! self.check_all("posixpath") ! self.check_all("pprint") ! self.check_all("pre") # deprecated ! self.check_all("profile") ! self.check_all("pstats") ! self.check_all("pty") ! self.check_all("py_compile") ! self.check_all("pyclbr") ! self.check_all("quopri") ! self.check_all("random") ! self.check_all("re") ! self.check_all("reconvert") ! self.check_all("regsub") ! self.check_all("repr") ! self.check_all("rexec") ! self.check_all("rfc822") ! self.check_all("robotparser") ! self.check_all("sched") ! self.check_all("sets") ! self.check_all("sgmllib") ! self.check_all("shelve") ! self.check_all("shlex") ! self.check_all("shutil") ! self.check_all("smtpd") ! self.check_all("smtplib") ! self.check_all("sndhdr") ! self.check_all("socket") ! self.check_all("sre") ! self.check_all("statcache") ! self.check_all("symtable") ! self.check_all("tabnanny") ! self.check_all("tarfile") ! self.check_all("telnetlib") ! self.check_all("tempfile") ! self.check_all("textwrap") ! self.check_all("threading") ! self.check_all("toaiff") ! self.check_all("tokenize") ! self.check_all("traceback") ! self.check_all("tty") ! self.check_all("urllib") ! self.check_all("urlparse") ! self.check_all("uu") ! self.check_all("warnings") ! self.check_all("wave") ! self.check_all("weakref") ! self.check_all("webbrowser") ! self.check_all("xdrlib") ! self.check_all("zipfile") ! # rlcompleter needs special consideration; it import readline which ! # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-( ! try: ! self.check_all("rlcompleter") ! finally: ! try: ! import locale ! except ImportError: ! pass ! else: ! locale.setlocale(locale.LC_CTYPE, 'C') ! ! ! def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(AllTest)) ! test_support.run_suite(suite) ! ! if __name__ == "__main__": ! test_main() From gvanrossum@users.sourceforge.net Tue Apr 15 13:43:31 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 05:43:31 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.287,2.288 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv15148a Modified Files: bltinmodule.c Log Message: Some errors from range() should be TypeError, not ValueError. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.287 retrieving revision 2.288 diff -C2 -d -r2.287 -r2.288 *** bltinmodule.c 14 Apr 2003 18:25:04 -0000 2.287 --- bltinmodule.c 15 Apr 2003 12:43:26 -0000 2.288 *************** *** 1368,1372 **** if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { ! PyErr_Format(PyExc_ValueError, "integer start argument expected, got %s.", ilow->ob_type->tp_name); --- 1368,1372 ---- if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { ! PyErr_Format(PyExc_TypeError, "integer start argument expected, got %s.", ilow->ob_type->tp_name); *************** *** 1375,1379 **** if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { ! PyErr_Format(PyExc_ValueError, "integer end argument expected, got %s.", ihigh->ob_type->tp_name); --- 1375,1379 ---- if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { ! PyErr_Format(PyExc_TypeError, "integer end argument expected, got %s.", ihigh->ob_type->tp_name); *************** *** 1382,1386 **** if (!PyInt_Check(istep) && !PyLong_Check(istep)) { ! PyErr_Format(PyExc_ValueError, "integer step argument expected, got %s.", istep->ob_type->tp_name); --- 1382,1386 ---- if (!PyInt_Check(istep) && !PyLong_Check(istep)) { ! PyErr_Format(PyExc_TypeError, "integer step argument expected, got %s.", istep->ob_type->tp_name); From gvanrossum@users.sourceforge.net Tue Apr 15 15:10:15 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 07:10:15 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.183,2.184 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv29879 Modified Files: pythonrun.c Log Message: Move the call to _Py_PrintReferences() a bit further down. This prevents it from showing stuff (like codec state) that is cleared when the interpreter state is cleared. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.183 retrieving revision 2.184 diff -C2 -d -r2.183 -r2.184 *** pythonrun.c 10 Apr 2003 21:53:14 -0000 2.183 --- pythonrun.c 15 Apr 2003 14:10:09 -0000 2.184 *************** *** 271,280 **** #endif - #ifdef Py_TRACE_REFS - if (Py_GETENV("PYTHONDUMPREFS")) { - _Py_PrintReferences(stderr); - } - #endif /* Py_TRACE_REFS */ - /* Now we decref the exception classes. After this point nothing can raise an exception. That's okay, because each Fini() method --- 271,274 ---- *************** *** 284,292 **** _PyExc_Fini(); ! /* Delete current thread */ PyInterpreterState_Clear(interp); PyThreadState_Swap(NULL); PyInterpreterState_Delete(interp); PyMethod_Fini(); PyFrame_Fini(); --- 278,297 ---- _PyExc_Fini(); ! /* Clear interpreter state */ PyInterpreterState_Clear(interp); + + #ifdef Py_TRACE_REFS + /* Dump references -- this may implicitly need the thread state, + so this is the last possible place where we can do this. */ + if (Py_GETENV("PYTHONDUMPREFS")) { + _Py_PrintReferences(stderr); + } + #endif /* Py_TRACE_REFS */ + + /* Delete current thread */ PyThreadState_Swap(NULL); PyInterpreterState_Delete(interp); + /* Sundry finalizers */ PyMethod_Fini(); PyFrame_Fini(); From tim_one@users.sourceforge.net Tue Apr 15 15:40:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 15 Apr 2003 07:40:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12760/Lib/test Modified Files: test_builtin.py Log Message: test_range(): The C code changed to raise TypeError in one of these cases, but the test still expected ValueError. Repaired that. Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_builtin.py 11 Apr 2003 18:43:05 -0000 1.15 --- test_builtin.py 15 Apr 2003 14:40:03 -0000 1.16 *************** *** 963,967 **** # Reject floats when it would require PyLongs to represent. # (smaller floats still accepted, but deprecated) ! self.assertRaises(ValueError, range, 1e100, 1e101, 1e101) def test_input_and_raw_input(self): --- 963,967 ---- # Reject floats when it would require PyLongs to represent. # (smaller floats still accepted, but deprecated) ! self.assertRaises(TypeError, range, 1e100, 1e101, 1e101) def test_input_and_raw_input(self): From jackjansen@users.sourceforge.net Tue Apr 15 15:43:13 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 15 Apr 2003 07:43:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv13694 Modified Files: pimp.py Log Message: - Use the tarfile module to unpack tarfiles. - Allow setting the destination install directory. If this is set then it is used for the modules, other items (header files, etc) are not installed, and warnings are printed if the package would have liked to. Unfortunaltey binary installs seem broken due to a tarfile bug (#721871) or my misunderstanding of how tarfile works. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pimp.py 9 Apr 2003 13:25:43 -0000 1.15 --- pimp.py 15 Apr 2003 14:43:05 -0000 1.16 *************** *** 23,26 **** --- 23,29 ---- import distutils.sysconfig import md5 + import tarfile + import tempfile + import shutil __all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main"] *************** *** 43,53 **** DEFAULT_PIMPDATABASE="http://www.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform() ARCHIVE_FORMATS = [ ! (".tar.Z", "zcat \"%s\" | tar -xf -"), ! (".taz", "zcat \"%s\" | tar -xf -"), ! (".tar.gz", "zcat \"%s\" | tar -xf -"), ! (".tgz", "zcat \"%s\" | tar -xf -"), ! (".tar.bz", "bzcat \"%s\" | tar -xf -"), ! (".zip", "unzip \"%s\""), ] --- 46,144 ---- DEFAULT_PIMPDATABASE="http://www.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform() + def _cmd(output, dir, *cmditems): + """Internal routine to run a shell command in a given directory.""" + + cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) + if output: + output.write("+ %s\n" % cmd) + if NO_EXECUTE: + return 0 + child = popen2.Popen4(cmd) + child.tochild.close() + while 1: + line = child.fromchild.readline() + if not line: + break + if output: + output.write(line) + return child.wait() + + class PimpUnpacker: + """Abstract base class - Unpacker for archives""" + + _can_rename = False + + def __init__(self, argument, + dir="", + renames=[]): + self.argument = argument + if renames and not self._can_rename: + raise RuntimeError, "This unpacker cannot rename files" + self._dir = dir + self._renames = renames + + def unpack(self, archive, output=None): + return None + + class PimpCommandUnpacker(PimpUnpacker): + """Unpack archives by calling a Unix utility""" + + _can_rename = False + + def unpack(self, archive, output=None): + cmd = self.argument % archive + if _cmd(output, self._dir, cmd): + return "unpack command failed" + + class PimpTarUnpacker(PimpUnpacker): + """Unpack tarfiles using the builtin tarfile module""" + + _can_rename = True + + def unpack(self, archive, output=None): + tf = tarfile.open(archive, "r") + members = tf.getmembers() + skip = [] + if self._renames: + for member in members: + for oldprefix, newprefix in self._renames: + if oldprefix[:len(self._dir)] == self._dir: + oldprefix2 = oldprefix[len(self._dir):] + else: + oldprefix2 = None + if member.name[:len(oldprefix)] == oldprefix: + if newprefix is None: + skip.append(member) + #print 'SKIP', member.name + else: + member.name = newprefix + member.name[len(oldprefix):] + print ' ', member.name + break + elif oldprefix2 and member.name[:len(oldprefix2)] == oldprefix2: + if newprefix is None: + skip.append(member) + #print 'SKIP', member.name + else: + member.name = newprefix + member.name[len(oldprefix2):] + #print ' ', member.name + break + else: + skip.append(member) + #print '????', member.name + for member in members: + if member in skip: + continue + tf.extract(member, self._dir) + if skip: + names = [member.name for member in skip if member.name[-1] != '/'] + return "Not all files were unpacked: %s" % " ".join(names) + ARCHIVE_FORMATS = [ ! (".tar.Z", PimpTarUnpacker, None), ! (".taz", PimpTarUnpacker, None), ! (".tar.gz", PimpTarUnpacker, None), ! (".tgz", PimpTarUnpacker, None), ! (".tar.bz", PimpTarUnpacker, None), ! (".zip", PimpCommandUnpacker, "unzip \"%s\""), ] *************** *** 68,75 **** if not buildDir: buildDir = DEFAULT_BUILDDIR - if not installDir: - installDir = DEFAULT_INSTALLDIR if not pimpDatabase: pimpDatabase = DEFAULT_PIMPDATABASE self.flavorOrder = flavorOrder self.downloadDir = downloadDir --- 159,174 ---- if not buildDir: buildDir = DEFAULT_BUILDDIR if not pimpDatabase: pimpDatabase = DEFAULT_PIMPDATABASE + if installDir: + # Installing to non-standard location. + self.installLocations = [ + ('--install-lib', installDir), + ('--install-headers', None), + ('--install-scripts', None), + ('--install-data', None)] + else: + installDir = DEFAULT_INSTALLDIR + self.installLocations = [] self.flavorOrder = flavorOrder self.downloadDir = downloadDir *************** *** 107,111 **** else: rv += "Warning: Install directory \"%s\" is not on sys.path\n" % self.installDir ! return rv def compareFlavors(self, left, right): --- 206,210 ---- else: rv += "Warning: Install directory \"%s\" is not on sys.path\n" % self.installDir ! return rv def compareFlavors(self, left, right): *************** *** 389,409 **** return rv - def _cmd(self, output, dir, *cmditems): - """Internal routine to run a shell command in a given directory.""" - - cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) - if output: - output.write("+ %s\n" % cmd) - if NO_EXECUTE: - return 0 - child = popen2.Popen4(cmd) - child.tochild.close() - while 1: - line = child.fromchild.readline() - if not line: - break - if output: - output.write(line) - return child.wait() def downloadPackageOnly(self, output=None): --- 488,491 ---- *************** *** 426,430 **** if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename ! if self._cmd(output, self._db.preferences.downloadDir, "curl", "--output", self.archiveFilename, --- 508,512 ---- if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename ! if _cmd(output, self._db.preferences.downloadDir, "curl", "--output", self.archiveFilename, *************** *** 452,456 **** filename = os.path.split(self.archiveFilename)[1] ! for ext, cmd in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: break --- 534,538 ---- filename = os.path.split(self.archiveFilename)[1] ! for ext, unpackerClass, arg in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: break *************** *** 458,464 **** return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] ! cmd = cmd % self.archiveFilename ! if self._cmd(output, self._db.preferences.buildDir, cmd): ! return "unpack command failed" def installPackageOnly(self, output=None): --- 540,547 ---- return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] ! unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir) ! rv = unpacker.unpack(self.archiveFilename, output=output) ! if rv: ! return rv def installPackageOnly(self, output=None): *************** *** 528,540 **** If output is given it should be a file-like object and it will receive a log of what happened.""" - print 'PimpPackage_binary installPackageOnly' - msgs = [] - if self._dict.has_key('Pre-install-command'): - msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): ! msgs.append("%s: Install-command ignored" % self.fullname()) ! if self._dict.has_key('Post-install-command'): ! msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() --- 611,622 ---- If output is given it should be a file-like object and it will receive a log of what happened.""" if self._dict.has_key('Install-command'): ! return "%s: Binary package cannot have Install-command" % self.fullname() ! ! if self._dict.has_key('Pre-install-command'): ! if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): ! return "pre-install %s: running \"%s\" failed" % \ ! (self.fullname(), self._dict['Pre-install-command']) self.beforeInstall() *************** *** 542,562 **** # Install by unpacking filename = os.path.split(self.archiveFilename)[1] ! for ext, cmd in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: break else: ! return "unknown extension for archive file: %s" % filename ! # Extract the files in the root folder. ! cmd = cmd % self.archiveFilename ! if self._cmd(output, "/", cmd): ! return "unpack command failed" self.afterInstall() if self._dict.has_key('Post-install-command'): ! if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): ! return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) return None --- 624,656 ---- # Install by unpacking filename = os.path.split(self.archiveFilename)[1] ! for ext, unpackerClass, arg in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: break else: ! return "%s: unknown extension for archive file: %s" % (self.fullname(), filename) ! self.basename = filename[:-len(ext)] ! install_renames = [] ! for k, newloc in self._db.preferences.installLocations: ! if not newloc: ! continue ! if k == "--install-lib": ! oldloc = DEFAULT_INSTALLDIR ! else: ! return "%s: Don't know installLocation %s" % (self.fullname(), k) ! install_renames.append((oldloc, newloc)) ! ! unpacker = unpackerClass(arg, dir="/", renames=install_renames) ! rv = unpacker.unpack(self.archiveFilename, output=output) ! if rv: ! return rv self.afterInstall() if self._dict.has_key('Post-install-command'): ! if _cmd(output, self._buildDirname, self._dict['Post-install-command']): ! return "%s: post-install: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) + return None *************** *** 580,584 **** if self._dict.has_key('Pre-install-command'): ! if self._cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) --- 674,678 ---- if self._dict.has_key('Pre-install-command'): ! if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) *************** *** 586,599 **** self.beforeInstall() installcmd = self._dict.get('Install-command') if not installcmd: ! installcmd = '"%s" setup.py install' % sys.executable ! if self._cmd(output, self._buildDirname, installcmd): return "install %s: running \"%s\" failed" % \ (self.fullname(), installcmd) self.afterInstall() if self._dict.has_key('Post-install-command'): ! if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) --- 680,715 ---- self.beforeInstall() installcmd = self._dict.get('Install-command') + if installcmd and self._install_renames: + return "Package has install-command and can only be installed to standard location" + # This is the "bit-bucket" for installations: everything we don't + # want. After installation we check that it is actually empty + unwanted_install_dir = None if not installcmd: ! extra_args = "" ! for k, v in self._db.preferences.installLocations: ! if not v: ! # We don't want these files installed. Send them ! # to the bit-bucket. ! if not unwanted_install_dir: ! unwanted_install_dir = tempfile.mkdtemp() ! v = unwanted_install_dir ! extra_args = extra_args + " %s \"%s\"" % (k, v) ! installcmd = '"%s" setup.py install %s' % (sys.executable, extra_args) ! if _cmd(output, self._buildDirname, installcmd): return "install %s: running \"%s\" failed" % \ (self.fullname(), installcmd) + if unwanted_install_dir and os.path.exists(unwanted_install_dir): + unwanted_files = os.listdir(unwanted_install_dir) + if unwanted_files: + rv = "Warning: some files were not installed: %s" % " ".join(unwanted_files) + else: + rv = None + shutil.rmtree(unwanted_install_dir) + return rv self.afterInstall() if self._dict.has_key('Post-install-command'): ! if _cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) *************** *** 673,681 **** ! def _run(mode, verbose, force, args): """Engine for the main program""" ! prefs = PimpPreferences() ! prefs.check() db = PimpDatabase(prefs) db.appendURL(prefs.pimpDatabase) --- 789,799 ---- ! def _run(mode, verbose, force, args, prefargs): """Engine for the main program""" ! prefs = PimpPreferences(**prefargs) ! rv = prefs.check() ! if rv: ! sys.stdout.write(rv) db = PimpDatabase(prefs) db.appendURL(prefs.pimpDatabase) *************** *** 698,702 **** if verbose: print "\tHome page:\t", pkg.homepage() ! print "\tDownload URL:\t", pkg.downloadURL() elif mode =='status': if not args: --- 816,823 ---- if verbose: print "\tHome page:\t", pkg.homepage() ! try: ! print "\tDownload URL:\t", pkg.downloadURL() ! except KeyError: ! pass elif mode =='status': if not args: *************** *** 752,766 **** import getopt def _help(): ! print "Usage: pimp [-v] -s [package ...] List installed status" ! print " pimp [-v] -l [package ...] Show package information" ! print " pimp [-vf] -i package ... Install packages" ! print " pimp -d Dump database to stdout" print "Options:" ! print " -v Verbose" ! print " -f Force installation" sys.exit(1) try: ! opts, args = getopt.getopt(sys.argv[1:], "slifvd") except getopt.Error: _help() --- 873,888 ---- import getopt def _help(): ! print "Usage: pimp [options] -s [package ...] List installed status" ! print " pimp [options] -l [package ...] Show package information" ! print " pimp [options] -i package ... Install packages" ! print " pimp -d Dump database to stdout" print "Options:" ! print " -v Verbose" ! print " -f Force installation" ! print " -D dir Set destination directory (default: site-packages)" sys.exit(1) try: ! opts, args = getopt.getopt(sys.argv[1:], "slifvdD:") except getopt.Error: _help() *************** *** 770,773 **** --- 892,896 ---- force = 0 verbose = 0 + prefargs = {} for o, a in opts: if o == '-s': *************** *** 789,795 **** if o == '-v': verbose = 1 if not mode: _help() ! _run(mode, verbose, force, args) if __name__ == '__main__': --- 912,920 ---- if o == '-v': verbose = 1 + if o == '-D': + prefargs['installDir'] = a if not mode: _help() ! _run(mode, verbose, force, args, prefargs) if __name__ == '__main__': From gvanrossum@users.sourceforge.net Tue Apr 15 16:10:58 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:10:58 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.184,2.185 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28051/Python Modified Files: pythonrun.c Log Message: - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences() even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -d -r2.184 -r2.185 *** pythonrun.c 15 Apr 2003 14:10:09 -0000 2.184 --- pythonrun.c 15 Apr 2003 15:10:54 -0000 2.185 *************** *** 281,292 **** PyInterpreterState_Clear(interp); - #ifdef Py_TRACE_REFS - /* Dump references -- this may implicitly need the thread state, - so this is the last possible place where we can do this. */ - if (Py_GETENV("PYTHONDUMPREFS")) { - _Py_PrintReferences(stderr); - } - #endif /* Py_TRACE_REFS */ - /* Delete current thread */ PyThreadState_Swap(NULL); --- 281,284 ---- *************** *** 314,317 **** --- 306,317 ---- PyGrammar_RemoveAccelerators(&_PyParser_Grammar); + + #ifdef Py_TRACE_REFS + /* Dump references -- this may implicitly need the thread state, + so this is the last possible place where we can do this. */ + if (Py_GETENV("PYTHONDUMPREFS")) { + _Py_PrintReferences(stderr); + } + #endif /* Py_TRACE_REFS */ #ifdef PYMALLOC_DEBUG From gvanrossum@users.sourceforge.net Tue Apr 15 16:11:21 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:11:21 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.723,1.724 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28051/Misc Modified Files: NEWS Log Message: - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences() even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.723 retrieving revision 1.724 diff -C2 -d -r1.723 -r1.724 *** NEWS 14 Apr 2003 22:01:51 -0000 1.723 --- NEWS 15 Apr 2003 15:10:42 -0000 1.724 *************** *** 151,154 **** --- 151,158 ---- ----- + - PyThreadState_GetDict() was changed not to raise an exception or + issue a fatal error when no current thread state is available. This + makes it possible to print dictionaries when no thread is active. + - LONG_LONG was renamed to PY_LONG_LONG. From gvanrossum@users.sourceforge.net Tue Apr 15 16:11:23 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:11:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv28051/Doc/api Modified Files: init.tex Log Message: - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences() even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition. Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** init.tex 2 Mar 2003 13:17:20 -0000 1.7 --- init.tex 15 Apr 2003 15:10:49 -0000 1.8 *************** *** 678,684 **** Return a dictionary in which extensions can store thread-specific state information. Each extension should use a unique key to use to ! store state in the dictionary. If this function returns \NULL, an ! exception has been raised and the caller should allow it to ! propagate. \end{cfuncdesc} --- 678,687 ---- Return a dictionary in which extensions can store thread-specific state information. Each extension should use a unique key to use to ! store state in the dictionary. It is okay to call this function ! when no current thread state is available. ! If this function returns \NULL, no exception has been raised and the ! caller should assume no current thread state is available. ! \versionchanged[Previously this could only be called when a current ! thread is active, and \NULL meant that an exception was raised]{2.3} \end{cfuncdesc} From gvanrossum@users.sourceforge.net Tue Apr 15 16:11:26 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:11:26 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.206,2.207 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv28051/Objects Modified Files: object.c Log Message: - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences() even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.206 retrieving revision 2.207 diff -C2 -d -r2.206 -r2.207 *** object.c 23 Mar 2003 18:06:08 -0000 2.206 --- object.c 15 Apr 2003 15:10:51 -0000 2.207 *************** *** 2120,2124 **** dict = PyThreadState_GetDict(); if (dict == NULL) ! return -1; list = PyDict_GetItemString(dict, KEY); if (list == NULL) { --- 2120,2124 ---- dict = PyThreadState_GetDict(); if (dict == NULL) ! return 0; list = PyDict_GetItemString(dict, KEY); if (list == NULL) { From gvanrossum@users.sourceforge.net Tue Apr 15 16:12:42 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:12:42 -0700 Subject: [Python-checkins] python/dist/src/Python pystate.c,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv30985/Python Modified Files: pystate.c Log Message: - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences() even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition. Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** pystate.c 19 Mar 2003 00:35:36 -0000 2.24 --- pystate.c 15 Apr 2003 15:12:39 -0000 2.25 *************** *** 267,272 **** PyThreadState_GetDict() returns a dictionary that can be used to hold such state; the caller should pick a unique key and store its state there. If ! PyThreadState_GetDict() returns NULL, an exception has been raised (most ! likely MemoryError) and the caller should pass on the exception. */ PyObject * --- 267,272 ---- PyThreadState_GetDict() returns a dictionary that can be used to hold such state; the caller should pick a unique key and store its state there. If ! PyThreadState_GetDict() returns NULL, an exception has *not* been raised ! and the caller should assume no per-thread state is available. */ PyObject * *************** *** 274,281 **** { if (_PyThreadState_Current == NULL) ! Py_FatalError("PyThreadState_GetDict: no current thread"); ! if (_PyThreadState_Current->dict == NULL) ! _PyThreadState_Current->dict = PyDict_New(); return _PyThreadState_Current->dict; } --- 274,285 ---- { if (_PyThreadState_Current == NULL) ! return NULL; ! if (_PyThreadState_Current->dict == NULL) { ! PyObject *d; ! _PyThreadState_Current->dict = d = PyDict_New(); ! if (d == NULL) ! PyErr_Clear(); ! } return _PyThreadState_Current->dict; } From doerwalter@users.sourceforge.net Tue Apr 15 16:39:12 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:39:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pwd.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12357/Lib/test Modified Files: test_pwd.py Log Message: Fix the test so that it works even when /etc/passwd has two entries for the same uid. Index: test_pwd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_pwd.py 15 Apr 2003 11:10:32 -0000 1.13 --- test_pwd.py 15 Apr 2003 15:39:08 -0000 1.14 *************** *** 8,11 **** --- 8,12 ---- def test_values(self): entries = pwd.getpwall() + entriesbyuid = {} for e in entries: *************** *** 27,31 **** self.assertEqual(pwd.getpwnam(e.pw_name), e) ! self.assertEqual(pwd.getpwuid(e.pw_uid), e) def test_errors(self): --- 28,42 ---- self.assertEqual(pwd.getpwnam(e.pw_name), e) ! # The following won't work, because of duplicate entries ! # for one uid ! # self.assertEqual(pwd.getpwuid(e.pw_uid), e) ! # instead of this collect all entries for one uid ! # and check afterwards ! entriesbyuid.setdefault(e.pw_uid, []).append(e) ! ! # check whether the entry returned by getpwuid() ! # for each uid is among those from getpwall() for this uid ! for e in entries: ! self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid]) def test_errors(self): From doerwalter@users.sourceforge.net Tue Apr 15 16:59:40 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 15 Apr 2003 08:59:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grp.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22898/Lib/test Modified Files: test_grp.py Log Message: Fix the test so that it works even when /etc/group has two entries for the same gid. Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_grp.py 15 Apr 2003 11:10:33 -0000 1.11 --- test_grp.py 15 Apr 2003 15:59:36 -0000 1.12 *************** *** 10,13 **** --- 10,14 ---- def test_values(self): entries = grp.getgrall() + entriesbygid = {} for e in entries: *************** *** 23,27 **** self.assertEqual(grp.getgrnam(e.gr_name), e) ! self.assertEqual(grp.getgrgid(e.gr_gid), e) def test_errors(self): --- 24,38 ---- self.assertEqual(grp.getgrnam(e.gr_name), e) ! # The following won't work, because of duplicate entries ! # for one gid ! # self.assertEqual(grp.getgrgid(e.gr_gid), e) ! # instead of this collect all entries for one uid ! # and check afterwards ! entriesbygid.setdefault(e.gr_gid, []).append(e) ! ! # check whether the entry returned by getgrgid() ! # for each uid is among those from getgrall() for this uid ! for e in entries: ! self.assert_(grp.getgrgid(e.gr_gid) in entriesbygid[e.gr_gid]) def test_errors(self): From doerwalter@users.sourceforge.net Tue Apr 15 17:08:04 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 15 Apr 2003 09:08:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grp.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26649/Lib/test Modified Files: test_grp.py Log Message: Fix copy & paste error in comment. Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_grp.py 15 Apr 2003 15:59:36 -0000 1.12 --- test_grp.py 15 Apr 2003 16:08:01 -0000 1.13 *************** *** 27,31 **** # for one gid # self.assertEqual(grp.getgrgid(e.gr_gid), e) ! # instead of this collect all entries for one uid # and check afterwards entriesbygid.setdefault(e.gr_gid, []).append(e) --- 27,31 ---- # for one gid # self.assertEqual(grp.getgrgid(e.gr_gid), e) ! # instead of this collect all entries for one gid # and check afterwards entriesbygid.setdefault(e.gr_gid, []).append(e) From doerwalter@users.sourceforge.net Tue Apr 15 19:59:32 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 15 Apr 2003 11:59:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17500/Lib/test Modified Files: test_builtin.py Log Message: Add a few errors tests for range(). Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_builtin.py 15 Apr 2003 14:40:03 -0000 1.16 --- test_builtin.py 15 Apr 2003 18:59:28 -0000 1.17 *************** *** 965,968 **** --- 965,974 ---- self.assertRaises(TypeError, range, 1e100, 1e101, 1e101) + self.assertRaises(TypeError, range, 0, "spam") + self.assertRaises(TypeError, range, 0, 42, "spam") + + self.assertRaises(OverflowError, range, -sys.maxint, sys.maxint) + self.assertRaises(OverflowError, range, 0, 2*sys.maxint) + def test_input_and_raw_input(self): self.write_testfile() From gvanrossum@users.sourceforge.net Tue Apr 15 21:04:34 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 13:04:34 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.224,2.225 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv23802 Modified Files: typeobject.c Log Message: Ouch, it's Carlo Verre, not Verre Carlo. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.224 retrieving revision 2.225 diff -C2 -d -r2.224 -r2.225 *** typeobject.c 14 Apr 2003 21:46:02 -0000 2.224 --- typeobject.c 15 Apr 2003 20:04:28 -0000 2.225 *************** *** 3576,3580 **** /* Helper to check for object.__setattr__ or __delattr__ applied to a type. ! This is called the Verre Carlo hack after its discoverer. */ static int hackcheck(PyObject *self, setattrofunc func, char *what) --- 3576,3580 ---- /* Helper to check for object.__setattr__ or __delattr__ applied to a type. ! This is called the Carlo Verre hack after its discoverer. */ static int hackcheck(PyObject *self, setattrofunc func, char *what) From gvanrossum@users.sourceforge.net Tue Apr 15 21:05:14 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 13:05:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.189,1.190 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24230 Modified Files: test_descr.py Log Message: Ouch, it's Carlo Verre, not Verre Carlo. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** test_descr.py 14 Apr 2003 21:46:03 -0000 1.189 --- test_descr.py 15 Apr 2003 20:05:10 -0000 1.190 *************** *** 3841,3847 **** vereq(C.__dict__["f"](p), "B.f->C.f") ! def verrecarlo(): if verbose: ! print "Testing prohibition of Verre Carlo's hack..." try: object.__setattr__(str, "foo", 42) --- 3841,3847 ---- vereq(C.__dict__["f"](p), "B.f->C.f") ! def carloverre(): if verbose: ! print "Testing prohibition of Carlo Verre's hack..." try: object.__setattr__(str, "foo", 42) *************** *** 3849,3853 **** pass else: ! raise TestFailed, "Verre Carlo __setattr__ suceeded!" try: object.__delattr__(str, "lower") --- 3849,3853 ---- pass else: ! raise TestFailed, "Carlo Verre __setattr__ suceeded!" try: object.__delattr__(str, "lower") *************** *** 3855,3859 **** pass else: ! raise TestFailed, "Verre Carlo __delattr__ succeeded!" --- 3855,3859 ---- pass else: ! raise TestFailed, "Carlo Verre __delattr__ succeeded!" *************** *** 3946,3950 **** isinst_isclass() proxysuper() ! verrecarlo() if verbose: print "All OK" --- 3946,3950 ---- isinst_isclass() proxysuper() ! carloverre() if verbose: print "All OK" From loewis@users.sourceforge.net Tue Apr 15 21:33:23 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 15 Apr 2003 13:33:23 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.153,1.154 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7935 Modified Files: _tkinter.c Log Message: Use object interface for global vars. Fixes #721171. Also move complete processing of get/set/delvar calls to target thread. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** _tkinter.c 30 Mar 2003 08:44:58 -0000 1.153 --- _tkinter.c 15 Apr 2003 20:33:20 -0000 1.154 *************** *** 1450,1504 **** TCL_DECLARE_MUTEX(var_mutex) ! typedef CONST84_RETURN char* (*EventFunc1)(Tcl_Interp*, CONST char*, int); ! typedef CONST84_RETURN char* (*EventFunc2)(Tcl_Interp*, CONST char*, CONST char*, int); ! typedef CONST84_RETURN char* (*EventFunc3)(Tcl_Interp*, CONST char*, CONST char*, CONST char*, int); typedef struct VarEvent { Tcl_Event ev; /* must be first */ ! TkappObject *self; ! char* arg1; ! char* arg2; ! char* arg3; int flags; ! EventFunc1 func1; ! EventFunc2 func2; ! EventFunc3 func3; PyObject **res; ! PyObject **exc; Tcl_Condition cond; - int coderesult; } VarEvent; ! static const char* var_perform(VarEvent *ev) { ! if (!ev->arg2 && !ev->arg2) ! return ev->func1(ev->self->interp, ev->arg1, ev->flags); ! if (!ev->arg3) ! return ev->func2(ev->self->interp, ev->arg1, ! ev->arg2, ev->flags); ! return ev->func3(ev->self->interp, ev->arg1, ev->arg2, ! ev->arg3, ev->flags); ! } ! ! static void ! var_fill_result(VarEvent *ev, const char* res) ! { ! if (ev->coderesult) { ! if ((int)res != TCL_ERROR) { ! Py_INCREF(Py_None); ! *(ev->res) = Py_None; ! return; ! } ! } ! else if (res) { ! *(ev->res) = PyString_FromString(res); ! return; } ! ! *(ev->res) = NULL; ! *(ev->exc) = PyObject_CallFunction( ! Tkinter_TclError, "s", ! Tcl_GetStringResult(ev->self->interp)); ! } --- 1450,1479 ---- TCL_DECLARE_MUTEX(var_mutex) ! typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags); typedef struct VarEvent { Tcl_Event ev; /* must be first */ ! PyObject *self; ! PyObject *args; int flags; ! EventFunc func; PyObject **res; ! PyObject **exc_type; ! PyObject **exc_val; Tcl_Condition cond; } VarEvent; ! void var_perform(VarEvent *ev) { ! *(ev->res) = ev->func(ev->self, ev->args, ev->flags); ! if (!*(ev->res)) { ! PyObject *exc, *val, *tb; ! PyErr_Fetch(&exc, &val, &tb); ! PyErr_NormalizeException(&exc, &val, &tb); ! *(ev->exc_type) = exc; ! *(ev->exc_val) = val; ! Py_DECREF(tb); } ! } *************** *** 1506,1512 **** var_proc(VarEvent* ev, int flags) { - const char *result = var_perform(ev); ENTER_PYTHON ! var_fill_result(ev, result); Tcl_MutexLock(&var_mutex); Tcl_ConditionNotify(&ev->cond); --- 1481,1486 ---- var_proc(VarEvent* ev, int flags) { ENTER_PYTHON ! var_perform(ev); Tcl_MutexLock(&var_mutex); Tcl_ConditionNotify(&ev->cond); *************** *** 1517,1582 **** static PyObject* ! var_invoke(PyObject *_self, char* arg1, char* arg2, char* arg3, int flags, ! EventFunc1 func1, EventFunc2 func2, EventFunc3 func3, ! int coderesult) { - VarEvent _ev; TkappObject *self = (TkappObject*)_self; - VarEvent *ev = self->threaded ? - (VarEvent*)ckalloc(sizeof(VarEvent)) : &_ev; - PyObject *res, *exc; - - ev->self = self; - ev->arg1 = arg1; - ev->arg2 = arg2; - ev->arg3 = arg3; - ev->flags = flags; - ev->func1 = func1; - ev->func2 = func2; - ev->func3 = func3; - ev->coderesult = coderesult; - ev->res = &res; - ev->exc = &exc; #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { /* The current thread is not the interpreter thread. Marshal the call to the interpreter thread, then wait for completion. */ - if (!WaitForMainloop(self)) return NULL; ev->cond = NULL; ev->ev.proc = (Tcl_EventProc*)var_proc; Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->cond, &var_mutex); } - else #endif ! { ! /* Tcl is not threaded, or this is the interpreter thread. To ! perform the call, we must hold the TCL lock. To receive the ! results, we must also hold the Python lock. */ ! const char *result; ! ENTER_TCL ! result = var_perform(ev); ! ENTER_OVERLAP ! var_fill_result(ev, result); ! LEAVE_OVERLAP_TCL ! } ! if (!res) { ! PyErr_SetObject(Tkinter_TclError, exc); ! return NULL; ! } ! return res; ! } ! ! static PyObject* ! var_invoke2(PyObject *_self, char* arg1, char* arg2, char* arg3, int flags, ! int (*func1)(Tcl_Interp*, CONST char*, int), ! int (*func2)(Tcl_Interp*, CONST char*, CONST char*, int), ! int (*func3)(Tcl_Interp*, CONST char*, CONST char*, CONST char*, int)) ! { ! return var_invoke(_self, arg1, arg2, arg3, flags, ! (EventFunc1)func1, (EventFunc2)func2, ! (EventFunc3)func3, 1); } --- 1491,1532 ---- static PyObject* ! var_invoke(EventFunc func, PyObject *_self, PyObject *args, int flags) { TkappObject *self = (TkappObject*)_self; #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { + TkappObject *self = (TkappObject*)_self; + VarEvent *ev; + PyObject *res, *exc_type, *exc_val; + /* The current thread is not the interpreter thread. Marshal the call to the interpreter thread, then wait for completion. */ if (!WaitForMainloop(self)) return NULL; + + ev = (VarEvent*)ckalloc(sizeof(VarEvent)); + + ev->self = _self; + ev->args = args; + ev->flags = flags; + ev->func = func; + ev->res = &res; + ev->exc_type = &exc_type; + ev->exc_val = &exc_val; ev->cond = NULL; ev->ev.proc = (Tcl_EventProc*)var_proc; Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->cond, &var_mutex); + if (!res) { + PyErr_SetObject(exc_type, exc_val); + Py_DECREF(exc_type); + Py_DECREF(exc_val); + return NULL; + } + return res; } #endif ! /* Tcl is not threaded, or this is the interpreter thread. */ ! return func(_self, args, flags); } *************** *** 1584,1603 **** SetVar(PyObject *self, PyObject *args, int flags) { ! char *name1, *name2, *s; ! PyObject *res; PyObject *newValue; ! PyObject *tmp; - tmp = PyList_New(0); - if (!tmp) - return NULL; - if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) { ! /* XXX Merge? */ ! s = AsString(newValue, tmp); ! if (s == NULL) return NULL; ! res = var_invoke(self, name1, s, NULL, flags, ! NULL, Tcl_SetVar, NULL, 0); } else { --- 1534,1558 ---- SetVar(PyObject *self, PyObject *args, int flags) { ! char *name1, *name2; PyObject *newValue; ! PyObject *res = NULL; ! Tcl_Obj *newval, *ok; if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) { ! /* XXX Acquire tcl lock??? */ ! newval = AsObj(newValue); ! if (newval == NULL) return NULL; ! ENTER_TCL ! ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, NULL, ! newval, flags); ! ENTER_OVERLAP ! if (!ok) ! Tkinter_Error(self); ! else { ! res = Py_None; ! Py_INCREF(res); ! } ! LEAVE_OVERLAP_TCL } else { *************** *** 1605,1627 **** if (PyArg_ParseTuple(args, "ssO:setvar", &name1, &name2, &newValue)) { ! s = AsString(newValue, tmp); ! if (s == NULL) ! return NULL; ! res = var_invoke(self, name1, name2, s, flags, ! NULL, NULL, Tcl_SetVar2, 0); } else { - Py_DECREF(tmp); return NULL; } } ! Py_DECREF(tmp); ! ! if (!res) ! return NULL; ! ! Py_DECREF(res); ! Py_INCREF(Py_None); ! return Py_None; } --- 1560,1581 ---- if (PyArg_ParseTuple(args, "ssO:setvar", &name1, &name2, &newValue)) { ! /* XXX must hold tcl lock already??? */ ! newval = AsObj(newValue); ! ENTER_TCL ! ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, name2, newval, flags); ! ENTER_OVERLAP ! if (!ok) ! Tkinter_Error(self); ! else { ! res = Py_None; ! Py_INCREF(res); ! } ! LEAVE_OVERLAP_TCL } else { return NULL; } } ! return res; } *************** *** 1629,1633 **** Tkapp_SetVar(PyObject *self, PyObject *args) { ! return SetVar(self, args, TCL_LEAVE_ERR_MSG); } --- 1583,1587 ---- Tkapp_SetVar(PyObject *self, PyObject *args) { ! return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG); } *************** *** 1635,1639 **** Tkapp_GlobalSetVar(PyObject *self, PyObject *args) { ! return SetVar(self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); } --- 1589,1593 ---- Tkapp_GlobalSetVar(PyObject *self, PyObject *args) { ! return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); } *************** *** 1645,1654 **** char *name1, *name2=NULL; PyObject *res = NULL; if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2)) return NULL; ! res = var_invoke(self, name1, name2, NULL, flags, ! Tcl_GetVar, Tcl_GetVar2, NULL, 0); return res; } --- 1599,1612 ---- char *name1, *name2=NULL; PyObject *res = NULL; + Tcl_Obj *tres; if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2)) return NULL; ! ENTER_TCL ! tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags); ! ENTER_OVERLAP ! res = FromObj(self, tres); ! LEAVE_OVERLAP_TCL return res; } *************** *** 1657,1661 **** Tkapp_GetVar(PyObject *self, PyObject *args) { ! return GetVar(self, args, TCL_LEAVE_ERR_MSG); } --- 1615,1619 ---- Tkapp_GetVar(PyObject *self, PyObject *args) { ! return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG); } *************** *** 1663,1667 **** Tkapp_GlobalGetVar(PyObject *self, PyObject *args) { ! return GetVar(self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); } --- 1621,1625 ---- Tkapp_GlobalGetVar(PyObject *self, PyObject *args) { ! return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); } *************** *** 1672,1675 **** --- 1630,1634 ---- { char *name1, *name2=NULL; + int code; PyObject *res = NULL; *************** *** 1677,1682 **** return NULL; ! res = var_invoke2(self, name1, name2, NULL, flags, ! Tcl_UnsetVar, Tcl_UnsetVar2, NULL); return res; } --- 1636,1649 ---- return NULL; ! ENTER_TCL ! code = Tcl_UnsetVar2(Tkapp_Interp(self), name1, name2, flags); ! ENTER_OVERLAP ! if (code == TCL_ERROR) ! res = Tkinter_Error(self); ! else { ! Py_INCREF(Py_None); ! res = Py_None; ! } ! LEAVE_OVERLAP_TCL return res; } *************** *** 1685,1689 **** Tkapp_UnsetVar(PyObject *self, PyObject *args) { ! return UnsetVar(self, args, TCL_LEAVE_ERR_MSG); } --- 1652,1656 ---- Tkapp_UnsetVar(PyObject *self, PyObject *args) { ! return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG); } *************** *** 1691,1695 **** Tkapp_GlobalUnsetVar(PyObject *self, PyObject *args) { ! return UnsetVar(self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); } --- 1658,1662 ---- Tkapp_GlobalUnsetVar(PyObject *self, PyObject *args) { ! return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); } From jackjansen@users.sourceforge.net Tue Apr 15 22:40:33 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 15 Apr 2003 14:40:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_scriptpackages.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16396/Lib/test Modified Files: test_scriptpackages.py Log Message: Test SystemEvents too. Index: test_scriptpackages.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scriptpackages.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_scriptpackages.py 28 Mar 2003 22:01:41 -0000 1.1 --- test_scriptpackages.py 15 Apr 2003 21:40:30 -0000 1.2 *************** *** 27,30 **** --- 27,33 ---- self._test_scriptpackage('StdSuites') + def test_SystemEvents(self): + self._test_scriptpackage('SystemEvents') + def test_Finder(self): self._test_scriptpackage('Finder') *************** *** 40,44 **** def test_CodeWarrior(self): ! self._test_scriptpackage('CodeWarrior') def test_main(): --- 43,47 ---- def test_CodeWarrior(self): ! self._test_scriptpackage('CodeWarrior') def test_main(): From jackjansen@users.sourceforge.net Tue Apr 15 22:59:44 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 15 Apr 2003 14:59:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv26719 Modified Files: PackageManager.py Log Message: Adapted GUI for per-user install. Doesn't do anything yet, though Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PackageManager.py 16 Mar 2003 21:04:50 -0000 1.5 --- PackageManager.py 15 Apr 2003 21:59:42 -0000 1.6 *************** *** 249,253 **** return pkg.installed() ! def installpackage(self, sel, output, recursive, force): pkg = self.packages[sel] list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive) --- 249,253 ---- return pkg.installed() ! def installpackage(self, sel, output, recursive, force, user): pkg = self.packages[sel] list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive) *************** *** 270,289 **** self.closepimp() ! def setupwidgets(self): self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0) - ## self.w.divline = W.HorizontalLine((0, 20, 0, 0)) self.w.titlebar = W.TextBox((4, 4, 40, 12), 'Packages:') data = self.getbrowserdata() ! self.w.packagebrowser = W.MultiList((4, 20, 0, -70), data, self.listhit, cols=3) ! self.w.installed_l = W.TextBox((4, -66, 60, 12), 'Installed:') ! self.w.installed = W.TextBox((64, -66, 0, 12), '') ! self.w.message_l = W.TextBox((4, -48, 60, 12), 'Status:') ! self.w.message = W.TextBox((64, -48, 0, 12), '') ! self.w.homepage_button = W.Button((4, -28, 96, 18), 'View homepage', self.do_homepage) ! self.w.verbose_button = W.CheckBox((-358, -26, 60, 18), 'Verbose') ! self.w.recursive_button = W.CheckBox((-284, -26, 140, 18), 'Install dependencies', self.updatestatus) self.w.recursive_button.set(1) ! self.w.force_button = W.CheckBox((-160, -26, 80, 18), 'Overwrite', self.updatestatus) ! self.w.install_button = W.Button((-76, -28, 56, 18), 'Install', self.do_install) self.w.open() --- 270,294 ---- self.closepimp() ! def setupwidgets(self): ! INSTALL_POS = -30 ! STATUS_POS = INSTALL_POS - 62 self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0) self.w.titlebar = W.TextBox((4, 4, 40, 12), 'Packages:') data = self.getbrowserdata() ! self.w.packagebrowser = W.MultiList((4, 20, 0, STATUS_POS-2), data, self.listhit, cols=3) ! ! self.w.installed_l = W.TextBox((4, STATUS_POS, 60, 12), 'Installed:') ! self.w.installed = W.TextBox((64, STATUS_POS, 0, 12), '') ! self.w.message_l = W.TextBox((4, STATUS_POS+20, 60, 12), 'Status:') ! self.w.message = W.TextBox((64, STATUS_POS+20, 0, 12), '') ! self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage) ! ! self.w.divline = W.HorizontalLine((0, INSTALL_POS, 0, 0)) ! self.w.verbose_button = W.CheckBox((-358, INSTALL_POS+4, 60, 18), 'Verbose') ! self.w.recursive_button = W.CheckBox((-284, INSTALL_POS+4, 140, 18), 'Install dependencies', self.updatestatus) self.w.recursive_button.set(1) ! self.w.force_button = W.CheckBox((-160, INSTALL_POS+4, 70, 18), 'Overwrite', self.updatestatus) ! self.w.user_button = W.CheckBox((-90, INSTALL_POS+4, 100, 18), 'User Only') ! self.w.install_button = W.Button((4, INSTALL_POS+4, 56, 18), 'Install', self.do_install) self.w.open() *************** *** 300,303 **** --- 305,309 ---- self.w.recursive_button.enable(0) self.w.force_button.enable(0) + self.w.user_button.enable(0) else: sel = sel[0] *************** *** 311,314 **** --- 317,321 ---- self.w.recursive_button.enable(1) self.w.force_button.enable(1) + self.w.user_button.enable(0) # XXXX def listhit(self, *args, **kwargs): *************** *** 323,327 **** recursive = self.w.recursive_button.get() force = self.w.force_button.get() ! messages = self.installpackage(sel, output, recursive, force) self.updatestatus() if messages: --- 330,335 ---- recursive = self.w.recursive_button.get() force = self.w.force_button.get() ! user = self.w.user_button.get() ! messages = self.installpackage(sel, output, recursive, force, user) self.updatestatus() if messages: From gvanrossum@users.sourceforge.net Tue Apr 15 23:09:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 15 Apr 2003 15:09:49 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.225,2.226 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31822 Modified Files: typeobject.c Log Message: Fix three (!) object leaks in the code for assignment to __bases__. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.225 retrieving revision 2.226 diff -C2 -d -r2.225 -r2.226 *** typeobject.c 15 Apr 2003 20:04:28 -0000 2.225 --- typeobject.c 15 Apr 2003 22:09:45 -0000 2.226 *************** *** 165,172 **** --- 165,174 ---- PyObject* tuple; tuple = Py_BuildValue("OO", subclass, old_mro); + Py_DECREF(old_mro); if (!tuple) return -1; if (PyList_Append(temp, tuple) < 0) return -1; + Py_DECREF(tuple); } if (mro_subclasses(subclass, temp) < 0) *************** *** 257,261 **** PyTypeObject* cls; PyObject* mro; ! PyArg_ParseTuple(PyList_GetItem(temp, i), "OO", &cls, &mro); Py_DECREF(cls->tp_mro); --- 259,263 ---- PyTypeObject* cls; PyObject* mro; ! PyArg_ParseTuple(PyList_GET_ITEM(temp, i), "OO", &cls, &mro); Py_DECREF(cls->tp_mro); From doerwalter@users.sourceforge.net Wed Apr 16 10:46:15 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 16 Apr 2003 02:46:15 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.724,1.725 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29582/Misc Modified Files: NEWS Log Message: Add two dictionaries to htmlentitydefs: name2codepoint maps HTML entity names to Unicode codepoints (as integers). codepoint2name is the reverse mapping. From SF patch #722017. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.724 retrieving revision 1.725 diff -C2 -d -r1.724 -r1.725 *** NEWS 15 Apr 2003 15:10:42 -0000 1.724 --- NEWS 16 Apr 2003 09:46:11 -0000 1.725 *************** *** 104,107 **** --- 104,111 ---- ------- + - htmlentitydefs has two new dictionaries: name2codepoint maps + HTML entity names to Unicode codepoints (as integers). + codepoint2name is the reverse mapping. See SF patch #722017. + - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. From doerwalter@users.sourceforge.net Wed Apr 16 10:46:16 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 16 Apr 2003 02:46:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmllib.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29582/Doc/lib Modified Files: libhtmllib.tex Log Message: Add two dictionaries to htmlentitydefs: name2codepoint maps HTML entity names to Unicode codepoints (as integers). codepoint2name is the reverse mapping. From SF patch #722017. Index: libhtmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmllib.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libhtmllib.tex 5 Jul 2001 16:34:36 -0000 1.23 --- libhtmllib.tex 16 Apr 2003 09:46:13 -0000 1.24 *************** *** 146,153 **** \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! This module defines a single dictionary, \code{entitydefs}, which is used by the \refmodule{htmllib} module to provide the \member{entitydefs} member of the \class{HTMLParser} class. The ! definition provided here contains all the entities defined by HTML 2.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). --- 146,154 ---- \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! This module defines three dictionaries, \code{name2codepoint}, ! \code{codepoint2name}, and \code{entitydefs}. \code{entitydefs} is used by the \refmodule{htmllib} module to provide the \member{entitydefs} member of the \class{HTMLParser} class. The ! definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). *************** *** 155,159 **** \begin{datadesc}{entitydefs} ! A dictionary mapping HTML 2.0 entity definitions to their replacement text in ISO Latin-1. \end{datadesc} --- 156,171 ---- \begin{datadesc}{entitydefs} ! A dictionary mapping XHTML 1.0 entity definitions to their replacement text in ISO Latin-1. + + \end{datadesc} + + \begin{datadesc}{name2codepoint} + A dictionary that maps HTML entity names to the Unicode codepoints. \end{datadesc} + + \begin{datadesc}{codepoint2name} + A dictionary that maps Unicode codepoints to HTML entity names. + \end{datadesc} + + From doerwalter@users.sourceforge.net Wed Apr 16 10:46:15 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 16 Apr 2003 02:46:15 -0700 Subject: [Python-checkins] python/dist/src/Lib htmlentitydefs.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29582/Lib Modified Files: htmlentitydefs.py Log Message: Add two dictionaries to htmlentitydefs: name2codepoint maps HTML entity names to Unicode codepoints (as integers). codepoint2name is the reverse mapping. From SF patch #722017. Index: htmlentitydefs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/htmlentitydefs.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** htmlentitydefs.py 18 Feb 2001 03:30:53 -0000 1.8 --- htmlentitydefs.py 16 Apr 2003 09:46:13 -0000 1.9 *************** *** 1,257 **** """HTML character entity references.""" ! entitydefs = { ! 'AElig': '\306', # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 ! 'Aacute': '\301', # latin capital letter A with acute, U+00C1 ISOlat1 ! 'Acirc': '\302', # latin capital letter A with circumflex, U+00C2 ISOlat1 ! 'Agrave': '\300', # latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 ! 'Alpha': 'Α', # greek capital letter alpha, U+0391 ! 'Aring': '\305', # latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 ! 'Atilde': '\303', # latin capital letter A with tilde, U+00C3 ISOlat1 ! 'Auml': '\304', # latin capital letter A with diaeresis, U+00C4 ISOlat1 ! 'Beta': 'Β', # greek capital letter beta, U+0392 ! 'Ccedil': '\307', # latin capital letter C with cedilla, U+00C7 ISOlat1 ! 'Chi': 'Χ', # greek capital letter chi, U+03A7 ! 'Dagger': '‡', # double dagger, U+2021 ISOpub ! 'Delta': 'Δ', # greek capital letter delta, U+0394 ISOgrk3 ! 'ETH': '\320', # latin capital letter ETH, U+00D0 ISOlat1 ! 'Eacute': '\311', # latin capital letter E with acute, U+00C9 ISOlat1 ! 'Ecirc': '\312', # latin capital letter E with circumflex, U+00CA ISOlat1 ! 'Egrave': '\310', # latin capital letter E with grave, U+00C8 ISOlat1 ! 'Epsilon': 'Ε', # greek capital letter epsilon, U+0395 ! 'Eta': 'Η', # greek capital letter eta, U+0397 ! 'Euml': '\313', # latin capital letter E with diaeresis, U+00CB ISOlat1 ! 'Gamma': 'Γ', # greek capital letter gamma, U+0393 ISOgrk3 ! 'Iacute': '\315', # latin capital letter I with acute, U+00CD ISOlat1 ! 'Icirc': '\316', # latin capital letter I with circumflex, U+00CE ISOlat1 ! 'Igrave': '\314', # latin capital letter I with grave, U+00CC ISOlat1 ! 'Iota': 'Ι', # greek capital letter iota, U+0399 ! 'Iuml': '\317', # latin capital letter I with diaeresis, U+00CF ISOlat1 ! 'Kappa': 'Κ', # greek capital letter kappa, U+039A ! 'Lambda': 'Λ', # greek capital letter lambda, U+039B ISOgrk3 ! 'Mu': 'Μ', # greek capital letter mu, U+039C ! 'Ntilde': '\321', # latin capital letter N with tilde, U+00D1 ISOlat1 ! 'Nu': 'Ν', # greek capital letter nu, U+039D ! 'OElig': 'Œ', # latin capital ligature OE, U+0152 ISOlat2 ! 'Oacute': '\323', # latin capital letter O with acute, U+00D3 ISOlat1 ! 'Ocirc': '\324', # latin capital letter O with circumflex, U+00D4 ISOlat1 ! 'Ograve': '\322', # latin capital letter O with grave, U+00D2 ISOlat1 ! 'Omega': 'Ω', # greek capital letter omega, U+03A9 ISOgrk3 ! 'Omicron': 'Ο', # greek capital letter omicron, U+039F ! 'Oslash': '\330', # latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 ! 'Otilde': '\325', # latin capital letter O with tilde, U+00D5 ISOlat1 ! 'Ouml': '\326', # latin capital letter O with diaeresis, U+00D6 ISOlat1 ! 'Phi': 'Φ', # greek capital letter phi, U+03A6 ISOgrk3 ! 'Pi': 'Π', # greek capital letter pi, U+03A0 ISOgrk3 ! 'Prime': '″', # double prime = seconds = inches, U+2033 ISOtech ! 'Psi': 'Ψ', # greek capital letter psi, U+03A8 ISOgrk3 ! 'Rho': 'Ρ', # greek capital letter rho, U+03A1 ! 'Scaron': 'Š', # latin capital letter S with caron, U+0160 ISOlat2 ! 'Sigma': 'Σ', # greek capital letter sigma, U+03A3 ISOgrk3 ! 'THORN': '\336', # latin capital letter THORN, U+00DE ISOlat1 ! 'Tau': 'Τ', # greek capital letter tau, U+03A4 ! 'Theta': 'Θ', # greek capital letter theta, U+0398 ISOgrk3 ! 'Uacute': '\332', # latin capital letter U with acute, U+00DA ISOlat1 ! 'Ucirc': '\333', # latin capital letter U with circumflex, U+00DB ISOlat1 ! 'Ugrave': '\331', # latin capital letter U with grave, U+00D9 ISOlat1 ! 'Upsilon': 'Υ', # greek capital letter upsilon, U+03A5 ISOgrk3 ! 'Uuml': '\334', # latin capital letter U with diaeresis, U+00DC ISOlat1 ! 'Xi': 'Ξ', # greek capital letter xi, U+039E ISOgrk3 ! 'Yacute': '\335', # latin capital letter Y with acute, U+00DD ISOlat1 ! 'Yuml': 'Ÿ', # latin capital letter Y with diaeresis, U+0178 ISOlat2 ! 'Zeta': 'Ζ', # greek capital letter zeta, U+0396 ! 'aacute': '\341', # latin small letter a with acute, U+00E1 ISOlat1 ! 'acirc': '\342', # latin small letter a with circumflex, U+00E2 ISOlat1 ! 'acute': '\264', # acute accent = spacing acute, U+00B4 ISOdia ! 'aelig': '\346', # latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 ! 'agrave': '\340', # latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 ! 'alefsym': 'ℵ', # alef symbol = first transfinite cardinal, U+2135 NEW ! 'alpha': 'α', # greek small letter alpha, U+03B1 ISOgrk3 ! 'amp': '\46', # ampersand, U+0026 ISOnum ! 'and': '∧', # logical and = wedge, U+2227 ISOtech ! 'ang': '∠', # angle, U+2220 ISOamso ! 'aring': '\345', # latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 ! 'asymp': '≈', # almost equal to = asymptotic to, U+2248 ISOamsr ! 'atilde': '\343', # latin small letter a with tilde, U+00E3 ISOlat1 ! 'auml': '\344', # latin small letter a with diaeresis, U+00E4 ISOlat1 ! 'bdquo': '„', # double low-9 quotation mark, U+201E NEW ! 'beta': 'β', # greek small letter beta, U+03B2 ISOgrk3 ! 'brvbar': '\246', # broken bar = broken vertical bar, U+00A6 ISOnum ! 'bull': '•', # bullet = black small circle, U+2022 ISOpub ! 'cap': '∩', # intersection = cap, U+2229 ISOtech ! 'ccedil': '\347', # latin small letter c with cedilla, U+00E7 ISOlat1 ! 'cedil': '\270', # cedilla = spacing cedilla, U+00B8 ISOdia ! 'cent': '\242', # cent sign, U+00A2 ISOnum ! 'chi': 'χ', # greek small letter chi, U+03C7 ISOgrk3 ! 'circ': 'ˆ', # modifier letter circumflex accent, U+02C6 ISOpub ! 'clubs': '♣', # black club suit = shamrock, U+2663 ISOpub ! 'cong': '≅', # approximately equal to, U+2245 ISOtech ! 'copy': '\251', # copyright sign, U+00A9 ISOnum ! 'crarr': '↵', # downwards arrow with corner leftwards = carriage return, U+21B5 NEW ! 'cup': '∪', # union = cup, U+222A ISOtech ! 'curren': '\244', # currency sign, U+00A4 ISOnum ! 'dArr': '⇓', # downwards double arrow, U+21D3 ISOamsa ! 'dagger': '†', # dagger, U+2020 ISOpub ! 'darr': '↓', # downwards arrow, U+2193 ISOnum ! 'deg': '\260', # degree sign, U+00B0 ISOnum ! 'delta': 'δ', # greek small letter delta, U+03B4 ISOgrk3 ! 'diams': '♦', # black diamond suit, U+2666 ISOpub ! 'divide': '\367', # division sign, U+00F7 ISOnum ! 'eacute': '\351', # latin small letter e with acute, U+00E9 ISOlat1 ! 'ecirc': '\352', # latin small letter e with circumflex, U+00EA ISOlat1 ! 'egrave': '\350', # latin small letter e with grave, U+00E8 ISOlat1 ! 'empty': '∅', # empty set = null set = diameter, U+2205 ISOamso ! 'emsp': ' ', # em space, U+2003 ISOpub ! 'ensp': ' ', # en space, U+2002 ISOpub ! 'epsilon': 'ε', # greek small letter epsilon, U+03B5 ISOgrk3 ! 'equiv': '≡', # identical to, U+2261 ISOtech ! 'eta': 'η', # greek small letter eta, U+03B7 ISOgrk3 ! 'eth': '\360', # latin small letter eth, U+00F0 ISOlat1 ! 'euml': '\353', # latin small letter e with diaeresis, U+00EB ISOlat1 ! 'euro': '€', # euro sign, U+20AC NEW ! 'exist': '∃', # there exists, U+2203 ISOtech ! 'fnof': 'ƒ', # latin small f with hook = function = florin, U+0192 ISOtech ! 'forall': '∀', # for all, U+2200 ISOtech ! 'frac12': '\275', # vulgar fraction one half = fraction one half, U+00BD ISOnum ! 'frac14': '\274', # vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum ! 'frac34': '\276', # vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum ! 'frasl': '⁄', # fraction slash, U+2044 NEW ! 'gamma': 'γ', # greek small letter gamma, U+03B3 ISOgrk3 ! 'ge': '≥', # greater-than or equal to, U+2265 ISOtech ! 'gt': '\76', # greater-than sign, U+003E ISOnum ! 'hArr': '⇔', # left right double arrow, U+21D4 ISOamsa ! 'harr': '↔', # left right arrow, U+2194 ISOamsa ! 'hearts': '♥', # black heart suit = valentine, U+2665 ISOpub ! 'hellip': '…', # horizontal ellipsis = three dot leader, U+2026 ISOpub ! 'iacute': '\355', # latin small letter i with acute, U+00ED ISOlat1 ! 'icirc': '\356', # latin small letter i with circumflex, U+00EE ISOlat1 ! 'iexcl': '\241', # inverted exclamation mark, U+00A1 ISOnum ! 'igrave': '\354', # latin small letter i with grave, U+00EC ISOlat1 ! 'image': 'ℑ', # blackletter capital I = imaginary part, U+2111 ISOamso ! 'infin': '∞', # infinity, U+221E ISOtech ! 'int': '∫', # integral, U+222B ISOtech ! 'iota': 'ι', # greek small letter iota, U+03B9 ISOgrk3 ! 'iquest': '\277', # inverted question mark = turned question mark, U+00BF ISOnum ! 'isin': '∈', # element of, U+2208 ISOtech ! 'iuml': '\357', # latin small letter i with diaeresis, U+00EF ISOlat1 ! 'kappa': 'κ', # greek small letter kappa, U+03BA ISOgrk3 ! 'lArr': '⇐', # leftwards double arrow, U+21D0 ISOtech ! 'lambda': 'λ', # greek small letter lambda, U+03BB ISOgrk3 ! 'lang': '〈', # left-pointing angle bracket = bra, U+2329 ISOtech ! 'laquo': '\253', # left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum ! 'larr': '←', # leftwards arrow, U+2190 ISOnum ! 'lceil': '⌈', # left ceiling = apl upstile, U+2308 ISOamsc ! 'ldquo': '“', # left double quotation mark, U+201C ISOnum ! 'le': '≤', # less-than or equal to, U+2264 ISOtech ! 'lfloor': '⌊', # left floor = apl downstile, U+230A ISOamsc ! 'lowast': '∗', # asterisk operator, U+2217 ISOtech ! 'loz': '◊', # lozenge, U+25CA ISOpub ! 'lrm': '‎', # left-to-right mark, U+200E NEW RFC 2070 ! 'lsaquo': '‹', # single left-pointing angle quotation mark, U+2039 ISO proposed ! 'lsquo': '‘', # left single quotation mark, U+2018 ISOnum ! 'lt': '\74', # less-than sign, U+003C ISOnum ! 'macr': '\257', # macron = spacing macron = overline = APL overbar, U+00AF ISOdia ! 'mdash': '—', # em dash, U+2014 ISOpub ! 'micro': '\265', # micro sign, U+00B5 ISOnum ! 'middot': '\267', # middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum ! 'minus': '−', # minus sign, U+2212 ISOtech ! 'mu': 'μ', # greek small letter mu, U+03BC ISOgrk3 ! 'nabla': '∇', # nabla = backward difference, U+2207 ISOtech ! 'nbsp': '\240', # no-break space = non-breaking space, U+00A0 ISOnum ! 'ndash': '–', # en dash, U+2013 ISOpub ! 'ne': '≠', # not equal to, U+2260 ISOtech ! 'ni': '∋', # contains as member, U+220B ISOtech ! 'not': '\254', # not sign, U+00AC ISOnum ! 'notin': '∉', # not an element of, U+2209 ISOtech ! 'nsub': '⊄', # not a subset of, U+2284 ISOamsn ! 'ntilde': '\361', # latin small letter n with tilde, U+00F1 ISOlat1 ! 'nu': 'ν', # greek small letter nu, U+03BD ISOgrk3 ! 'oacute': '\363', # latin small letter o with acute, U+00F3 ISOlat1 ! 'ocirc': '\364', # latin small letter o with circumflex, U+00F4 ISOlat1 ! 'oelig': 'œ', # latin small ligature oe, U+0153 ISOlat2 ! 'ograve': '\362', # latin small letter o with grave, U+00F2 ISOlat1 ! 'oline': '‾', # overline = spacing overscore, U+203E NEW ! 'omega': 'ω', # greek small letter omega, U+03C9 ISOgrk3 ! 'omicron': 'ο', # greek small letter omicron, U+03BF NEW ! 'oplus': '⊕', # circled plus = direct sum, U+2295 ISOamsb ! 'or': '∨', # logical or = vee, U+2228 ISOtech ! 'ordf': '\252', # feminine ordinal indicator, U+00AA ISOnum ! 'ordm': '\272', # masculine ordinal indicator, U+00BA ISOnum ! 'oslash': '\370', # latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 ! 'otilde': '\365', # latin small letter o with tilde, U+00F5 ISOlat1 ! 'otimes': '⊗', # circled times = vector product, U+2297 ISOamsb ! 'ouml': '\366', # latin small letter o with diaeresis, U+00F6 ISOlat1 ! 'para': '\266', # pilcrow sign = paragraph sign, U+00B6 ISOnum ! 'part': '∂', # partial differential, U+2202 ISOtech ! 'permil': '‰', # per mille sign, U+2030 ISOtech ! 'perp': '⊥', # up tack = orthogonal to = perpendicular, U+22A5 ISOtech ! 'phi': 'φ', # greek small letter phi, U+03C6 ISOgrk3 ! 'pi': 'π', # greek small letter pi, U+03C0 ISOgrk3 ! 'piv': 'ϖ', # greek pi symbol, U+03D6 ISOgrk3 ! 'plusmn': '\261', # plus-minus sign = plus-or-minus sign, U+00B1 ISOnum ! 'pound': '\243', # pound sign, U+00A3 ISOnum ! 'prime': '′', # prime = minutes = feet, U+2032 ISOtech ! 'prod': '∏', # n-ary product = product sign, U+220F ISOamsb ! 'prop': '∝', # proportional to, U+221D ISOtech ! 'psi': 'ψ', # greek small letter psi, U+03C8 ISOgrk3 ! 'quot': '\42', # quotation mark = APL quote, U+0022 ISOnum ! 'rArr': '⇒', # rightwards double arrow, U+21D2 ISOtech ! 'radic': '√', # square root = radical sign, U+221A ISOtech ! 'rang': '〉', # right-pointing angle bracket = ket, U+232A ISOtech ! 'raquo': '\273', # right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum ! 'rarr': '→', # rightwards arrow, U+2192 ISOnum ! 'rceil': '⌉', # right ceiling, U+2309 ISOamsc ! 'rdquo': '”', # right double quotation mark, U+201D ISOnum ! 'real': 'ℜ', # blackletter capital R = real part symbol, U+211C ISOamso ! 'reg': '\256', # registered sign = registered trade mark sign, U+00AE ISOnum ! 'rfloor': '⌋', # right floor, U+230B ISOamsc ! 'rho': 'ρ', # greek small letter rho, U+03C1 ISOgrk3 ! 'rlm': '‏', # right-to-left mark, U+200F NEW RFC 2070 ! 'rsaquo': '›', # single right-pointing angle quotation mark, U+203A ISO proposed ! 'rsquo': '’', # right single quotation mark, U+2019 ISOnum ! 'sbquo': '‚', # single low-9 quotation mark, U+201A NEW ! 'scaron': 'š', # latin small letter s with caron, U+0161 ISOlat2 ! 'sdot': '⋅', # dot operator, U+22C5 ISOamsb ! 'sect': '\247', # section sign, U+00A7 ISOnum ! 'shy': '\255', # soft hyphen = discretionary hyphen, U+00AD ISOnum ! 'sigma': 'σ', # greek small letter sigma, U+03C3 ISOgrk3 ! 'sigmaf': 'ς', # greek small letter final sigma, U+03C2 ISOgrk3 ! 'sim': '∼', # tilde operator = varies with = similar to, U+223C ISOtech ! 'spades': '♠', # black spade suit, U+2660 ISOpub ! 'sub': '⊂', # subset of, U+2282 ISOtech ! 'sube': '⊆', # subset of or equal to, U+2286 ISOtech ! 'sum': '∑', # n-ary sumation, U+2211 ISOamsb ! 'sup': '⊃', # superset of, U+2283 ISOtech ! 'sup1': '\271', # superscript one = superscript digit one, U+00B9 ISOnum ! 'sup2': '\262', # superscript two = superscript digit two = squared, U+00B2 ISOnum ! 'sup3': '\263', # superscript three = superscript digit three = cubed, U+00B3 ISOnum ! 'supe': '⊇', # superset of or equal to, U+2287 ISOtech ! 'szlig': '\337', # latin small letter sharp s = ess-zed, U+00DF ISOlat1 ! 'tau': 'τ', # greek small letter tau, U+03C4 ISOgrk3 ! 'there4': '∴', # therefore, U+2234 ISOtech ! 'theta': 'θ', # greek small letter theta, U+03B8 ISOgrk3 ! 'thetasym': 'ϑ', # greek small letter theta symbol, U+03D1 NEW ! 'thinsp': ' ', # thin space, U+2009 ISOpub ! 'thorn': '\376', # latin small letter thorn with, U+00FE ISOlat1 ! 'tilde': '˜', # small tilde, U+02DC ISOdia ! 'times': '\327', # multiplication sign, U+00D7 ISOnum ! 'trade': '™', # trade mark sign, U+2122 ISOnum ! 'uArr': '⇑', # upwards double arrow, U+21D1 ISOamsa ! 'uacute': '\372', # latin small letter u with acute, U+00FA ISOlat1 ! 'uarr': '↑', # upwards arrow, U+2191 ISOnum ! 'ucirc': '\373', # latin small letter u with circumflex, U+00FB ISOlat1 ! 'ugrave': '\371', # latin small letter u with grave, U+00F9 ISOlat1 ! 'uml': '\250', # diaeresis = spacing diaeresis, U+00A8 ISOdia ! 'upsih': 'ϒ', # greek upsilon with hook symbol, U+03D2 NEW ! 'upsilon': 'υ', # greek small letter upsilon, U+03C5 ISOgrk3 ! 'uuml': '\374', # latin small letter u with diaeresis, U+00FC ISOlat1 ! 'weierp': '℘', # script capital P = power set = Weierstrass p, U+2118 ISOamso ! 'xi': 'ξ', # greek small letter xi, U+03BE ISOgrk3 ! 'yacute': '\375', # latin small letter y with acute, U+00FD ISOlat1 ! 'yen': '\245', # yen sign = yuan sign, U+00A5 ISOnum ! 'yuml': '\377', # latin small letter y with diaeresis, U+00FF ISOlat1 ! 'zeta': 'ζ', # greek small letter zeta, U+03B6 ISOgrk3 ! 'zwj': '‍', # zero width joiner, U+200D NEW RFC 2070 ! 'zwnj': '‌', # zero width non-joiner, U+200C NEW RFC 2070 ! } --- 1,273 ---- """HTML character entity references.""" ! # maps the HTML entity name to the Unicode codepoint ! name2codepoint = { ! 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 ! 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1 ! 'Acirc': 0x00c2, # latin capital letter A with circumflex, U+00C2 ISOlat1 ! 'Agrave': 0x00c0, # latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 ! 'Alpha': 0x0391, # greek capital letter alpha, U+0391 ! 'Aring': 0x00c5, # latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 ! 'Atilde': 0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1 ! 'Auml': 0x00c4, # latin capital letter A with diaeresis, U+00C4 ISOlat1 ! 'Beta': 0x0392, # greek capital letter beta, U+0392 ! 'Ccedil': 0x00c7, # latin capital letter C with cedilla, U+00C7 ISOlat1 ! 'Chi': 0x03a7, # greek capital letter chi, U+03A7 ! 'Dagger': 0x2021, # double dagger, U+2021 ISOpub ! 'Delta': 0x0394, # greek capital letter delta, U+0394 ISOgrk3 ! 'ETH': 0x00d0, # latin capital letter ETH, U+00D0 ISOlat1 ! 'Eacute': 0x00c9, # latin capital letter E with acute, U+00C9 ISOlat1 ! 'Ecirc': 0x00ca, # latin capital letter E with circumflex, U+00CA ISOlat1 ! 'Egrave': 0x00c8, # latin capital letter E with grave, U+00C8 ISOlat1 ! 'Epsilon': 0x0395, # greek capital letter epsilon, U+0395 ! 'Eta': 0x0397, # greek capital letter eta, U+0397 ! 'Euml': 0x00cb, # latin capital letter E with diaeresis, U+00CB ISOlat1 ! 'Gamma': 0x0393, # greek capital letter gamma, U+0393 ISOgrk3 ! 'Iacute': 0x00cd, # latin capital letter I with acute, U+00CD ISOlat1 ! 'Icirc': 0x00ce, # latin capital letter I with circumflex, U+00CE ISOlat1 ! 'Igrave': 0x00cc, # latin capital letter I with grave, U+00CC ISOlat1 ! 'Iota': 0x0399, # greek capital letter iota, U+0399 ! 'Iuml': 0x00cf, # latin capital letter I with diaeresis, U+00CF ISOlat1 ! 'Kappa': 0x039a, # greek capital letter kappa, U+039A ! 'Lambda': 0x039b, # greek capital letter lambda, U+039B ISOgrk3 ! 'Mu': 0x039c, # greek capital letter mu, U+039C ! 'Ntilde': 0x00d1, # latin capital letter N with tilde, U+00D1 ISOlat1 ! 'Nu': 0x039d, # greek capital letter nu, U+039D ! 'OElig': 0x0152, # latin capital ligature OE, U+0152 ISOlat2 ! 'Oacute': 0x00d3, # latin capital letter O with acute, U+00D3 ISOlat1 ! 'Ocirc': 0x00d4, # latin capital letter O with circumflex, U+00D4 ISOlat1 ! 'Ograve': 0x00d2, # latin capital letter O with grave, U+00D2 ISOlat1 ! 'Omega': 0x03a9, # greek capital letter omega, U+03A9 ISOgrk3 ! 'Omicron': 0x039f, # greek capital letter omicron, U+039F ! 'Oslash': 0x00d8, # latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 ! 'Otilde': 0x00d5, # latin capital letter O with tilde, U+00D5 ISOlat1 ! 'Ouml': 0x00d6, # latin capital letter O with diaeresis, U+00D6 ISOlat1 ! 'Phi': 0x03a6, # greek capital letter phi, U+03A6 ISOgrk3 ! 'Pi': 0x03a0, # greek capital letter pi, U+03A0 ISOgrk3 ! 'Prime': 0x2033, # double prime = seconds = inches, U+2033 ISOtech ! 'Psi': 0x03a8, # greek capital letter psi, U+03A8 ISOgrk3 ! 'Rho': 0x03a1, # greek capital letter rho, U+03A1 ! 'Scaron': 0x0160, # latin capital letter S with caron, U+0160 ISOlat2 ! 'Sigma': 0x03a3, # greek capital letter sigma, U+03A3 ISOgrk3 ! 'THORN': 0x00de, # latin capital letter THORN, U+00DE ISOlat1 ! 'Tau': 0x03a4, # greek capital letter tau, U+03A4 ! 'Theta': 0x0398, # greek capital letter theta, U+0398 ISOgrk3 ! 'Uacute': 0x00da, # latin capital letter U with acute, U+00DA ISOlat1 ! 'Ucirc': 0x00db, # latin capital letter U with circumflex, U+00DB ISOlat1 ! 'Ugrave': 0x00d9, # latin capital letter U with grave, U+00D9 ISOlat1 ! 'Upsilon': 0x03a5, # greek capital letter upsilon, U+03A5 ISOgrk3 ! 'Uuml': 0x00dc, # latin capital letter U with diaeresis, U+00DC ISOlat1 ! 'Xi': 0x039e, # greek capital letter xi, U+039E ISOgrk3 ! 'Yacute': 0x00dd, # latin capital letter Y with acute, U+00DD ISOlat1 ! 'Yuml': 0x0178, # latin capital letter Y with diaeresis, U+0178 ISOlat2 ! 'Zeta': 0x0396, # greek capital letter zeta, U+0396 ! 'aacute': 0x00e1, # latin small letter a with acute, U+00E1 ISOlat1 ! 'acirc': 0x00e2, # latin small letter a with circumflex, U+00E2 ISOlat1 ! 'acute': 0x00b4, # acute accent = spacing acute, U+00B4 ISOdia ! 'aelig': 0x00e6, # latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 ! 'agrave': 0x00e0, # latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 ! 'alefsym': 0x2135, # alef symbol = first transfinite cardinal, U+2135 NEW ! 'alpha': 0x03b1, # greek small letter alpha, U+03B1 ISOgrk3 ! 'amp': 0x0026, # ampersand, U+0026 ISOnum ! 'and': 0x2227, # logical and = wedge, U+2227 ISOtech ! 'ang': 0x2220, # angle, U+2220 ISOamso ! 'aring': 0x00e5, # latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 ! 'asymp': 0x2248, # almost equal to = asymptotic to, U+2248 ISOamsr ! 'atilde': 0x00e3, # latin small letter a with tilde, U+00E3 ISOlat1 ! 'auml': 0x00e4, # latin small letter a with diaeresis, U+00E4 ISOlat1 ! 'bdquo': 0x201e, # double low-9 quotation mark, U+201E NEW ! 'beta': 0x03b2, # greek small letter beta, U+03B2 ISOgrk3 ! 'brvbar': 0x00a6, # broken bar = broken vertical bar, U+00A6 ISOnum ! 'bull': 0x2022, # bullet = black small circle, U+2022 ISOpub ! 'cap': 0x2229, # intersection = cap, U+2229 ISOtech ! 'ccedil': 0x00e7, # latin small letter c with cedilla, U+00E7 ISOlat1 ! 'cedil': 0x00b8, # cedilla = spacing cedilla, U+00B8 ISOdia ! 'cent': 0x00a2, # cent sign, U+00A2 ISOnum ! 'chi': 0x03c7, # greek small letter chi, U+03C7 ISOgrk3 ! 'circ': 0x02c6, # modifier letter circumflex accent, U+02C6 ISOpub ! 'clubs': 0x2663, # black club suit = shamrock, U+2663 ISOpub ! 'cong': 0x2245, # approximately equal to, U+2245 ISOtech ! 'copy': 0x00a9, # copyright sign, U+00A9 ISOnum ! 'crarr': 0x21b5, # downwards arrow with corner leftwards = carriage return, U+21B5 NEW ! 'cup': 0x222a, # union = cup, U+222A ISOtech ! 'curren': 0x00a4, # currency sign, U+00A4 ISOnum ! 'dArr': 0x21d3, # downwards double arrow, U+21D3 ISOamsa ! 'dagger': 0x2020, # dagger, U+2020 ISOpub ! 'darr': 0x2193, # downwards arrow, U+2193 ISOnum ! 'deg': 0x00b0, # degree sign, U+00B0 ISOnum ! 'delta': 0x03b4, # greek small letter delta, U+03B4 ISOgrk3 ! 'diams': 0x2666, # black diamond suit, U+2666 ISOpub ! 'divide': 0x00f7, # division sign, U+00F7 ISOnum ! 'eacute': 0x00e9, # latin small letter e with acute, U+00E9 ISOlat1 ! 'ecirc': 0x00ea, # latin small letter e with circumflex, U+00EA ISOlat1 ! 'egrave': 0x00e8, # latin small letter e with grave, U+00E8 ISOlat1 ! 'empty': 0x2205, # empty set = null set = diameter, U+2205 ISOamso ! 'emsp': 0x2003, # em space, U+2003 ISOpub ! 'ensp': 0x2002, # en space, U+2002 ISOpub ! 'epsilon': 0x03b5, # greek small letter epsilon, U+03B5 ISOgrk3 ! 'equiv': 0x2261, # identical to, U+2261 ISOtech ! 'eta': 0x03b7, # greek small letter eta, U+03B7 ISOgrk3 ! 'eth': 0x00f0, # latin small letter eth, U+00F0 ISOlat1 ! 'euml': 0x00eb, # latin small letter e with diaeresis, U+00EB ISOlat1 ! 'euro': 0x20ac, # euro sign, U+20AC NEW ! 'exist': 0x2203, # there exists, U+2203 ISOtech ! 'fnof': 0x0192, # latin small f with hook = function = florin, U+0192 ISOtech ! 'forall': 0x2200, # for all, U+2200 ISOtech ! 'frac12': 0x00bd, # vulgar fraction one half = fraction one half, U+00BD ISOnum ! 'frac14': 0x00bc, # vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum ! 'frac34': 0x00be, # vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum ! 'frasl': 0x2044, # fraction slash, U+2044 NEW ! 'gamma': 0x03b3, # greek small letter gamma, U+03B3 ISOgrk3 ! 'ge': 0x2265, # greater-than or equal to, U+2265 ISOtech ! 'gt': 0x003e, # greater-than sign, U+003E ISOnum ! 'hArr': 0x21d4, # left right double arrow, U+21D4 ISOamsa ! 'harr': 0x2194, # left right arrow, U+2194 ISOamsa ! 'hearts': 0x2665, # black heart suit = valentine, U+2665 ISOpub ! 'hellip': 0x2026, # horizontal ellipsis = three dot leader, U+2026 ISOpub ! 'iacute': 0x00ed, # latin small letter i with acute, U+00ED ISOlat1 ! 'icirc': 0x00ee, # latin small letter i with circumflex, U+00EE ISOlat1 ! 'iexcl': 0x00a1, # inverted exclamation mark, U+00A1 ISOnum ! 'igrave': 0x00ec, # latin small letter i with grave, U+00EC ISOlat1 ! 'image': 0x2111, # blackletter capital I = imaginary part, U+2111 ISOamso ! 'infin': 0x221e, # infinity, U+221E ISOtech ! 'int': 0x222b, # integral, U+222B ISOtech ! 'iota': 0x03b9, # greek small letter iota, U+03B9 ISOgrk3 ! 'iquest': 0x00bf, # inverted question mark = turned question mark, U+00BF ISOnum ! 'isin': 0x2208, # element of, U+2208 ISOtech ! 'iuml': 0x00ef, # latin small letter i with diaeresis, U+00EF ISOlat1 ! 'kappa': 0x03ba, # greek small letter kappa, U+03BA ISOgrk3 ! 'lArr': 0x21d0, # leftwards double arrow, U+21D0 ISOtech ! 'lambda': 0x03bb, # greek small letter lambda, U+03BB ISOgrk3 ! 'lang': 0x2329, # left-pointing angle bracket = bra, U+2329 ISOtech ! 'laquo': 0x00ab, # left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum ! 'larr': 0x2190, # leftwards arrow, U+2190 ISOnum ! 'lceil': 0x2308, # left ceiling = apl upstile, U+2308 ISOamsc ! 'ldquo': 0x201c, # left double quotation mark, U+201C ISOnum ! 'le': 0x2264, # less-than or equal to, U+2264 ISOtech ! 'lfloor': 0x230a, # left floor = apl downstile, U+230A ISOamsc ! 'lowast': 0x2217, # asterisk operator, U+2217 ISOtech ! 'loz': 0x25ca, # lozenge, U+25CA ISOpub ! 'lrm': 0x200e, # left-to-right mark, U+200E NEW RFC 2070 ! 'lsaquo': 0x2039, # single left-pointing angle quotation mark, U+2039 ISO proposed ! 'lsquo': 0x2018, # left single quotation mark, U+2018 ISOnum ! 'lt': 0x003c, # less-than sign, U+003C ISOnum ! 'macr': 0x00af, # macron = spacing macron = overline = APL overbar, U+00AF ISOdia ! 'mdash': 0x2014, # em dash, U+2014 ISOpub ! 'micro': 0x00b5, # micro sign, U+00B5 ISOnum ! 'middot': 0x00b7, # middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum ! 'minus': 0x2212, # minus sign, U+2212 ISOtech ! 'mu': 0x03bc, # greek small letter mu, U+03BC ISOgrk3 ! 'nabla': 0x2207, # nabla = backward difference, U+2207 ISOtech ! 'nbsp': 0x00a0, # no-break space = non-breaking space, U+00A0 ISOnum ! 'ndash': 0x2013, # en dash, U+2013 ISOpub ! 'ne': 0x2260, # not equal to, U+2260 ISOtech ! 'ni': 0x220b, # contains as member, U+220B ISOtech ! 'not': 0x00ac, # not sign, U+00AC ISOnum ! 'notin': 0x2209, # not an element of, U+2209 ISOtech ! 'nsub': 0x2284, # not a subset of, U+2284 ISOamsn ! 'ntilde': 0x00f1, # latin small letter n with tilde, U+00F1 ISOlat1 ! 'nu': 0x03bd, # greek small letter nu, U+03BD ISOgrk3 ! 'oacute': 0x00f3, # latin small letter o with acute, U+00F3 ISOlat1 ! 'ocirc': 0x00f4, # latin small letter o with circumflex, U+00F4 ISOlat1 ! 'oelig': 0x0153, # latin small ligature oe, U+0153 ISOlat2 ! 'ograve': 0x00f2, # latin small letter o with grave, U+00F2 ISOlat1 ! 'oline': 0x203e, # overline = spacing overscore, U+203E NEW ! 'omega': 0x03c9, # greek small letter omega, U+03C9 ISOgrk3 ! 'omicron': 0x03bf, # greek small letter omicron, U+03BF NEW ! 'oplus': 0x2295, # circled plus = direct sum, U+2295 ISOamsb ! 'or': 0x2228, # logical or = vee, U+2228 ISOtech ! 'ordf': 0x00aa, # feminine ordinal indicator, U+00AA ISOnum ! 'ordm': 0x00ba, # masculine ordinal indicator, U+00BA ISOnum ! 'oslash': 0x00f8, # latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 ! 'otilde': 0x00f5, # latin small letter o with tilde, U+00F5 ISOlat1 ! 'otimes': 0x2297, # circled times = vector product, U+2297 ISOamsb ! 'ouml': 0x00f6, # latin small letter o with diaeresis, U+00F6 ISOlat1 ! 'para': 0x00b6, # pilcrow sign = paragraph sign, U+00B6 ISOnum ! 'part': 0x2202, # partial differential, U+2202 ISOtech ! 'permil': 0x2030, # per mille sign, U+2030 ISOtech ! 'perp': 0x22a5, # up tack = orthogonal to = perpendicular, U+22A5 ISOtech ! 'phi': 0x03c6, # greek small letter phi, U+03C6 ISOgrk3 ! 'pi': 0x03c0, # greek small letter pi, U+03C0 ISOgrk3 ! 'piv': 0x03d6, # greek pi symbol, U+03D6 ISOgrk3 ! 'plusmn': 0x00b1, # plus-minus sign = plus-or-minus sign, U+00B1 ISOnum ! 'pound': 0x00a3, # pound sign, U+00A3 ISOnum ! 'prime': 0x2032, # prime = minutes = feet, U+2032 ISOtech ! 'prod': 0x220f, # n-ary product = product sign, U+220F ISOamsb ! 'prop': 0x221d, # proportional to, U+221D ISOtech ! 'psi': 0x03c8, # greek small letter psi, U+03C8 ISOgrk3 ! 'quot': 0x0022, # quotation mark = APL quote, U+0022 ISOnum ! 'rArr': 0x21d2, # rightwards double arrow, U+21D2 ISOtech ! 'radic': 0x221a, # square root = radical sign, U+221A ISOtech ! 'rang': 0x232a, # right-pointing angle bracket = ket, U+232A ISOtech ! 'raquo': 0x00bb, # right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum ! 'rarr': 0x2192, # rightwards arrow, U+2192 ISOnum ! 'rceil': 0x2309, # right ceiling, U+2309 ISOamsc ! 'rdquo': 0x201d, # right double quotation mark, U+201D ISOnum ! 'real': 0x211c, # blackletter capital R = real part symbol, U+211C ISOamso ! 'reg': 0x00ae, # registered sign = registered trade mark sign, U+00AE ISOnum ! 'rfloor': 0x230b, # right floor, U+230B ISOamsc ! 'rho': 0x03c1, # greek small letter rho, U+03C1 ISOgrk3 ! 'rlm': 0x200f, # right-to-left mark, U+200F NEW RFC 2070 ! 'rsaquo': 0x203a, # single right-pointing angle quotation mark, U+203A ISO proposed ! 'rsquo': 0x2019, # right single quotation mark, U+2019 ISOnum ! 'sbquo': 0x201a, # single low-9 quotation mark, U+201A NEW ! 'scaron': 0x0161, # latin small letter s with caron, U+0161 ISOlat2 ! 'sdot': 0x22c5, # dot operator, U+22C5 ISOamsb ! 'sect': 0x00a7, # section sign, U+00A7 ISOnum ! 'shy': 0x00ad, # soft hyphen = discretionary hyphen, U+00AD ISOnum ! 'sigma': 0x03c3, # greek small letter sigma, U+03C3 ISOgrk3 ! 'sigmaf': 0x03c2, # greek small letter final sigma, U+03C2 ISOgrk3 ! 'sim': 0x223c, # tilde operator = varies with = similar to, U+223C ISOtech ! 'spades': 0x2660, # black spade suit, U+2660 ISOpub ! 'sub': 0x2282, # subset of, U+2282 ISOtech ! 'sube': 0x2286, # subset of or equal to, U+2286 ISOtech ! 'sum': 0x2211, # n-ary sumation, U+2211 ISOamsb ! 'sup': 0x2283, # superset of, U+2283 ISOtech ! 'sup1': 0x00b9, # superscript one = superscript digit one, U+00B9 ISOnum ! 'sup2': 0x00b2, # superscript two = superscript digit two = squared, U+00B2 ISOnum ! 'sup3': 0x00b3, # superscript three = superscript digit three = cubed, U+00B3 ISOnum ! 'supe': 0x2287, # superset of or equal to, U+2287 ISOtech ! 'szlig': 0x00df, # latin small letter sharp s = ess-zed, U+00DF ISOlat1 ! 'tau': 0x03c4, # greek small letter tau, U+03C4 ISOgrk3 ! 'there4': 0x2234, # therefore, U+2234 ISOtech ! 'theta': 0x03b8, # greek small letter theta, U+03B8 ISOgrk3 ! 'thetasym': 0x03d1, # greek small letter theta symbol, U+03D1 NEW ! 'thinsp': 0x2009, # thin space, U+2009 ISOpub ! 'thorn': 0x00fe, # latin small letter thorn with, U+00FE ISOlat1 ! 'tilde': 0x02dc, # small tilde, U+02DC ISOdia ! 'times': 0x00d7, # multiplication sign, U+00D7 ISOnum ! 'trade': 0x2122, # trade mark sign, U+2122 ISOnum ! 'uArr': 0x21d1, # upwards double arrow, U+21D1 ISOamsa ! 'uacute': 0x00fa, # latin small letter u with acute, U+00FA ISOlat1 ! 'uarr': 0x2191, # upwards arrow, U+2191 ISOnum ! 'ucirc': 0x00fb, # latin small letter u with circumflex, U+00FB ISOlat1 ! 'ugrave': 0x00f9, # latin small letter u with grave, U+00F9 ISOlat1 ! 'uml': 0x00a8, # diaeresis = spacing diaeresis, U+00A8 ISOdia ! 'upsih': 0x03d2, # greek upsilon with hook symbol, U+03D2 NEW ! 'upsilon': 0x03c5, # greek small letter upsilon, U+03C5 ISOgrk3 ! 'uuml': 0x00fc, # latin small letter u with diaeresis, U+00FC ISOlat1 ! 'weierp': 0x2118, # script capital P = power set = Weierstrass p, U+2118 ISOamso ! 'xi': 0x03be, # greek small letter xi, U+03BE ISOgrk3 ! 'yacute': 0x00fd, # latin small letter y with acute, U+00FD ISOlat1 ! 'yen': 0x00a5, # yen sign = yuan sign, U+00A5 ISOnum ! 'yuml': 0x00ff, # latin small letter y with diaeresis, U+00FF ISOlat1 ! 'zeta': 0x03b6, # greek small letter zeta, U+03B6 ISOgrk3 ! 'zwj': 0x200d, # zero width joiner, U+200D NEW RFC 2070 ! 'zwnj': 0x200c, # zero width non-joiner, U+200C NEW RFC 2070 } + + # maps the Unicode codepoint to the HTML entity name + codepoint2name = {} + + # maps the HTML entity name to the character + # (or a character reference if the character is outside the Latin-1 range) + entitydefs = {} + + for (name, codepoint) in name2codepoint.iteritems(): + codepoint2name[codepoint] = name + if codepoint <= 0xff: + entitydefs[name] = chr(codepoint) + else: + entitydefs[name] = '&#%d;' % codepoint + + del name, codepoint From jackjansen@users.sourceforge.net Wed Apr 16 13:15:37 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 16 Apr 2003 05:15:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv3870 Modified Files: pimp.py Log Message: Allow switching of install dir after creation of preferences. Changed some message to be clearer when presented by Package Manager. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pimp.py 15 Apr 2003 14:43:05 -0000 1.16 --- pimp.py 16 Apr 2003 12:15:34 -0000 1.17 *************** *** 161,164 **** --- 161,171 ---- if not pimpDatabase: pimpDatabase = DEFAULT_PIMPDATABASE + self.setInstallDir(installDir) + self.flavorOrder = flavorOrder + self.downloadDir = downloadDir + self.buildDir = buildDir + self.pimpDatabase = pimpDatabase + + def setInstallDir(self, installDir=None): if installDir: # Installing to non-standard location. *************** *** 171,180 **** installDir = DEFAULT_INSTALLDIR self.installLocations = [] - self.flavorOrder = flavorOrder - self.downloadDir = downloadDir - self.buildDir = buildDir self.installDir = installDir ! self.pimpDatabase = pimpDatabase ! def check(self): """Check that the preferences make sense: directories exist and are --- 178,183 ---- installDir = DEFAULT_INSTALLDIR self.installLocations = [] self.installDir = installDir ! def check(self): """Check that the preferences make sense: directories exist and are *************** *** 466,470 **** if not self._dict.get('Download-URL'): return [(None, ! "%s: This package needs to be installed manually (no Download-URL field)" % self.fullname())] if not self._dict.get('Prerequisites'): --- 469,473 ---- if not self._dict.get('Download-URL'): return [(None, ! "%s: This package cannot be installed automatically (no Download-URL field)" % self.fullname())] if not self._dict.get('Prerequisites'): *************** *** 756,760 **** self._prepareInstall(pkg, force, recursive) else: ! self._curmessages.append("Requires: %s" % descr) def prepareInstall(self, package, force=0, recursive=1): --- 759,763 ---- self._prepareInstall(pkg, force, recursive) else: ! self._curmessages.append("Problem with dependency: %s" % descr) def prepareInstall(self, package, force=0, recursive=1): From jackjansen@users.sourceforge.net Wed Apr 16 13:17:59 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 16 Apr 2003 05:17:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv4287 Modified Files: PackageManager.py Log Message: Added support for per-user installs. Don't show psuedo-packages by default, added a button to show them. Cleaned up interface a little (not enough, though). Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PackageManager.py 15 Apr 2003 21:59:42 -0000 1.6 --- PackageManager.py 16 Apr 2003 12:17:56 -0000 1.7 *************** *** 48,51 **** --- 48,57 ---- ELIPSES = '...' + USER_INSTALL_DIR = os.path.join(os.environ.get('HOME', ''), + 'Library', + 'Python', + sys.version[:3], + 'site-packages') + class PackageManagerMain(Wapplication.Application): *************** *** 226,229 **** --- 232,242 ---- except IOError, arg: return "Cannot open %s: %s" % (url, arg) + # Check whether we can write the installation directory. + # If not, set to the per-user directory, possibly + # creating it, if needed. + installDir = self.pimpprefs.installDir + if not os.access(installDir, os.R_OK|os.W_OK|os.X_OK): + rv = self.setuserinstall(1) + if rv: return rv return self.pimpprefs.check() *************** *** 235,243 **** self.packages = [] ! def getbrowserdata(self): self.packages = self.pimpdb.list() rv = [] for pkg in self.packages: name = pkg.fullname() status, _ = pkg.installed() description = pkg.description() --- 248,278 ---- self.packages = [] ! def setuserinstall(self, onoff): ! rv = "" ! if onoff: ! if not os.path.exists(USER_INSTALL_DIR): ! try: ! os.makedirs(USER_INSTALL_DIR) ! except OSError, arg: ! rv = rv + arg + "\n" ! if not USER_INSTALL_DIR in sys.path: ! import site ! reload(site) ! self.pimpprefs.setInstallDir(USER_INSTALL_DIR) ! else: ! self.pimpprefs.setInstallDir(None) ! rv = rv + self.pimpprefs.check() ! return rv ! ! def getuserinstall(self): ! return self.pimpprefs.installDir == USER_INSTALL_DIR ! ! def getbrowserdata(self, show_hidden=1): self.packages = self.pimpdb.list() rv = [] for pkg in self.packages: name = pkg.fullname() + if name[0] == '(' and name[-1] == ')' and not show_hidden: + continue status, _ = pkg.installed() description = pkg.description() *************** *** 249,253 **** return pkg.installed() ! def installpackage(self, sel, output, recursive, force, user): pkg = self.packages[sel] list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive) --- 284,288 ---- return pkg.installed() ! def installpackage(self, sel, output, recursive, force): pkg = self.packages[sel] list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive) *************** *** 261,269 **** def __init__(self, url = None): self.ic = None ! msg = self.setuppimp(url) ! if msg: ! EasyDialogs.Message(msg) self.setupwidgets() self.updatestatus() def close(self): --- 296,303 ---- def __init__(self, url = None): self.ic = None ! messages = self.setuppimp(url) self.setupwidgets() self.updatestatus() + self.showmessages(messages) def close(self): *************** *** 272,280 **** def setupwidgets(self): INSTALL_POS = -30 ! STATUS_POS = INSTALL_POS - 62 self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0) ! self.w.titlebar = W.TextBox((4, 4, 40, 12), 'Packages:') data = self.getbrowserdata() ! self.w.packagebrowser = W.MultiList((4, 20, 0, STATUS_POS-2), data, self.listhit, cols=3) self.w.installed_l = W.TextBox((4, STATUS_POS, 60, 12), 'Installed:') --- 306,315 ---- def setupwidgets(self): INSTALL_POS = -30 ! STATUS_POS = INSTALL_POS - 70 self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0) ! self.w.titlebar = W.TextBox((4, 8, 60, 18), 'Packages:') ! self.w.hidden_button = W.CheckBox((-100, 4, 0, 18), 'Show Hidden', self.updatestatus) data = self.getbrowserdata() ! self.w.packagebrowser = W.MultiList((4, 24, 0, STATUS_POS-2), data, self.listhit, cols=3) self.w.installed_l = W.TextBox((4, STATUS_POS, 60, 12), 'Installed:') *************** *** 284,300 **** self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage) ! self.w.divline = W.HorizontalLine((0, INSTALL_POS, 0, 0)) ! self.w.verbose_button = W.CheckBox((-358, INSTALL_POS+4, 60, 18), 'Verbose') ! self.w.recursive_button = W.CheckBox((-284, INSTALL_POS+4, 140, 18), 'Install dependencies', self.updatestatus) self.w.recursive_button.set(1) ! self.w.force_button = W.CheckBox((-160, INSTALL_POS+4, 70, 18), 'Overwrite', self.updatestatus) ! self.w.user_button = W.CheckBox((-90, INSTALL_POS+4, 100, 18), 'User Only') ! self.w.install_button = W.Button((4, INSTALL_POS+4, 56, 18), 'Install', self.do_install) self.w.open() def updatestatus(self): sel = self.w.packagebrowser.getselection() ! data = self.getbrowserdata() self.w.packagebrowser.setitems(data) if len(sel) != 1: self.w.installed.set('') --- 319,336 ---- self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage) ! self.w.divline = W.HorizontalLine((0, INSTALL_POS-4, 0, 0)) ! self.w.verbose_button = W.CheckBox((84, INSTALL_POS+4, 60, 18), 'Verbose') ! self.w.recursive_button = W.CheckBox((146, INSTALL_POS+4, 120, 18), 'Install dependencies', self.updatestatus) self.w.recursive_button.set(1) ! self.w.force_button = W.CheckBox((268, INSTALL_POS+4, 70, 18), 'Overwrite', self.updatestatus) ! self.w.user_button = W.CheckBox((340, INSTALL_POS+4, 140, 18), 'For Current User Only', self.do_user) ! self.w.install_button = W.Button((4, INSTALL_POS+4, 56, 18), 'Install:', self.do_install) self.w.open() def updatestatus(self): sel = self.w.packagebrowser.getselection() ! data = self.getbrowserdata(self.w.hidden_button.get()) self.w.packagebrowser.setitems(data) + self.w.user_button.set(self.getuserinstall()) if len(sel) != 1: self.w.installed.set('') *************** *** 317,321 **** self.w.recursive_button.enable(1) self.w.force_button.enable(1) ! self.w.user_button.enable(0) # XXXX def listhit(self, *args, **kwargs): --- 353,357 ---- self.w.recursive_button.enable(1) self.w.force_button.enable(1) ! self.w.user_button.enable(1) def listhit(self, *args, **kwargs): *************** *** 330,338 **** recursive = self.w.recursive_button.get() force = self.w.force_button.get() ! user = self.w.user_button.get() ! messages = self.installpackage(sel, output, recursive, force, user) self.updatestatus() if messages: ! EasyDialogs.Message('\n'.join(messages)) def do_homepage(self): --- 366,385 ---- recursive = self.w.recursive_button.get() force = self.w.force_button.get() ! messages = self.installpackage(sel, output, recursive, force) ! ! # Re-read .pth files ! import site ! reload(site) ! self.updatestatus() + self.showmessages(messages) + + def showmessages(self, messages): if messages: ! if type(messages) == list: ! messages = '\n'.join(messages) ! if self.w.verbose_button.get(): ! sys.stdout.write(messages + '\n') ! EasyDialogs.Message(messages) def do_homepage(self): *************** *** 343,346 **** --- 390,398 ---- self.ic = ic.IC() self.ic.launchurl(self.packages[sel].homepage()) + + def do_user(self): + messages = self.setuserinstall(self.w.user_button.get()) + self.updatestatus() + self.showmessages(messages) if __name__ == '__main__': From jackjansen@users.sourceforge.net Wed Apr 16 13:39:05 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 16 Apr 2003 05:39:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation packman.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv14937 Modified Files: packman.html Log Message: Added a note on getting 404 Not Found errors when loading the database. Index: packman.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/packman.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** packman.html 11 Mar 2003 22:59:16 -0000 1.1 --- packman.html 16 Apr 2003 12:39:03 -0000 1.2 *************** *** 36,41 ****

PackageManager is available as a separate application and also ! as a function of the IDE, through the File->Package Manager menu entry.

--- 36,51 ----

PackageManager is available as a separate application and also ! as a function of the IDE, through the File->Package Manager menu entry.

+ +

Troubleshooting

+ +

If package manager fails to open the database first check that you are + connected to the internet. If you are connected then the problem + could be that there is no database (yet?) for your version of Mac OS X. + In the standalone Package Manager you can open an alternative database + with the File->Open URL... command, but you should realize that + you are now on untested ground.

+ From jackjansen@users.sourceforge.net Wed Apr 16 13:40:25 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 16 Apr 2003 05:40:25 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv15575 Modified Files: PackageManager.py Log Message: Refer people to the help pages on failure to load the database. Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PackageManager.py 16 Apr 2003 12:17:56 -0000 1.7 --- PackageManager.py 16 Apr 2003 12:40:21 -0000 1.8 *************** *** 231,235 **** self.pimpdb.appendURL(url) except IOError, arg: ! return "Cannot open %s: %s" % (url, arg) # Check whether we can write the installation directory. # If not, set to the per-user directory, possibly --- 231,237 ---- self.pimpdb.appendURL(url) except IOError, arg: ! rv = "Cannot open %s: %s\n" % (url, arg) ! rv += "\nSee MacPython Package Manager help page." ! return rv # Check whether we can write the installation directory. # If not, set to the per-user directory, possibly From jackjansen@users.sourceforge.net Wed Apr 16 14:10:58 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 16 Apr 2003 06:10:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv31642 Modified Files: gensuitemodule.py Log Message: The identify() description didn't match the code. Fixed. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gensuitemodule.py 12 Apr 2003 22:27:05 -0000 1.7 --- gensuitemodule.py 16 Apr 2003 13:10:53 -0000 1.8 *************** *** 1178,1182 **** - replace space by _ - replace other illegal chars by _xx_ (hex code) ! - prepend _ if the result is a python keyword """ if not str: --- 1178,1182 ---- - replace space by _ - replace other illegal chars by _xx_ (hex code) ! - append _ if the result is a python keyword """ if not str: From jackjansen@users.sourceforge.net Wed Apr 16 14:12:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 16 Apr 2003 06:12:26 -0700 Subject: [Python-checkins] python/dist/src/Lib site.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32027 Modified Files: site.py Log Message: When on MacOSX, and only in a framework build, add ~/Library/Python/2.3/site-packages to sys.path, if it exists. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** site.py 3 Mar 2003 09:34:01 -0000 1.48 --- site.py 16 Apr 2003 13:12:21 -0000 1.49 *************** *** 173,176 **** --- 173,189 ---- else: sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")] + if sys.platform == 'darwin': + # for framework builds *only* we add the standard Apple + # locations. Currently only per-user, but /Library and + # /Network/Library could be added too + if 'Python.framework' in prefix: + home = os.environ['HOME'] + if home: + sitedirs.append( + os.path.join(home, + 'Library', + 'Python', + sys.version[:3], + 'site-packages')) for sitedir in sitedirs: if os.path.isdir(sitedir): From nnorwitz@users.sourceforge.net Wed Apr 16 14:21:09 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 16 Apr 2003 06:21:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmllib.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4772/lib Modified Files: libhtmllib.tex Log Message: Add version info for name2codepoint and codepoint2name Index: libhtmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmllib.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libhtmllib.tex 16 Apr 2003 09:46:13 -0000 1.24 --- libhtmllib.tex 16 Apr 2003 13:21:06 -0000 1.25 *************** *** 163,171 **** \begin{datadesc}{name2codepoint} A dictionary that maps HTML entity names to the Unicode codepoints. \end{datadesc} \begin{datadesc}{codepoint2name} A dictionary that maps Unicode codepoints to HTML entity names. \end{datadesc} - - --- 163,171 ---- \begin{datadesc}{name2codepoint} A dictionary that maps HTML entity names to the Unicode codepoints. + \versionadded{2.3} \end{datadesc} \begin{datadesc}{codepoint2name} A dictionary that maps Unicode codepoints to HTML entity names. + \versionadded{2.3} \end{datadesc} From guido@python.org Wed Apr 16 14:49:08 2003 From: guido@python.org (Guido van Rossum) Date: Wed, 16 Apr 2003 09:49:08 -0400 Subject: [Python-checkins] python/dist/src/Lib htmlentitydefs.py,1.8,1.9 In-Reply-To: Your message of "Wed, 16 Apr 2003 02:46:15 PDT." References: Message-ID: <200304161349.h3GDn8e08013@odiug.zope.com> > ! entitydefs = { > ! 'AElig': '\306', # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 > ! 'Aacute': '\301', # latin capital letter A with acute, U+00C1 ISOlat1 > ! 'Acirc': '\302', # latin capital letter A with circumflex, U+00C2 ISOlat1 [...] Hmm... Wouldn't it be nice if the information in the comments was somehow also available in tabular form? --Guido van Rossum (home page: http://www.python.org/~guido/) From walter@livinglogic.de Wed Apr 16 16:07:16 2003 From: walter@livinglogic.de (=?ISO-8859-15?Q?Walter_D=F6rwald?=) Date: Wed, 16 Apr 2003 17:07:16 +0200 Subject: [Python-checkins] python/dist/src/Lib htmlentitydefs.py,1.8,1.9 In-Reply-To: <200304161349.h3GDn8e08013@odiug.zope.com> References: <200304161349.h3GDn8e08013@odiug.zope.com> Message-ID: <3E9D71A4.3060408@livinglogic.de> Guido van Rossum wrote: >>! entitydefs = { >>! 'AElig': '\306', # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 >>! 'Aacute': '\301', # latin capital letter A with acute, U+00C1 ISOlat1 >>! 'Acirc': '\302', # latin capital letter A with circumflex, U+00C2 ISOlat1 > > [...] > > Hmm... Wouldn't it be nice if the information in the comments was > somehow also available in tabular form? We can't add it to entitydefs for compatibility reasons. For name2codepoint and codepoint2name it would be nice, but probably useless. These comments were simply copied over from http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent and others. The official character name is available via unicodedata: >>> unicodedata.name(unichr(htmlentitydefs.name2codepoint["AElig"])) 'LATIN CAPITAL LETTER AE' Bye, Walter Dörwald From rhettinger@users.sourceforge.net Wed Apr 16 18:28:21 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 16 Apr 2003 10:28:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv30151 Modified Files: abstract.tex Log Message: As discussed on python-dev, revised docs to note that PyObject_IsTrue() can have an error result. Also, added missing docs for PyObject_Not(). Will backport. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** abstract.tex 9 Apr 2003 18:15:57 -0000 1.25 --- abstract.tex 16 Apr 2003 17:28:12 -0000 1.26 *************** *** 311,315 **** Returns \code{1} if the object \var{o} is considered to be true, and \code{0} otherwise. This is equivalent to the Python expression ! \samp{not not \var{o}}. This function always succeeds. \end{cfuncdesc} --- 311,322 ---- Returns \code{1} if the object \var{o} is considered to be true, and \code{0} otherwise. This is equivalent to the Python expression ! \samp{not not \var{o}}. On failure, return \code{-1}. ! \end{cfuncdesc} ! ! ! \begin{cfuncdesc}{int}{PyObject_Not}{PyObject *o} ! Returns \code{0} if the object \var{o} is considered to be true, and ! \code{1} otherwise. This is equivalent to the Python expression ! \samp{not \var{o}}. On failure, return \code{-1}. \end{cfuncdesc} From rhettinger@users.sourceforge.net Wed Apr 16 18:30:24 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 16 Apr 2003 10:30:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.8.6.9,1.8.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv32074 Modified Files: Tag: release22-maint abstract.tex Log Message: As discussed on python-dev, revised docs to note that PyObject_IsTrue() can have an error result. Also, added missing docs for PyObject_Not(). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.8.6.9 retrieving revision 1.8.6.10 diff -C2 -d -r1.8.6.9 -r1.8.6.10 *** abstract.tex 9 Apr 2003 18:17:18 -0000 1.8.6.9 --- abstract.tex 16 Apr 2003 17:30:15 -0000 1.8.6.10 *************** *** 290,294 **** Returns \code{1} if the object \var{o} is considered to be true, and \code{0} otherwise. This is equivalent to the Python expression ! \samp{not not \var{o}}. This function always succeeds. \end{cfuncdesc} --- 290,301 ---- Returns \code{1} if the object \var{o} is considered to be true, and \code{0} otherwise. This is equivalent to the Python expression ! \samp{not not \var{o}}. On failure, return \code{-1}. ! \end{cfuncdesc} ! ! ! \begin{cfuncdesc}{int}{PyObject_Not}{PyObject *o} ! Returns \code{0} if the object \var{o} is considered to be true, and ! \code{1} otherwise. This is equivalent to the Python expression ! \samp{not \var{o}}. On failure, return \code{-1}. \end{cfuncdesc} From bwarsaw@users.sourceforge.net Wed Apr 16 19:08:26 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 16 Apr 2003 11:08:26 -0700 Subject: [Python-checkins] python/dist/src/Tools/i18n pygettext.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory sc8-pr-cvs1:/tmp/cvs-serv20442 Modified Files: pygettext.py Log Message: Mostly reformatting, splitting long lines, whitespace normalization etc. Fixed one typo in the __main__ section. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pygettext.py 22 Nov 2002 08:36:54 -0000 1.22 --- pygettext.py 16 Apr 2003 18:08:23 -0000 1.23 *************** *** 3,7 **** # Originally written by Barry Warsaw # ! # Minimally patched to make it even more xgettext compatible # by Peter Funk # --- 3,7 ---- # Originally written by Barry Warsaw # ! # Minimally patched to make it even more xgettext compatible # by Peter Funk # *************** *** 26,40 **** internationalization of C programs. Most of these tools are independent of the programming language and can be used from within Python programs. ! Martin von Loewis' work[1] helps considerably in this regard. There's one problem though; xgettext is the program that scans source code looking for message strings, but it groks only C (or C++). Python introduces a few wrinkles, such as dual quoting characters, triple quoted ! strings, and raw strings. xgettext understands none of this. Enter pygettext, which uses Python's standard tokenize module to scan Python source code, generating .pot files identical to what GNU xgettext[2] generates for C and C++ code. From there, the standard GNU tools can be ! used. A word about marking Python strings as candidates for translation. GNU --- 26,40 ---- internationalization of C programs. Most of these tools are independent of the programming language and can be used from within Python programs. ! Martin von Loewis' work[1] helps considerably in this regard. There's one problem though; xgettext is the program that scans source code looking for message strings, but it groks only C (or C++). Python introduces a few wrinkles, such as dual quoting characters, triple quoted ! strings, and raw strings. xgettext understands none of this. Enter pygettext, which uses Python's standard tokenize module to scan Python source code, generating .pot files identical to what GNU xgettext[2] generates for C and C++ code. From there, the standard GNU tools can be ! used. A word about marking Python strings as candidates for translation. GNU *************** *** 44,48 **** internationalized C source includes a #define for gettext() to _() so that what has to be written in the source is much less. Thus these are both ! translatable strings: gettext("Translatable String") --- 44,48 ---- internationalized C source includes a #define for gettext() to _() so that what has to be written in the source is much less. Thus these are both ! translatable strings: gettext("Translatable String") *************** *** 60,64 **** not fully implemented. Also, xgettext's use of command line switches with option arguments is broken, and in these cases, pygettext just defines ! additional switches. Usage: pygettext [options] inputfile ... --- 60,64 ---- not fully implemented. Also, xgettext's use of command line switches with option arguments is broken, and in these cases, pygettext just defines ! additional switches. Usage: pygettext [options] inputfile ... *************** *** 157,161 **** --- 157,163 ---- import os + import imp import sys + import glob import time import getopt *************** *** 257,273 **** def containsAny(str, set): ! """ Check whether 'str' contains ANY of the chars in 'set' ! """ return 1 in [c in str for c in set] def _visit_pyfiles(list, dirname, names): ! """ Helper for getFilesForName(). ! """ # get extension for python source files if not globals().has_key('_py_ext'): - import imp global _py_ext ! _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] # don't recurse into CVS directories --- 259,273 ---- def containsAny(str, set): ! """Check whether 'str' contains ANY of the chars in 'set'""" return 1 in [c in str for c in set] def _visit_pyfiles(list, dirname, names): ! """Helper for getFilesForName().""" # get extension for python source files if not globals().has_key('_py_ext'): global _py_ext ! _py_ext = [triple[0] for triple in imp.get_suffixes() ! if triple[2] == imp.PY_SOURCE][0] # don't recurse into CVS directories *************** *** 277,294 **** # add all *.py files to list list.extend( ! [os.path.join(dirname, file) ! for file in names ! if os.path.splitext(file)[1] == _py_ext]) def _get_modpkg_path(dotted_name, pathlist=None): ! """ Get the filesystem path for a module or a package. ! Return the file system path to a file for a module, ! and to a directory for a package. Return None if ! the name is not found, or is a builtin or extension module. """ - import imp - # split off top-most name parts = dotted_name.split('.', 1) --- 277,292 ---- # add all *.py files to list list.extend( ! [os.path.join(dirname, file) for file in names ! if os.path.splitext(file)[1] == _py_ext] ! ) def _get_modpkg_path(dotted_name, pathlist=None): ! """Get the filesystem path for a module or a package. ! Return the file system path to a file for a module, and to a directory for ! a package. Return None if the name is not found, or is a builtin or ! extension module. """ # split off top-most name parts = dotted_name.split('.', 1) *************** *** 311,316 **** # plain name try: ! file, pathname, description = imp.find_module(dotted_name, pathlist) ! if file: file.close() if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]: pathname = None --- 309,316 ---- # plain name try: ! file, pathname, description = imp.find_module( ! dotted_name, pathlist) ! if file: ! file.close() if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]: pathname = None *************** *** 322,334 **** def getFilesForName(name): ! """ Get a list of module files for a filename, a module or package name, ! or a directory. """ - import imp - if not os.path.exists(name): # check for glob chars if containsAny(name, "*?[]"): - import glob files = glob.glob(name) list = [] --- 322,331 ---- def getFilesForName(name): ! """Get a list of module files for a filename, a module or package name, ! or a directory. """ if not os.path.exists(name): # check for glob chars if containsAny(name, "*?[]"): files = glob.glob(name) list = [] *************** *** 416,420 **** if ttype == tokenize.OP and tstring == ')': # We've seen the last of the translatable strings. Record the ! # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. --- 413,417 ---- if ttype == tokenize.OP and tstring == ')': # We've seen the last of the translatable strings. Record the ! # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. *************** *** 427,432 **** token.NEWLINE, tokenize.NL]: # warn if we see anything else than STRING or whitespace ! print >>sys.stderr, _('*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"') % { ! 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno} self.__state = self.__waiting --- 424,434 ---- token.NEWLINE, tokenize.NL]: # warn if we see anything else than STRING or whitespace ! print >> sys.stderr, _( ! '*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"' ! ) % { ! 'token': tstring, ! 'file': self.__curfile, ! 'lineno': self.__lineno ! } self.__state = self.__waiting *************** *** 663,667 **** # some more test strings _(u'a unicode string') ! _('*** Seen unexpected token "%(token)s"' % {'token': 'test'}) # this one creates a warning _('more' 'than' 'one' 'string') - --- 665,669 ---- # some more test strings _(u'a unicode string') ! # this one creates a warning ! _('*** Seen unexpected token "%(token)s"') % {'token': 'test'} _('more' 'than' 'one' 'string') From rhettinger@users.sourceforge.net Wed Apr 16 19:40:07 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 16 Apr 2003 11:40:07 -0700 Subject: [Python-checkins] python/dist/src/Modules _randommodule.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv3025 Modified Files: _randommodule.c Log Message: Minor source formatting fixes. Index: _randommodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_randommodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _randommodule.c 6 Jan 2003 12:41:25 -0000 1.3 --- _randommodule.c 16 Apr 2003 18:40:04 -0000 1.4 *************** *** 68,72 **** #include "Python.h" ! #include // for seeding to current time /* Period parameters -- These are all magic. Don't change. */ --- 68,72 ---- #include "Python.h" ! #include /* for seeding to current time */ /* Period parameters -- These are all magic. Don't change. */ *************** *** 111,115 **** y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK); mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL]; ! } y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL]; --- 111,115 ---- y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK); mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL]; ! } y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL]; From ibrla@hotmail.kz Wed Apr 16 20:19:26 2003 From: ibrla@hotmail.kz (ibrla) Date: Thu, 17 Apr 2003 02:19:26 +0700 Subject: [Python-checkins] You wrote a letter to me. Who are you? Message-ID: Hello! You have received a postcard. You can see it here: http://postcards.rin.ru/postcards/post/humour1.html Only for adults: SEX-TEST - http://eros.rin.ru/index_e.html and WALLPAPERS - http://wallpapers.rin.ru/index_e.html For music-lovers: Free 100 000 mp3-files - http://mp3.rin.ru/index_e.html And for all: Surprise! - http://humor.rin.ru/photo_e.html Goodby, Gerry. You can refuse to receive letters. For that just send a letter to unsubscribe14.com with the subject: DELETE. From gvanrossum@users.sourceforge.net Wed Apr 16 20:41:05 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 12:41:05 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.226,2.227 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv27358/Objects Modified Files: typeobject.c Log Message: - super() no longer ignores data descriptors, except __class__. See the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.226 retrieving revision 2.227 diff -C2 -d -r2.226 -r2.227 *** typeobject.c 15 Apr 2003 22:09:45 -0000 2.226 --- typeobject.c 16 Apr 2003 19:40:58 -0000 2.227 *************** *** 5360,5365 **** { superobject *su = (superobject *)self; ! if (su->obj_type != NULL) { PyObject *mro, *res, *tmp, *dict; PyTypeObject *starttype; --- 5360,5374 ---- { superobject *su = (superobject *)self; + int skip = su->obj_type == NULL; ! if (!skip) { ! /* We want __class__ to return the class of the super object ! (i.e. super, or a subclass), not the class of su->obj. */ ! skip = (PyString_Check(name) && ! PyString_GET_SIZE(name) == 9 && ! strcmp(PyString_AS_STRING(name), "__class__") == 0); ! } ! ! if (!skip) { PyObject *mro, *res, *tmp, *dict; PyTypeObject *starttype; *************** *** 5391,5397 **** continue; res = PyDict_GetItem(dict, name); - /* Skip data descriptors because when obj_type is a - metaclass, we don't want to return its __class__ - descriptor. See supers() in test_descr.py. */ if (res != NULL && !PyDescr_IsData(res)) { Py_INCREF(res); --- 5400,5403 ---- From gvanrossum@users.sourceforge.net Wed Apr 16 20:41:31 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 12:41:31 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.725,1.726 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv27358/Misc Modified Files: NEWS Log Message: - super() no longer ignores data descriptors, except __class__. See the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.725 retrieving revision 1.726 diff -C2 -d -r1.725 -r1.726 *** NEWS 16 Apr 2003 09:46:11 -0000 1.725 --- NEWS 16 Apr 2003 19:40:50 -0000 1.726 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - super() no longer ignores data descriptors, except __class__. See + the thread started at + http://mail.python.org/pipermail/python-dev/2003-April/034338.html + - list.insert(i, x) now interprets negative i as it would be interpreted by slicing, so negative values count from the end of the From loewis@users.sourceforge.net Wed Apr 16 20:42:55 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 16 Apr 2003 12:42:55 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.726,1.727 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28172/Misc Modified Files: NEWS Log Message: For StringVar results to strings. Document that boolean things are of type bool. Requested in #721171. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.726 retrieving revision 1.727 diff -C2 -d -r1.726 -r1.727 *** NEWS 16 Apr 2003 19:40:50 -0000 1.726 --- NEWS 16 Apr 2003 19:42:49 -0000 1.727 *************** *** 64,67 **** --- 64,70 ---- ----------------- + - Tkinter wrappers around Tcl variables now pass objects directly + to Tcl, instead of first converting them to strings. + - The .*? pattern in the re module is now special-cased to avoid the recursion limit. (SF patch #720991 -- many thanks to Gary Herron From loewis@users.sourceforge.net Wed Apr 16 20:42:55 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 16 Apr 2003 12:42:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.171,1.172 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv28172/Lib/lib-tk Modified Files: Tkinter.py Log Message: For StringVar results to strings. Document that boolean things are of type bool. Requested in #721171. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** Tkinter.py 6 Apr 2003 09:00:51 -0000 1.171 --- Tkinter.py 16 Apr 2003 19:42:51 -0000 1.172 *************** *** 224,228 **** def get(self): """Return value of variable as string.""" ! return self._tk.globalgetvar(self._name) class IntVar(Variable): --- 224,231 ---- def get(self): """Return value of variable as string.""" ! value = self._tk.globalgetvar(self._name) ! if isinstance(value, basestring): ! return value ! return str(value) class IntVar(Variable): *************** *** 268,272 **** def get(self): ! """Return the value of the variable as 0 or 1.""" return self._tk.getboolean(self._tk.globalgetvar(self._name)) --- 271,275 ---- def get(self): ! """Return the value of the variable as a bool.""" return self._tk.getboolean(self._tk.globalgetvar(self._name)) *************** *** 370,374 **** getdouble = float def getboolean(self, s): ! """Return 0 or 1 for Tcl boolean values true and false given as parameter.""" return self.tk.getboolean(s) def focus_set(self): --- 373,377 ---- getdouble = float def getboolean(self, s): ! """Return a boolean value for Tcl boolean values true and false given as parameter.""" return self.tk.getboolean(s) def focus_set(self): *************** *** 1637,1641 **** given direction before=widget - pack it before you will pack widget ! expand=1 or 0 - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget --- 1640,1644 ---- given direction before=widget - pack it before you will pack widget ! expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget From gvanrossum@users.sourceforge.net Wed Apr 16 21:01:45 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 13:01:45 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.227,2.228 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv4529 Modified Files: typeobject.c Log Message: Sigh. The crucial change was still missing from the previous checkin. :-( Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.227 retrieving revision 2.228 diff -C2 -d -r2.227 -r2.228 *** typeobject.c 16 Apr 2003 19:40:58 -0000 2.227 --- typeobject.c 16 Apr 2003 20:01:36 -0000 2.228 *************** *** 5400,5404 **** continue; res = PyDict_GetItem(dict, name); ! if (res != NULL && !PyDescr_IsData(res)) { Py_INCREF(res); f = res->ob_type->tp_descr_get; --- 5400,5404 ---- continue; res = PyDict_GetItem(dict, name); ! if (res != NULL) { Py_INCREF(res); f = res->ob_type->tp_descr_get; From gvanrossum@users.sourceforge.net Wed Apr 16 21:02:26 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 13:02:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.190,1.191 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4873 Modified Files: test_descr.py Log Message: - super() no longer ignores data descriptors, except __class__. See the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** test_descr.py 15 Apr 2003 20:05:10 -0000 1.190 --- test_descr.py 16 Apr 2003 20:02:22 -0000 1.191 *************** *** 1990,1994 **** class F(E): def meth(self, a): ! s = self.__super return "F(%r)[%s]" % (a, s.__class__.__name__) + s.meth(a) F._F__super = mysuper(F) --- 1990,1994 ---- class F(E): def meth(self, a): ! s = self.__super # == mysuper(F, self) return "F(%r)[%s]" % (a, s.__class__.__name__) + s.meth(a) F._F__super = mysuper(F) *************** *** 2025,2028 **** --- 2025,2043 ---- else: raise TestFailed, "shouldn't allow super(D).__get__(C())" + + # Make sure data descriptors can be overridden and accessed via super + # (new feature in Python 2.3) + + class DDbase(object): + def getx(self): return 42 + x = property(getx) + + class DDsub(DDbase): + def getx(self): return "hello" + x = property(getx) + + dd = DDsub() + vereq(dd.x, "hello") + vereq(super(DDsub, dd).x, 42) def inherits(): From gvanrossum@users.sourceforge.net Wed Apr 16 21:10:14 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 13:10:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.172,1.173 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv8203 Modified Files: Tkinter.py Log Message: Add 'get' method to Variable and switch it from internal class to standard class (it is now useful because it doesn't constrain the type of the value). Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -d -r1.172 -r1.173 *** Tkinter.py 16 Apr 2003 19:42:51 -0000 1.172 --- Tkinter.py 16 Apr 2003 20:10:03 -0000 1.173 *************** *** 164,168 **** _varnum = 0 class Variable: ! """Internal class. Base class to define value holders for e.g. buttons.""" _default = "" def __init__(self, master=None): --- 164,171 ---- _varnum = 0 class Variable: ! """Class to define value holders for e.g. buttons. ! ! Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations ! that constrain the type of the value returned from get().""" _default = "" def __init__(self, master=None): *************** *** 187,190 **** --- 190,196 ---- """Set the variable to VALUE.""" return self._tk.globalsetvar(self._name, value) + def get(self): + """Return value of variable.""" + return self._tk.globalgetvar(self._name) def trace_variable(self, mode, callback): """Define a trace callback for the variable. From loewis@users.sourceforge.net Wed Apr 16 21:34:59 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 16 Apr 2003 13:34:59 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.154,1.155 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18357 Modified Files: _tkinter.c Log Message: Support UCS-4 Tcl for UCS-4 Python builds. Fixes #719880. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** _tkinter.c 15 Apr 2003 20:33:20 -0000 1.154 --- _tkinter.c 16 Apr 2003 20:34:55 -0000 1.155 *************** *** 88,93 **** We cannot test this directly, so we test UTF-8 size instead, expecting that TCL_UTF_MAX is changed if Tcl ever supports ! either UTF-16 or UCS-4. */ ! #if TCL_UTF_MAX != 3 #error "unsupported Tcl configuration" #endif --- 88,97 ---- We cannot test this directly, so we test UTF-8 size instead, expecting that TCL_UTF_MAX is changed if Tcl ever supports ! either UTF-16 or UCS-4. ! Redhat 8 sets TCL_UTF_MAX to 6, and uses wchar_t for ! Tcl_Unichar. This is also ok as long as Python uses UCS-4, ! as well. ! */ ! #if TCL_UTF_MAX != 3 && !(defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==6) #error "unsupported Tcl configuration" #endif *************** *** 900,904 **** /* This #ifdef assumes that Tcl uses UCS-2. See TCL_UTF_MAX test above. */ ! #ifdef Py_UNICODE_WIDE Tcl_UniChar *outbuf; int i; --- 904,908 ---- /* This #ifdef assumes that Tcl uses UCS-2. See TCL_UTF_MAX test above. */ ! #if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3 Tcl_UniChar *outbuf; int i; *************** *** 1031,1035 **** if (value->typePtr == app->StringType) { #ifdef Py_USING_UNICODE ! #ifdef Py_UNICODE_WIDE PyObject *result; int size; --- 1035,1039 ---- if (value->typePtr == app->StringType) { #ifdef Py_USING_UNICODE ! #if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==3 PyObject *result; int size; From gvanrossum@users.sourceforge.net Wed Apr 16 22:13:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 14:13:25 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.727,1.728 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1004/Misc Modified Files: NEWS Log Message: - The repr() of a weakref object now shows the __name__ attribute of the referenced object, if it has one. Also use %p to format pointers consistently, and use in proxy_repr(), to match the type name. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.727 retrieving revision 1.728 diff -C2 -d -r1.727 -r1.728 *** NEWS 16 Apr 2003 19:42:49 -0000 1.727 --- NEWS 16 Apr 2003 21:13:21 -0000 1.728 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - The repr() of a weakref object now shows the __name__ attribute of + the referenced object, if it has one. + - super() no longer ignores data descriptors, except __class__. See the thread started at From gvanrossum@users.sourceforge.net Wed Apr 16 22:13:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 16 Apr 2003 14:13:25 -0700 Subject: [Python-checkins] python/dist/src/Objects weakrefobject.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv1004/Objects Modified Files: weakrefobject.c Log Message: - The repr() of a weakref object now shows the __name__ attribute of the referenced object, if it has one. Also use %p to format pointers consistently, and use in proxy_repr(), to match the type name. Index: weakrefobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/weakrefobject.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** weakrefobject.c 9 Aug 2002 18:34:16 -0000 1.10 --- weakrefobject.c 16 Apr 2003 21:13:23 -0000 1.11 *************** *** 125,137 **** char buffer[256]; if (PyWeakref_GET_OBJECT(self) == Py_None) { ! PyOS_snprintf(buffer, sizeof(buffer), "", ! (long)(self)); } else { PyOS_snprintf(buffer, sizeof(buffer), ! "", ! (long)(self), PyWeakref_GET_OBJECT(self)->ob_type->tp_name, ! (long)(PyWeakref_GET_OBJECT(self))); } return PyString_FromString(buffer); --- 125,146 ---- char buffer[256]; if (PyWeakref_GET_OBJECT(self) == Py_None) { ! PyOS_snprintf(buffer, sizeof(buffer), "", self); } else { + char *name = NULL; + PyObject *nameobj = PyObject_GetAttrString(PyWeakref_GET_OBJECT(self), + "__name__"); + if (nameobj == NULL) + PyErr_Clear(); + else if (PyString_Check(nameobj)) + name = PyString_AS_STRING(nameobj); PyOS_snprintf(buffer, sizeof(buffer), ! name ? "" ! : "", ! self, PyWeakref_GET_OBJECT(self)->ob_type->tp_name, ! PyWeakref_GET_OBJECT(self), ! name); ! Py_XDECREF(nameobj); } return PyString_FromString(buffer); *************** *** 269,273 **** char buf[160]; PyOS_snprintf(buf, sizeof(buf), ! "", proxy, PyWeakref_GET_OBJECT(proxy)->ob_type->tp_name, PyWeakref_GET_OBJECT(proxy)); --- 278,282 ---- char buf[160]; PyOS_snprintf(buf, sizeof(buf), ! "", proxy, PyWeakref_GET_OBJECT(proxy)->ob_type->tp_name, PyWeakref_GET_OBJECT(proxy)); From nnorwitz@users.sourceforge.net Thu Apr 17 14:14:01 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 17 Apr 2003 06:14:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.173,1.174 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv31474/Lib/lib-tk Modified Files: Tkinter.py Log Message: Remove extra space in docstring Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -d -r1.173 -r1.174 *** Tkinter.py 16 Apr 2003 20:10:03 -0000 1.173 --- Tkinter.py 17 Apr 2003 13:13:55 -0000 1.174 *************** *** 379,383 **** getdouble = float def getboolean(self, s): ! """Return a boolean value for Tcl boolean values true and false given as parameter.""" return self.tk.getboolean(s) def focus_set(self): --- 379,383 ---- getdouble = float def getboolean(self, s): ! """Return a boolean value for Tcl boolean values true and false given as parameter.""" return self.tk.getboolean(s) def focus_set(self): From gvanrossum@users.sourceforge.net Thu Apr 17 15:55:43 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 07:55:43 -0700 Subject: [Python-checkins] python/dist/src/Include pgen.h,NONE,2.1 parsetok.h,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv14389/Include Modified Files: parsetok.h Added Files: pgen.h Log Message: Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to work. This includes some more code that used to be part of pgen in the main parser; I'm okay with that. I'll see if the Windows build needs work next. --- NEW FILE: pgen.h --- #ifndef Py_PGEN_H #define Py_PGEN_H #ifdef __cplusplus extern "C" { #endif /* Parser generator interface */ extern grammar *meta_grammar(void); struct _node; extern grammar *pgen(struct _node *); #ifdef __cplusplus } #endif #endif /* !Py_PGEN_H */ Index: parsetok.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/parsetok.h,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** parsetok.h 13 Feb 2003 22:07:52 -0000 2.21 --- parsetok.h 17 Apr 2003 14:55:40 -0000 2.22 *************** *** 39,42 **** --- 39,46 ---- grammar *, int, perrdetail *, int); + + /* Note that he following function is defined in pythonrun.c not parsetok.c. */ + PyAPI_FUNC(void) PyParser_SetError(perrdetail *); + #ifdef __cplusplus } From gvanrossum@users.sourceforge.net Thu Apr 17 15:55:45 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 07:55:45 -0700 Subject: [Python-checkins] python/dist/src/Parser grammar.c,2.20,2.21 metagrammar.c,2.11,2.12 pgen.c,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv14389/Parser Modified Files: grammar.c metagrammar.c pgen.c Log Message: Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to work. This includes some more code that used to be part of pgen in the main parser; I'm okay with that. I'll see if the Windows build needs work next. Index: grammar.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/grammar.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** grammar.c 4 Dec 2001 03:18:48 -0000 2.20 --- grammar.c 17 Apr 2003 14:55:41 -0000 2.21 *************** *** 39,43 **** d = &g->g_dfa[g->g_ndfas++]; d->d_type = type; ! d->d_name = name; d->d_nstates = 0; d->d_state = NULL; --- 39,43 ---- d = &g->g_dfa[g->g_ndfas++]; d->d_type = type; ! d->d_name = strdup(name); d->d_nstates = 0; d->d_state = NULL; *************** *** 99,103 **** lb = &ll->ll_label[ll->ll_nlabels++]; lb->lb_type = type; ! lb->lb_str = str; /* XXX strdup(str) ??? */ return lb - ll->ll_label; } --- 99,106 ---- lb = &ll->ll_label[ll->ll_nlabels++]; lb->lb_type = type; ! lb->lb_str = strdup(str); ! if (Py_DebugFlag) ! printf("Label @ %08x, %d: %s\n", (unsigned)ll, ll->ll_nlabels, ! PyGrammar_LabelRepr(lb)); return lb - ll->ll_label; } *************** *** 153,156 **** --- 156,160 ---- g->g_dfa[i].d_type); lb->lb_type = g->g_dfa[i].d_type; + free(lb->lb_str); lb->lb_str = NULL; return; *************** *** 163,166 **** --- 167,171 ---- lb->lb_str, i); lb->lb_type = i; + free(lb->lb_str); lb->lb_str = NULL; return; *************** *** 174,184 **** if (isalpha((int)(lb->lb_str[1])) || lb->lb_str[1] == '_') { char *p; if (Py_DebugFlag) printf("Label %s is a keyword\n", lb->lb_str); lb->lb_type = NAME; ! lb->lb_str++; ! p = strchr(lb->lb_str, '\''); if (p) ! *p = '\0'; } else if (lb->lb_str[2] == lb->lb_str[0]) { --- 179,199 ---- if (isalpha((int)(lb->lb_str[1])) || lb->lb_str[1] == '_') { char *p; + char *src; + char *dest; + size_t name_len; if (Py_DebugFlag) printf("Label %s is a keyword\n", lb->lb_str); lb->lb_type = NAME; ! src = lb->lb_str + 1; ! p = strchr(src, '\''); if (p) ! name_len = p - src; ! else ! name_len = strlen(src); ! dest = malloc(name_len + 1); ! strncpy(dest, src, name_len); ! dest[name_len] = '\0'; ! free(lb->lb_str); ! lb->lb_str = dest; } else if (lb->lb_str[2] == lb->lb_str[0]) { *************** *** 186,189 **** --- 201,205 ---- if (type != OP) { lb->lb_type = type; + free(lb->lb_str); lb->lb_str = NULL; } *************** *** 197,200 **** --- 213,217 ---- if (type != OP) { lb->lb_type = type; + free(lb->lb_str); lb->lb_str = NULL; } *************** *** 209,212 **** --- 226,230 ---- if (type != OP) { lb->lb_type = type; + free(lb->lb_str); lb->lb_str = NULL; } Index: metagrammar.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/metagrammar.c,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** metagrammar.c 1 Sep 2000 23:29:28 -0000 2.11 --- metagrammar.c 17 Apr 2003 14:55:41 -0000 2.12 *************** *** 152,153 **** --- 152,159 ---- return &_PyParser_Grammar; } + + grammar * + Py_meta_grammar(void) + { + return meta_grammar(); + } Index: pgen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/pgen.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** pgen.c 28 Feb 2003 15:27:40 -0000 2.24 --- pgen.c 17 Apr 2003 14:55:42 -0000 2.25 *************** *** 670,673 **** --- 670,678 ---- } + grammar * + Py_pgen(node *n) + { + return pgen(n); + } /* From gvanrossum@users.sourceforge.net Thu Apr 17 15:56:16 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 07:56:16 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv14389 Modified Files: Makefile.pre.in Log Message: Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to work. This includes some more code that used to be part of pgen in the main parser; I'm okay with that. I'll see if the Windows build needs work next. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** Makefile.pre.in 31 Mar 2003 09:39:54 -0000 1.120 --- Makefile.pre.in 17 Apr 2003 14:55:39 -0000 1.121 *************** *** 195,199 **** Parser/parsetok.o \ Parser/bitset.o \ ! Parser/metagrammar.o PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o --- 195,202 ---- Parser/parsetok.o \ Parser/bitset.o \ ! Parser/metagrammar.o \ ! Parser/firstsets.o \ ! Parser/grammar.o \ ! Parser/pgen.o PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o *************** *** 203,209 **** Python/mysnprintf.o \ Parser/tokenizer_pgen.o \ - Parser/firstsets.o \ - Parser/grammar.o \ - Parser/pgen.o \ Parser/printgrammar.o \ Parser/pgenmain.o --- 206,209 ---- From tim_one@users.sourceforge.net Thu Apr 17 16:21:09 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 08:21:09 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.185,2.186 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24639/python/Python Modified Files: pythonrun.c Log Message: Py_Finalize(): Reverted recent changes that tried to move the PYTHONDUMPREFS output after most teardown. Attempts to use PYTHONDUMPREFS with the Zope3 test suite died with Py_FatalError(), since _Py_PrintReferences() can end up executing arbitrary Python code (for objects that override __repr__), and that requires an intact interpreter. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** pythonrun.c 15 Apr 2003 15:10:54 -0000 2.185 --- pythonrun.c 17 Apr 2003 15:21:01 -0000 2.186 *************** *** 271,274 **** --- 271,285 ---- #endif + #ifdef Py_TRACE_REFS + /* Display all objects still alive -- this can invoke arbitrary + * __repr__ overrides, so requires a mostly-intact interpreter. + * Alas, a lot of stuff may still be alive now that will be cleaned + * up later. + */ + if (Py_GETENV("PYTHONDUMPREFS")) { + _Py_PrintReferences(stderr); + } + #endif /* Py_TRACE_REFS */ + /* Now we decref the exception classes. After this point nothing can raise an exception. That's okay, because each Fini() method *************** *** 306,317 **** PyGrammar_RemoveAccelerators(&_PyParser_Grammar); - - #ifdef Py_TRACE_REFS - /* Dump references -- this may implicitly need the thread state, - so this is the last possible place where we can do this. */ - if (Py_GETENV("PYTHONDUMPREFS")) { - _Py_PrintReferences(stderr); - } - #endif /* Py_TRACE_REFS */ #ifdef PYMALLOC_DEBUG --- 317,320 ---- From tim_one@users.sourceforge.net Thu Apr 17 16:24:28 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 08:24:28 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv30146/python/Python Modified Files: pythonrun.c Log Message: Trimmed trailing whitespace. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** pythonrun.c 17 Apr 2003 15:21:01 -0000 2.186 --- pythonrun.c 17 Apr 2003 15:24:21 -0000 2.187 *************** *** 114,118 **** return; initialized = 1; ! if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') Py_DebugFlag = add_flag(Py_DebugFlag, p); --- 114,118 ---- return; initialized = 1; ! if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') Py_DebugFlag = add_flag(Py_DebugFlag, p); *************** *** 524,528 **** int ! PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags) { --- 524,528 ---- int ! PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags) { *************** *** 689,693 **** if (ftell(fp) == 0) { if (fread(buf, 1, 2, fp) == 2 && ! ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) ispyc = 1; rewind(fp); --- 689,693 ---- if (ftell(fp) == 0) { if (fread(buf, 1, 2, fp) == 2 && ! ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) ispyc = 1; rewind(fp); *************** *** 696,700 **** } return 0; ! } int --- 696,700 ---- } return 0; ! } int *************** *** 739,743 **** v = run_pyc_file(fp, filename, d, d, flags); } else { ! v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d, closeit, flags); } --- 739,743 ---- v = run_pyc_file(fp, filename, d, d, flags); } else { ! v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d, closeit, flags); } *************** *** 1018,1022 **** else { char* modstr = PyString_AsString(moduleName); ! if (modstr && strcmp(modstr, "exceptions")) { err = PyFile_WriteString(modstr, f); --- 1018,1022 ---- else { char* modstr = PyString_AsString(moduleName); ! if (modstr && strcmp(modstr, "exceptions")) { err = PyFile_WriteString(modstr, f); *************** *** 1097,1101 **** { return PyRun_FileExFlags(fp, filename, start, globals, locals, 0, ! flags); } --- 1097,1101 ---- { return PyRun_FileExFlags(fp, filename, start, globals, locals, 0, ! flags); } *************** *** 1174,1178 **** PyObject * ! Py_CompileStringFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags) { --- 1174,1178 ---- PyObject * ! Py_CompileStringFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags) { *************** *** 1250,1254 **** perrdetail err; ! n = PyParser_ParseStringFlagsFilename(str, filename, &_PyParser_Grammar, start, &err, flags); --- 1250,1254 ---- perrdetail err; ! n = PyParser_ParseStringFlagsFilename(str, filename, &_PyParser_Grammar, start, &err, flags); *************** *** 1482,1486 **** ! #if defined(USE_STACKCHECK) #if defined(WIN32) && defined(_MSC_VER) --- 1482,1486 ---- ! #if defined(USE_STACKCHECK) #if defined(WIN32) && defined(_MSC_VER) From gvanrossum@users.sourceforge.net Thu Apr 17 17:02:30 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 09:02:30 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv17595 Modified Files: pythonrun.c Log Message: A missing piece of the PEP 269 patch: add PyParser_SetError(), a wrapper around err_input(). Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** pythonrun.c 17 Apr 2003 15:24:21 -0000 2.187 --- pythonrun.c 17 Apr 2003 16:02:26 -0000 2.188 *************** *** 1265,1268 **** --- 1265,1277 ---- } + /* May want to move a more generalized form of this to parsetok.c or + even parser modules. */ + + void + PyParser_SetError(perrdetail *err) + { + err_input(err); + } + /* Set the error appropriate to the given input error code (see errcode.h) */ From gvanrossum@users.sourceforge.net Thu Apr 17 17:53:31 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 09:53:31 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.728,1.729 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14311 Modified Files: NEWS Log Message: Changes in support of PEP 269. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.728 retrieving revision 1.729 diff -C2 -d -r1.728 -r1.729 *** NEWS 16 Apr 2003 21:13:21 -0000 1.728 --- NEWS 17 Apr 2003 16:53:26 -0000 1.729 *************** *** 13,16 **** --- 13,21 ---- ----------------- + - In support of PEP 269 (making the pgen parser generator accessible + from Python), some changes to the pgen code structure were made; a + few files that used to be linked only with pgen are now linked with + Python itself. + - The repr() of a weakref object now shows the __name__ attribute of the referenced object, if it has one. From gvanrossum@users.sourceforge.net Thu Apr 17 18:29:23 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 10:29:23 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv2992/Include Modified Files: objimpl.h Log Message: - New C API PyGC_Collect(), same as calling gc.collect(). - Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** objimpl.h 12 Aug 2002 07:21:57 -0000 2.57 --- objimpl.h 17 Apr 2003 17:29:20 -0000 2.58 *************** *** 229,232 **** --- 229,235 ---- */ + /* C equivalent of gc.collect(). */ + long PyGC_Collect(void); + /* Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) From gvanrossum@users.sourceforge.net Thu Apr 17 18:29:23 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 10:29:23 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.729,1.730 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2992/Misc Modified Files: NEWS Log Message: - New C API PyGC_Collect(), same as calling gc.collect(). - Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.729 retrieving revision 1.730 diff -C2 -d -r1.729 -r1.730 *** NEWS 17 Apr 2003 16:53:26 -0000 1.729 --- NEWS 17 Apr 2003 17:29:18 -0000 1.730 *************** *** 170,178 **** ----- - PyThreadState_GetDict() was changed not to raise an exception or issue a fatal error when no current thread state is available. This makes it possible to print dictionaries when no thread is active. ! - LONG_LONG was renamed to PY_LONG_LONG. - Added PyObject_SelfIter() to fill the tp_iter slot for the --- 170,184 ---- ----- + - Added PyGC_Collect(), equivalent to calling gc.collect(). + - PyThreadState_GetDict() was changed not to raise an exception or issue a fatal error when no current thread state is available. This makes it possible to print dictionaries when no thread is active. ! - LONG_LONG was renamed to PY_LONG_LONG. Extensions that use this and ! need compatibility with previous versions can use this: ! #ifndef PY_LONG_LONG ! #define PY_LONG_LONG LONG_LONG ! #endif - Added PyObject_SelfIter() to fill the tp_iter slot for the From gvanrossum@users.sourceforge.net Thu Apr 17 18:29:24 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 10:29:24 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.70,2.71 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv2992/Modules Modified Files: gcmodule.c Log Message: - New C API PyGC_Collect(), same as calling gc.collect(). - Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** gcmodule.c 8 Apr 2003 17:17:17 -0000 2.70 --- gcmodule.c 17 Apr 2003 17:29:21 -0000 2.71 *************** *** 981,986 **** } /* for debugging */ ! void _PyGC_Dump(PyGC_Head *g) { _PyObject_Dump(FROM_GC(g)); --- 981,1004 ---- } + /* API to invoke gc.collect() from C */ + long + PyGC_Collect(void) + { + long n; + + if (collecting) + n = 0; /* already collecting, don't do anything */ + else { + collecting = 1; + n = collect(NUM_GENERATIONS - 1); + collecting = 0; + } + + return n; + } + /* for debugging */ ! void ! _PyGC_Dump(PyGC_Head *g) { _PyObject_Dump(FROM_GC(g)); From gvanrossum@users.sourceforge.net Thu Apr 17 18:29:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 10:29:25 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.188,2.189 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2992/Python Modified Files: pythonrun.c Log Message: - New C API PyGC_Collect(), same as calling gc.collect(). - Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** pythonrun.c 17 Apr 2003 16:02:26 -0000 2.188 --- pythonrun.c 17 Apr 2003 17:29:22 -0000 2.189 *************** *** 256,261 **** --- 256,269 ---- PyModule_WarningsModule = NULL; + /* Collect garbage. This may call finalizers; it's nice to call these + before all modules are destroyed. */ + PyGC_Collect(); + /* Destroy all modules */ PyImport_Cleanup(); + + /* Collect final garbage. This disposes of cycles created by + new-style class definitions, for example. */ + PyGC_Collect(); /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ From gvanrossum@users.sourceforge.net Thu Apr 17 18:32:01 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 10:32:01 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.32,1.33 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4985 Modified Files: pep-0283.txt Log Message: Schedule update. Plan for a beta 1 release on 4/25/03. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pep-0283.txt 26 Feb 2003 14:58:11 -0000 1.32 --- pep-0283.txt 17 Apr 2003 17:31:58 -0000 1.33 *************** *** 26,34 **** guidelines: alpha 2 -- February 19, 2003 ! beta 1 -- late March ! beta 2 -- late April ! rc 1 -- late May ! final -- early June --- 26,35 ---- guidelines: + alpha 1 -- December 31, 2002 alpha 2 -- February 19, 2003 ! beta 1 -- April 25, 2003 ! beta 2 -- late May ! rc 1 -- late June ! final -- early July *************** *** 138,141 **** --- 139,147 ---- - A new pickling protocol. See PEP 307. + - PEP 305 (CSV File API, by Skip Montanaro et al.) is in; this is + the csv package. + + - Raymond Hettinger's itertools module is in. + Planned features for 2.3 *************** *** 156,175 **** unsigned C long int that receives the lower LONG_BIT bits of the Python argument, truncating without range checking. (SF ! 595026.) ! ! - For a class defined inside another class, the __name__ should be ! "outer.inner", and pickling should work. (SF 633930. I'm no ! longer certain this is easy or even right.) - The import lock could use some redesign. (SF 683658.) - PEP 311 (Simplified GIL Acquisition for Extensions, by Mark ! Hammond) may be ready in time to get it in. ! ! - PEP 305 (CSV File API, by Skip Montanaro et al.) might go in; I ! don't know what the authors' plans are. ! ! - PEP 304 (Controlling Generation of Bytecode Files by Montanaro) ! might go in; I've lost track of the status. --- 162,171 ---- unsigned C long int that receives the lower LONG_BIT bits of the Python argument, truncating without range checking. (SF ! 595026; Thomas Heller is working on this.) - The import lock could use some redesign. (SF 683658.) - PEP 311 (Simplified GIL Acquisition for Extensions, by Mark ! Hammond) is expected to go into beta 1. *************** *** 209,212 **** --- 205,213 ---- release). For example: + - TBD + + + Features unlikely to make it into Python 2.3 + - Set API issues; is the sets module perfect? *************** *** 221,229 **** Ditto. - - Fredrik Lundh's basetime proposal: - http://effbot.org/ideas/time-type.htm - - I believe this is dead now. - - New widgets for Tkinter??? --- 222,225 ---- *************** *** 232,237 **** already (though not on Windows yet). ! Features unlikely to make it into Python 2.3 - reST is going to be used a lot in Zope3. Maybe it could become --- 228,242 ---- already (though not on Windows yet). + - Fredrik Lundh's basetime proposal: + http://effbot.org/ideas/time-type.htm ! I believe this is dead now. ! ! - PEP 304 (Controlling Generation of Bytecode Files by Montanaro) ! seems to have lost steam. ! ! - For a class defined inside another class, the __name__ should be ! "outer.inner", and pickling should work. (SF 633930. I'm no ! longer certain this is easy or even right.) - reST is going to be used a lot in Zope3. Maybe it could become *************** *** 255,262 **** It seems we can't get consensus on this. - - An iterator tools module featuring goodies from SML and Haskell? - http://mail.python.org/pipermail/python-dev/2002-May/024418.html - I haven't heard about this in ages. - - Deprecate the buffer object. http://mail.python.org/pipermail/python-dev/2002-July/026388.html --- 260,263 ---- *************** *** 266,275 **** - PEP 269 Pgen Module for Python Riehl ! I haven't heard from Jon Riehl since he moved to Chicago. - Add support for the long-awaited Python catalog. Kapil Thangavelu has a Zope-based implementation that he demoed at OSCON 2002. Now all we need is a place to host it and a person ! to champion it. - PEP 266 Optimizing Global Variable/Attribute Access Montanaro --- 267,278 ---- - PEP 269 Pgen Module for Python Riehl ! (Some necessary changes are in; the pgen module itself needs to ! mature more.) - Add support for the long-awaited Python catalog. Kapil Thangavelu has a Zope-based implementation that he demoed at OSCON 2002. Now all we need is a place to host it and a person ! to champion it. (Some changes to distutils to support this are ! in, at least.) - PEP 266 Optimizing Global Variable/Attribute Access Montanaro From theller@users.sourceforge.net Thu Apr 17 19:55:15 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 17 Apr 2003 11:55:15 -0700 Subject: [Python-checkins] python/dist/src/Include longobject.h,2.29,2.30 intobject.h,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv6765 Modified Files: longobject.h intobject.h Log Message: SF # 595026: support for masks in getargs.c. New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this. Index: longobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/longobject.h,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** longobject.h 29 Mar 2003 10:04:54 -0000 2.29 --- longobject.h 17 Apr 2003 18:55:11 -0000 2.30 *************** *** 20,23 **** --- 20,24 ---- PyAPI_FUNC(long) PyLong_AsLong(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); + PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); /* _PyLong_AsScaledDouble returns a double x and an exponent e such that *************** *** 38,41 **** --- 39,43 ---- PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); + PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); #endif /* HAVE_LONG_LONG */ Index: intobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/intobject.h,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** intobject.h 1 Jan 2003 15:18:32 -0000 2.29 --- intobject.h 17 Apr 2003 18:55:11 -0000 2.30 *************** *** 37,40 **** --- 37,45 ---- PyAPI_FUNC(PyObject *) PyInt_FromLong(long); PyAPI_FUNC(long) PyInt_AsLong(PyObject *); + PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); + #ifdef HAVE_LONG_LONG + PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); + #endif + PyAPI_FUNC(long) PyInt_GetMax(void); From theller@users.sourceforge.net Thu Apr 17 19:55:20 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 17 Apr 2003 11:55:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_getargs2.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv6861 Added Files: test_getargs2.py Log Message: SF # 595026: support for masks in getargs.c. New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this. --- NEW FILE: test_getargs2.py --- import unittest from test import test_support import sys import warnings, re warnings.filterwarnings("ignore", category=DeprecationWarning, module=__name__) """ > How about the following counterproposal. This also changes some of > the other format codes to be a little more regular. > > Code C type Range check > > b unsigned char 0..UCHAR_MAX > h unsigned short 0..USHRT_MAX > B unsigned char none ** > H unsigned short none ** > k * unsigned long none > I * unsigned int 0..UINT_MAX > i int INT_MIN..INT_MAX > l long LONG_MIN..LONG_MAX > K * unsigned long long none > L long long LLONG_MIN..LLONG_MAX > Notes: > > * New format codes. > > ** Changed from previous "range-and-a-half" to "none"; the > range-and-a-half checking wasn't particularly useful. Plus a C API or two, e.g. PyInt_AsLongMask() -> unsigned long and PyInt_AsLongLongMask() -> unsigned long long (if that exists). """ LARGE = 0x7FFFFFFF VERY_LARGE = 0xFF0000121212121212121242L from _testcapi import UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, INT_MAX, \ INT_MIN, LONG_MIN, LONG_MAX from _testcapi import getargs_ul as ul_convert from _testcapi import getargs_l as l_convert try: from _testcapi import getargs_ll as ll_convert from _testcapi import getargs_ull as ull_convert except ImportError: pass # fake, they are not defined in Python's header files LLONG_MAX = 2**63-1 LLONG_MIN = -2**63 ULLONG_MAX = 2**64-1 class Long: def __int__(self): return 99L class Int: def __int__(self): return 99 class Unsigned_TestCase(unittest.TestCase): def test_b(self): # b returns 'unsigned char', and does range checking (0 ... UCHAR_MAX) self.failUnlessEqual(3, ul_convert("b", 3.14)) self.failUnlessEqual(99, ul_convert("b", Long())) self.failUnlessEqual(99, ul_convert("b", Int())) self.assertRaises(OverflowError, ul_convert, "b", -1) self.failUnlessEqual(0, ul_convert("b", 0)) self.failUnlessEqual(UCHAR_MAX, ul_convert("b", UCHAR_MAX)) self.assertRaises(OverflowError, ul_convert, "b", UCHAR_MAX + 1) self.failUnlessEqual(42, ul_convert("b", 42)) self.failUnlessEqual(42, ul_convert("b", 42L)) self.assertRaises(OverflowError, ul_convert, "b", VERY_LARGE) def test_h(self): # h returns 'unsigned short', and does range checking (0 ... USHRT_MAX) self.failUnlessEqual(3, ul_convert("h", 3.14)) self.failUnlessEqual(99, ul_convert("h", Long())) self.failUnlessEqual(99, ul_convert("h", Int())) self.assertRaises(OverflowError, ul_convert, "h", -1) self.failUnlessEqual(0, ul_convert("h", 0)) self.failUnlessEqual(USHRT_MAX, ul_convert("h", USHRT_MAX)) self.assertRaises(OverflowError, ul_convert, "h", USHRT_MAX+1) self.failUnlessEqual(42, ul_convert("h", 42)) self.failUnlessEqual(42, ul_convert("h", 42L)) self.assertRaises(OverflowError, ul_convert, "h", VERY_LARGE) def test_B(self): # B returns 'unsigned char', no range checking self.failUnless(3 == ul_convert("B", 3.14)) self.failUnlessEqual(99, ul_convert("B", Long())) self.failUnlessEqual(99, ul_convert("B", Int())) self.failUnlessEqual(UCHAR_MAX, ul_convert("B", -1)) self.failUnlessEqual(UCHAR_MAX, ul_convert("B", -1L)) self.failUnlessEqual(0, ul_convert("B", 0)) self.failUnlessEqual(UCHAR_MAX, ul_convert("B", UCHAR_MAX)) self.failUnlessEqual(0, ul_convert("B", UCHAR_MAX+1)) self.failUnlessEqual(42, ul_convert("B", 42)) self.failUnlessEqual(42, ul_convert("B", 42L)) self.failUnlessEqual(UCHAR_MAX & VERY_LARGE, ul_convert("B", VERY_LARGE)) def test_H(self): # H returns 'unsigned short', no range checking self.failUnlessEqual(3, ul_convert("H", 3.14)) self.failUnlessEqual(99, ul_convert("H", Long())) self.failUnlessEqual(99, ul_convert("H", Int())) self.failUnlessEqual(USHRT_MAX, ul_convert("H", -1)) self.failUnlessEqual(0, ul_convert("H", 0)) self.failUnlessEqual(USHRT_MAX, ul_convert("H", USHRT_MAX)) self.failUnlessEqual(0, ul_convert("H", USHRT_MAX+1)) self.failUnlessEqual(42, ul_convert("H", 42)) self.failUnlessEqual(42, ul_convert("H", 42L)) self.failUnlessEqual(VERY_LARGE & USHRT_MAX, ul_convert("H", VERY_LARGE)) def test_I(self): # I returns 'unsigned int', no range checking self.failUnlessEqual(3, ul_convert("I", 3.14)) self.failUnlessEqual(99, ul_convert("I", Long())) self.failUnlessEqual(99, ul_convert("I", Int())) self.failUnlessEqual(UINT_MAX, ul_convert("I", -1)) self.failUnlessEqual(0, ul_convert("I", 0)) self.failUnlessEqual(UINT_MAX, ul_convert("I", UINT_MAX)) self.failUnlessEqual(0, ul_convert("I", UINT_MAX+1)) self.failUnlessEqual(42, ul_convert("I", 42)) self.failUnlessEqual(42, ul_convert("I", 42L)) self.failUnlessEqual(VERY_LARGE & UINT_MAX, ul_convert("I", VERY_LARGE)) def test_k(self): # k returns 'unsigned long', no range checking # it does not accept float, or instances with __int__ self.assertRaises(TypeError, ul_convert, "k", 3.14) self.assertRaises(TypeError, ul_convert, "k", Long()) self.assertRaises(TypeError, ul_convert, "k", Int()) self.failUnlessEqual(ULONG_MAX, ul_convert("k", -1)) self.failUnlessEqual(0, ul_convert("k", 0)) self.failUnlessEqual(ULONG_MAX, ul_convert("k", ULONG_MAX)) self.failUnlessEqual(0, ul_convert("k", ULONG_MAX+1)) self.failUnlessEqual(42, ul_convert("k", 42)) self.failUnlessEqual(42, ul_convert("k", 42L)) self.failUnlessEqual(VERY_LARGE & ULONG_MAX, ul_convert("k", VERY_LARGE)) class Signed_TestCase(unittest.TestCase): def test_i(self): # i returns 'int', and does range checking (INT_MIN ... INT_MAX) self.failUnlessEqual(3, l_convert("i", 3.14)) self.failUnlessEqual(99, l_convert("i", Long())) self.failUnlessEqual(99, l_convert("i", Int())) self.assertRaises(OverflowError, l_convert, "i", INT_MIN-1) self.failUnlessEqual(INT_MIN, l_convert("i", INT_MIN)) self.failUnlessEqual(INT_MAX, l_convert("i", INT_MAX)) self.assertRaises(OverflowError, l_convert, "i", INT_MAX+1) self.failUnlessEqual(42, l_convert("i", 42)) self.failUnlessEqual(42, l_convert("i", 42L)) self.assertRaises(OverflowError, l_convert, "i", VERY_LARGE) def test_l(self): # l returns 'long', and does range checking (LONG_MIN ... LONG_MAX) self.failUnlessEqual(3, l_convert("l", 3.14)) self.failUnlessEqual(99, l_convert("l", Long())) self.failUnlessEqual(99, l_convert("l", Int())) self.assertRaises(OverflowError, l_convert, "l", LONG_MIN-1) self.failUnlessEqual(LONG_MIN, l_convert("l", LONG_MIN)) self.failUnlessEqual(LONG_MAX, l_convert("l", LONG_MAX)) self.assertRaises(OverflowError, l_convert, "l", LONG_MAX+1) self.failUnlessEqual(42, l_convert("l", 42)) self.failUnlessEqual(42, l_convert("l", 42L)) self.assertRaises(OverflowError, l_convert, "l", VERY_LARGE) class LongLong_TestCase(unittest.TestCase): def test_L(self): # L returns 'long long', and does range checking (LLONG_MIN ... LLONG_MAX) # XXX There's a bug in getargs.c, format code "L": # If you pass something else than a Python long, you # get "Bad argument to internal function". # So these three tests are commented out: ## self.failUnlessEqual(3, ll_convert("L", 3.14)) ## self.failUnlessEqual(99, ll_convert("L", Long())) ## self.failUnlessEqual(99, ll_convert("L", Int())) self.assertRaises(OverflowError, ll_convert, "L", LLONG_MIN-1) self.failUnlessEqual(LLONG_MIN, ll_convert("L", LLONG_MIN)) self.failUnlessEqual(LLONG_MAX, ll_convert("L", LLONG_MAX)) self.assertRaises(OverflowError, ll_convert, "L", LLONG_MAX+1) self.failUnlessEqual(42, ll_convert("L", 42)) self.failUnlessEqual(42, ll_convert("L", 42L)) self.assertRaises(OverflowError, ll_convert, "L", VERY_LARGE) def test_K(self): # K return 'unsigned long long', no range checking self.assertRaises(TypeError, ull_convert, "K", 3.14) self.assertRaises(TypeError, ull_convert, "K", Long()) self.assertRaises(TypeError, ull_convert, "K", Int()) self.failUnlessEqual(ULLONG_MAX, ull_convert("K", ULLONG_MAX)) self.failUnlessEqual(0, ull_convert("K", 0)) self.failUnlessEqual(0, ull_convert("K", ULLONG_MAX+1)) self.failUnlessEqual(42, ull_convert("K", 42)) self.failUnlessEqual(42, ull_convert("K", 42L)) self.failUnlessEqual(VERY_LARGE & ULLONG_MAX, ull_convert("K", VERY_LARGE)) def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Signed_TestCase)) suite.addTest(unittest.makeSuite(Unsigned_TestCase)) try: ll_convert except NameError: pass # PY_LONG_LONG not available else: suite.addTest(unittest.makeSuite(LongLong_TestCase)) test_support.run_suite(suite) if __name__ == "__main__": test_main() From theller@users.sourceforge.net Thu Apr 17 19:55:27 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 17 Apr 2003 11:55:27 -0700 Subject: [Python-checkins] python/dist/src/Modules _testcapimodule.c,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv6939 Modified Files: _testcapimodule.c Log Message: SF # 595026: support for masks in getargs.c. New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this. Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** _testcapimodule.c 29 Mar 2003 10:04:54 -0000 1.20 --- _testcapimodule.c 17 Apr 2003 18:55:25 -0000 1.21 *************** *** 291,294 **** --- 291,427 ---- #endif /* ifdef HAVE_LONG_LONG */ + /* Call PyArg_ParseTuple, and return the result as unsigned long */ + static PyObject * + getargs_ul(PyObject *self, PyObject *args) + { + PyObject *ob, *result = NULL, *argtuple; + char *fmt; + unsigned long value = 0; + + if (!PyArg_ParseTuple(args, "sO", &fmt, &ob)) + return NULL; + argtuple = PyTuple_New(1); + Py_INCREF(ob); + PyTuple_SET_ITEM(argtuple, 0, ob); + if (PyArg_ParseTuple(argtuple, fmt, &value)) + result = PyLong_FromUnsignedLong(value); + Py_DECREF(argtuple); + return result; + } + + /* Call PyArg_ParseTuple, and return the result as signed long */ + static PyObject * + getargs_l(PyObject *self, PyObject *args) + { + PyObject *ob, *result = NULL, *argtuple; + char *fmt; + long value = 0; + + if (!PyArg_ParseTuple(args, "sO", &fmt, &ob)) + return NULL; + argtuple = PyTuple_New(1); + Py_INCREF(ob); + PyTuple_SET_ITEM(argtuple, 0, ob); + if (PyArg_ParseTuple(argtuple, fmt, &value)) + result = PyLong_FromLong(value); + Py_DECREF(argtuple); + return result; + } + + #ifdef HAVE_LONG_LONG + /* Call PyArg_ParseTuple, and return the result as signed long long */ + static PyObject * + getargs_ll(PyObject *self, PyObject *args) + { + PyObject *ob, *result = NULL, *argtuple; + char *fmt; + PY_LONG_LONG value = 0; + + if (!PyArg_ParseTuple(args, "sO", &fmt, &ob)) + return NULL; + argtuple = PyTuple_New(1); + Py_INCREF(ob); + PyTuple_SET_ITEM(argtuple, 0, ob); + if (PyArg_ParseTuple(argtuple, fmt, &value)) + result = PyLong_FromLongLong(value); + Py_DECREF(argtuple); + return result; + } + + /* Call PyArg_ParseTuple, and return the result as unsigned long long */ + static PyObject * + getargs_ull(PyObject *self, PyObject *args) + { + PyObject *ob, *result = NULL, *argtuple; + char *fmt; + unsigned PY_LONG_LONG value = 0; + + if (!PyArg_ParseTuple(args, "sO", &fmt, &ob)) + return NULL; + argtuple = PyTuple_New(1); + Py_INCREF(ob); + PyTuple_SET_ITEM(argtuple, 0, ob); + if (PyArg_ParseTuple(argtuple, fmt, &value)) + result = PyLong_FromUnsignedLongLong(value); + Py_DECREF(argtuple); + return result; + } + #endif + + /* This function not only tests the 'k' getargs code, but also the + PyInt_AsUnsignedLongMask() and PyInt_AsUnsignedLongMask() functions. */ + static PyObject * + test_k_code(PyObject *self) + { + PyObject *tuple, *num; + unsigned long value; + + tuple = PyTuple_New(1); + if (tuple == NULL) + return NULL; + + /* a number larger than UINT_MAX even on 64-bit platforms */ + num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); + if (num == NULL) + return NULL; + + value = PyInt_AsUnsignedLongMask(num); + if (value != UINT_MAX) + return raiseTestError("test_k_code", + "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); + + PyTuple_SET_ITEM(tuple, 0, num); + + value = -1; + if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0) + return NULL; + if (value != UINT_MAX) + return raiseTestError("test_k_code", + "k code returned wrong value for long 0xFFF...FFF"); + + Py_DECREF(num); + num = PyLong_FromString("-FFFFFFFF000000000000000042", NULL, 16); + if (num == NULL) + return NULL; + + value = PyInt_AsUnsignedLongMask(num); + if (value != (unsigned long)-0x42) + return raiseTestError("test_k_code", + "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); + + PyTuple_SET_ITEM(tuple, 0, num); + + value = -1; + if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0) + return NULL; + if (value != (unsigned long)-0x42) + return raiseTestError("test_k_code", + "k code returned wrong value for long -0xFFF..000042"); + + Py_DECREF(tuple); + Py_INCREF(Py_None); + return Py_None; + } + #ifdef Py_USING_UNICODE *************** *** 410,414 **** --- 543,552 ---- {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, {"test_long_numbits", (PyCFunction)test_long_numbits, METH_NOARGS}, + {"test_k_code", (PyCFunction)test_k_code, METH_NOARGS}, + {"getargs_ul", (PyCFunction)getargs_ul, METH_VARARGS}, + {"getargs_l", (PyCFunction)getargs_l, METH_VARARGS}, #ifdef HAVE_LONG_LONG + {"getargs_ll", (PyCFunction)getargs_ll, METH_VARARGS}, + {"getargs_ull", (PyCFunction)getargs_ull, METH_VARARGS}, {"test_longlong_api", (PyCFunction)test_longlong_api, METH_NOARGS}, {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS}, *************** *** 420,423 **** --- 558,563 ---- }; + #define AddSym(d, n, f, v) {PyObject *o = f(v); PyDict_SetItemString(d, n, o); Py_DECREF(o);} + PyMODINIT_FUNC init_testcapi(void) *************** *** 426,429 **** --- 566,578 ---- m = Py_InitModule("_testcapi", TestMethods); + + PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX)); + PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX)); + PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX)); + PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); + PyModule_AddObject(m, "INT_MIN", PyInt_FromLong(INT_MIN)); + PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); + PyModule_AddObject(m, "INT_MAX", PyInt_FromLong(INT_MAX)); + PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX)); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); From theller@users.sourceforge.net Thu Apr 17 19:55:42 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 17 Apr 2003 11:55:42 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.157,1.158 intobject.c,2.103,2.104 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv7022 Modified Files: longobject.c intobject.c Log Message: SF # 595026: support for masks in getargs.c. New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** longobject.c 29 Mar 2003 10:04:55 -0000 1.157 --- longobject.c 17 Apr 2003 18:55:36 -0000 1.158 *************** *** 261,264 **** --- 261,292 ---- } + /* Get a C unsigned long int from a long int object, ignoring the high bits. + Returns -1 and sets an error condition if an error occurs. */ + + unsigned long + PyLong_AsUnsignedLongMask(PyObject *vv) + { + register PyLongObject *v; + unsigned long x; + int i, sign; + + if (vv == NULL || !PyLong_Check(vv)) { + PyErr_BadInternalCall(); + return (unsigned long) -1; + } + v = (PyLongObject *)vv; + i = v->ob_size; + sign = 1; + x = 0; + if (i < 0) { + sign = -1; + i = -i; + } + while (--i >= 0) { + x = (x << SHIFT) + v->ob_digit[i]; + } + return x * sign; + } + int _PyLong_Sign(PyObject *vv) *************** *** 780,783 **** --- 808,838 ---- } + /* Get a C unsigned long int from a long int object, ignoring the high bits. + Returns -1 and sets an error condition if an error occurs. */ + + unsigned PY_LONG_LONG + PyLong_AsUnsignedLongLongMask(PyObject *vv) + { + register PyLongObject *v; + unsigned PY_LONG_LONG x; + int i, sign; + + if (vv == NULL || !PyLong_Check(vv)) { + PyErr_BadInternalCall(); + return (unsigned long) -1; + } + v = (PyLongObject *)vv; + i = v->ob_size; + sign = 1; + x = 0; + if (i < 0) { + sign = -1; + i = -i; + } + while (--i >= 0) { + x = (x << SHIFT) + v->ob_digit[i]; + } + return x * sign; + } #undef IS_LITTLE_ENDIAN Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.103 retrieving revision 2.104 diff -C2 -d -r2.103 -r2.104 *** intobject.c 20 Feb 2003 20:32:11 -0000 2.103 --- intobject.c 17 Apr 2003 18:55:36 -0000 2.104 *************** *** 170,173 **** --- 170,218 ---- else { + Py_DECREF(io); + PyErr_SetString(PyExc_TypeError, + "nb_int should return int object"); + return -1; + } + } + + val = PyInt_AS_LONG(io); + Py_DECREF(io); + + return val; + } + + unsigned long + PyInt_AsUnsignedLongMask(register PyObject *op) + { + PyNumberMethods *nb; + PyIntObject *io; + unsigned long val; + + if (op && PyInt_Check(op)) + return PyInt_AS_LONG((PyIntObject*) op); + if (op && PyLong_Check(op)) + return PyLong_AsUnsignedLongMask(op); + + if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL || + nb->nb_int == NULL) { + PyErr_SetString(PyExc_TypeError, "an integer is required"); + return -1; + } + + io = (PyIntObject*) (*nb->nb_int) (op); + if (io == NULL) + return -1; + if (!PyInt_Check(io)) { + if (PyLong_Check(io)) { + val = PyLong_AsUnsignedLongMask((PyObject *)io); + Py_DECREF(io); + if (PyErr_Occurred()) + return -1; + return val; + } + else + { + Py_DECREF(io); PyErr_SetString(PyExc_TypeError, "nb_int should return int object"); *************** *** 181,184 **** --- 226,275 ---- return val; } + + #ifdef HAVE_LONG_LONG + unsigned PY_LONG_LONG + PyInt_AsUnsignedLongLongMask(register PyObject *op) + { + PyNumberMethods *nb; + PyIntObject *io; + unsigned PY_LONG_LONG val; + + if (op && PyInt_Check(op)) + return PyInt_AS_LONG((PyIntObject*) op); + if (op && PyLong_Check(op)) + return PyLong_AsUnsignedLongLongMask(op); + + if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL || + nb->nb_int == NULL) { + PyErr_SetString(PyExc_TypeError, "an integer is required"); + return -1; + } + + io = (PyIntObject*) (*nb->nb_int) (op); + if (io == NULL) + return -1; + if (!PyInt_Check(io)) { + if (PyLong_Check(io)) { + val = PyLong_AsUnsignedLongLongMask((PyObject *)io); + Py_DECREF(io); + if (PyErr_Occurred()) + return -1; + return val; + } + else + { + Py_DECREF(io); + PyErr_SetString(PyExc_TypeError, + "nb_int should return int object"); + return -1; + } + } + + val = PyInt_AS_LONG(io); + Py_DECREF(io); + + return val; + } + #endif PyObject * From theller@users.sourceforge.net Thu Apr 17 19:55:48 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 17 Apr 2003 11:55:48 -0700 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.97,2.98 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv7184 Modified Files: getargs.c Log Message: SF # 595026: support for masks in getargs.c. New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.97 retrieving revision 2.98 diff -C2 -d -r2.97 -r2.98 *** getargs.c 29 Mar 2003 10:04:55 -0000 2.97 --- getargs.c 17 Apr 2003 18:55:45 -0000 2.98 *************** *** 449,465 **** if (float_argument_error(arg)) return NULL; ! ival = PyInt_AsLong(arg); if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else if (ival < SCHAR_MIN) { - PyErr_SetString(PyExc_OverflowError, - "byte-sized integer bitfield is less than minimum"); return converterr("integer", arg, msgbuf, bufsize); - } - else if (ival > (int)UCHAR_MAX) { - PyErr_SetString(PyExc_OverflowError, - "byte-sized integer bitfield is greater than maximum"); - return converterr("integer", arg, msgbuf, bufsize); - } else *p = (unsigned char) ival; --- 449,455 ---- if (float_argument_error(arg)) return NULL; ! ival = PyInt_AsUnsignedLongMask(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else *p = (unsigned char) ival; *************** *** 467,471 **** } ! case 'h': {/* signed short int */ short *p = va_arg(*p_va, short *); long ival; --- 457,461 ---- } ! case 'h': {/* unsigned short int */ short *p = va_arg(*p_va, short *); long ival; *************** *** 475,486 **** if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); ! else if (ival < SHRT_MIN) { PyErr_SetString(PyExc_OverflowError, ! "signed short integer is less than minimum"); return converterr("integer", arg, msgbuf, bufsize); } ! else if (ival > SHRT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "signed short integer is greater than maximum"); return converterr("integer", arg, msgbuf, bufsize); } --- 465,476 ---- if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); ! else if (ival < 0) { PyErr_SetString(PyExc_OverflowError, ! "unsigned short integer is less than minimum"); return converterr("integer", arg, msgbuf, bufsize); } ! else if (ival > USHRT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "unsigned short integer is greater than maximum"); return converterr("integer", arg, msgbuf, bufsize); } *************** *** 496,512 **** if (float_argument_error(arg)) return NULL; ! ival = PyInt_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); - else if (ival < SHRT_MIN) { - PyErr_SetString(PyExc_OverflowError, - "short integer bitfield is less than minimum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else if (ival > USHRT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "short integer bitfield is greater than maximum"); - return converterr("integer", arg, msgbuf, bufsize); - } else *p = (unsigned short) ival; --- 486,492 ---- if (float_argument_error(arg)) return NULL; ! ival = PyInt_AsUnsignedLongMask(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else *p = (unsigned short) ival; *************** *** 537,540 **** --- 517,534 ---- } + case 'I': { /* int sized bitfield, both signed and + unsigned allowed */ + unsigned int *p = va_arg(*p_va, unsigned int *); + unsigned int ival; + if (float_argument_error(arg)) + return NULL; + ival = PyInt_AsUnsignedLongMask(arg); + if (ival == -1 && PyErr_Occurred()) + return converterr("integer", arg, msgbuf, bufsize); + else + *p = ival; + break; + } + case 'l': {/* long int */ long *p = va_arg(*p_va, long *); *************** *** 549,552 **** --- 543,559 ---- break; } + + case 'k': { /* long sized bitfield */ + unsigned long *p = va_arg(*p_va, unsigned long *); + unsigned long ival; + if (PyInt_Check(arg)) + ival = PyInt_AsUnsignedLongMask(arg); + else if (PyLong_Check(arg)) + ival = PyLong_AsUnsignedLongMask(arg); + else + return converterr("integer", arg, msgbuf, bufsize); + *p = ival; + break; + } #ifdef HAVE_LONG_LONG *************** *** 559,562 **** --- 566,584 ---- *p = ival; } + break; + } + + case 'K': { /* long long sized bitfield */ + unsigned PY_LONG_LONG *p = va_arg(*p_va, unsigned PY_LONG_LONG *); + unsigned PY_LONG_LONG ival; + if (float_argument_error(arg)) + return NULL; + if (PyInt_Check(arg)) + ival = PyInt_AsUnsignedLongMask(arg); + else if (PyLong_Check(arg)) + ival = PyLong_AsUnsignedLongLongMask(arg); + else + return converterr("integer", arg, msgbuf, bufsize); + *p = ival; break; } From tim_one@users.sourceforge.net Thu Apr 17 20:52:33 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 12:52:33 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.189,2.190 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28526/python/Python Modified Files: pythonrun.c Log Message: _Py_PrintReferences(): Changed to print object address at start of each new line. New pvt API function _Py_PrintReferenceAddresses(): Prints only the addresses and refcnts of the live objects. This is always safe to call, because it has no dependence on Python's C API. Py_Finalize(): If envar PYTHONDUMPREFS is set, call (the new) _Py_PrintReferenceAddresses() right before dumping final pymalloc stats. We can't print the reprs of the objects here because too much of the interpreter has been shut down. You need to correlate the addresses displayed here with the object reprs printed by the earlier PYTHONDUMPREFS call to _Py_PrintReferences(). Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.189 retrieving revision 2.190 diff -C2 -d -r2.189 -r2.190 *** pythonrun.c 17 Apr 2003 17:29:22 -0000 2.189 --- pythonrun.c 17 Apr 2003 19:52:29 -0000 2.190 *************** *** 285,291 **** * up later. */ ! if (Py_GETENV("PYTHONDUMPREFS")) { _Py_PrintReferences(stderr); - } #endif /* Py_TRACE_REFS */ --- 285,290 ---- * up later. */ ! if (Py_GETENV("PYTHONDUMPREFS")) _Py_PrintReferences(stderr); #endif /* Py_TRACE_REFS */ *************** *** 326,329 **** --- 325,336 ---- PyGrammar_RemoveAccelerators(&_PyParser_Grammar); + #ifdef Py_TRACE_REFS + /* Display addresses (& refcnts) of all objects still alive. + * An address can be used to find the repr of the object, printed + * above by _Py_PrintReferences. + */ + if (Py_GETENV("PYTHONDUMPREFS")) + _Py_PrintReferenceAddresses(stderr); + #endif /* Py_TRACE_REFS */ #ifdef PYMALLOC_DEBUG if (Py_GETENV("PYTHONMALLOCSTATS")) From tim_one@users.sourceforge.net Thu Apr 17 20:52:32 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 12:52:32 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.207,2.208 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv28526/python/Objects Modified Files: object.c Log Message: _Py_PrintReferences(): Changed to print object address at start of each new line. New pvt API function _Py_PrintReferenceAddresses(): Prints only the addresses and refcnts of the live objects. This is always safe to call, because it has no dependence on Python's C API. Py_Finalize(): If envar PYTHONDUMPREFS is set, call (the new) _Py_PrintReferenceAddresses() right before dumping final pymalloc stats. We can't print the reprs of the objects here because too much of the interpreter has been shut down. You need to correlate the addresses displayed here with the object reprs printed by the earlier PYTHONDUMPREFS call to _Py_PrintReferences(). Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.207 retrieving revision 2.208 diff -C2 -d -r2.207 -r2.208 *** object.c 15 Apr 2003 15:10:51 -0000 2.207 --- object.c 17 Apr 2003 19:52:28 -0000 2.208 *************** *** 2023,2026 **** --- 2023,2029 ---- } + /* Print all live objects. Because PyObject_Print is called, the + * interpreter must be in a healthy state. + */ void _Py_PrintReferences(FILE *fp) *************** *** 2029,2037 **** fprintf(fp, "Remaining objects:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) { ! fprintf(fp, "[%d] ", op->ob_refcnt); if (PyObject_Print(op, fp, 0) != 0) PyErr_Clear(); putc('\n', fp); } } --- 2032,2052 ---- fprintf(fp, "Remaining objects:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) { ! fprintf(fp, "%p [%d] ", op, op->ob_refcnt); if (PyObject_Print(op, fp, 0) != 0) PyErr_Clear(); putc('\n', fp); } + } + + /* Print the addresses of all live objects. Unlike _Py_PrintReferences, this + * doesn't make any calls to the Python C API, so is always safe to call. + */ + void + _Py_PrintReferenceAddresses(FILE *fp) + { + PyObject *op; + fprintf(fp, "Remaining object addresses:\n"); + for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) + fprintf(fp, "%p [%d]\n", op, op->ob_refcnt); } From tim_one@users.sourceforge.net Thu Apr 17 20:53:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 12:53:01 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.117,2.118 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28526/python/Include Modified Files: object.h Log Message: _Py_PrintReferences(): Changed to print object address at start of each new line. New pvt API function _Py_PrintReferenceAddresses(): Prints only the addresses and refcnts of the live objects. This is always safe to call, because it has no dependence on Python's C API. Py_Finalize(): If envar PYTHONDUMPREFS is set, call (the new) _Py_PrintReferenceAddresses() right before dumping final pymalloc stats. We can't print the reprs of the objects here because too much of the interpreter has been shut down. You need to correlate the addresses displayed here with the object reprs printed by the earlier PYTHONDUMPREFS call to _Py_PrintReferences(). Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.117 retrieving revision 2.118 diff -C2 -d -r2.117 -r2.118 *** object.h 23 Mar 2003 17:52:28 -0000 2.117 --- object.h 17 Apr 2003 19:52:27 -0000 2.118 *************** *** 583,586 **** --- 583,587 ---- PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); + PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); From jackjansen@users.sourceforge.net Thu Apr 17 21:40:11 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 17 Apr 2003 13:40:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/scrap _Scrapmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory sc8-pr-cvs1:/tmp/cvs-serv16980/Mac/Modules/scrap Modified Files: _Scrapmodule.c Log Message: Converted manually written code to the new K format specifier. Untested, but at least it still compiles. Index: _Scrapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/_Scrapmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _Scrapmodule.c 23 Dec 2002 23:16:24 -0000 1.6 --- _Scrapmodule.c 17 Apr 2003 20:40:07 -0000 1.7 *************** *** 139,143 **** char *flavorData__in__; int flavorData__in_len__; ! if (!PyArg_ParseTuple(_args, "O&ls#", PyMac_GetOSType, &flavorType, &flavorFlags, --- 139,143 ---- char *flavorData__in__; int flavorData__in_len__; ! if (!PyArg_ParseTuple(_args, "O&Ks#", PyMac_GetOSType, &flavorType, &flavorFlags, From jackjansen@users.sourceforge.net Thu Apr 17 21:40:40 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 17 Apr 2003 13:40:40 -0700 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv16980/Python Modified Files: mactoolboxglue.c Log Message: Converted manually written code to the new K format specifier. Untested, but at least it still compiles. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mactoolboxglue.c 2 Mar 2003 23:16:50 -0000 1.17 --- mactoolboxglue.c 17 Apr 2003 20:40:05 -0000 1.18 *************** *** 416,420 **** PyMac_GetEventRecord(PyObject *v, EventRecord *e) { ! return PyArg_Parse(v, "(Hll(hh)H)", &e->what, &e->message, --- 416,420 ---- PyMac_GetEventRecord(PyObject *v, EventRecord *e) { ! return PyArg_Parse(v, "(HKK(hh)H)", &e->what, &e->message, *************** *** 472,476 **** return 1; } ! return PyArg_Parse(v, "(ll)", &rv->hi, &rv->lo); } --- 472,476 ---- return 1; } ! return PyArg_Parse(v, "(KK)", &rv->hi, &rv->lo); } From jackjansen@users.sourceforge.net Thu Apr 17 21:40:40 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 17 Apr 2003 13:40:40 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules Nav.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16980/Mac/Modules Modified Files: Nav.c Log Message: Converted manually written code to the new K format specifier. Untested, but at least it still compiles. Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Nav.c 7 Mar 2003 15:37:31 -0000 1.24 --- Nav.c 17 Apr 2003 20:40:06 -0000 1.25 *************** *** 168,175 **** *defaultLocationP = defaultLocation_storage; } else if( strcmp(keystr, "version") == 0 ) { ! if ( !PyArg_Parse(value, "h", &opt->version) ) return 0; } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) { ! if ( !PyArg_Parse(value, "l", &opt->dialogOptionFlags) ) return 0; } else if( strcmp(keystr, "location") == 0 ) { --- 168,175 ---- *defaultLocationP = defaultLocation_storage; } else if( strcmp(keystr, "version") == 0 ) { ! if ( !PyArg_Parse(value, "H", &opt->version) ) return 0; } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) { ! if ( !PyArg_Parse(value, "K", &opt->dialogOptionFlags) ) return 0; } else if( strcmp(keystr, "location") == 0 ) { *************** *** 248,252 **** OSErr err; ! if (!PyArg_ParseTuple(args, "l", &howToTranslate)) return NULL; err = NavTranslateFile(&self->itself, howToTranslate); --- 248,252 ---- OSErr err; ! if (!PyArg_ParseTuple(args, "K", &howToTranslate)) return NULL; err = NavTranslateFile(&self->itself, howToTranslate); *************** *** 269,273 **** OSErr err; ! if (!PyArg_ParseTuple(args, "l", &howToTranslate)) return NULL; err = NavCompleteSave(&self->itself, howToTranslate); --- 269,273 ---- OSErr err; ! if (!PyArg_ParseTuple(args, "K", &howToTranslate)) return NULL; err = NavCompleteSave(&self->itself, howToTranslate); *************** *** 529,533 **** if ( kw && PyObject_IsTrue(kw) ) { ! if (!PyArg_ParseTuple(args, "l", &action)) return NULL; dict = kw; --- 529,533 ---- if ( kw && PyObject_IsTrue(kw) ) { ! if (!PyArg_ParseTuple(args, "K", &action)) return NULL; dict = kw; From jackjansen@users.sourceforge.net Thu Apr 17 21:44:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 17 Apr 2003 13:44:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules Nav.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18669/Mac/Modules Modified Files: Nav.c Log Message: Oops, 'k' is the new format code for un unchecked 32 bit quantity, not 'K'. Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Nav.c 17 Apr 2003 20:40:06 -0000 1.25 --- Nav.c 17 Apr 2003 20:44:21 -0000 1.26 *************** *** 171,175 **** return 0; } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) { ! if ( !PyArg_Parse(value, "K", &opt->dialogOptionFlags) ) return 0; } else if( strcmp(keystr, "location") == 0 ) { --- 171,175 ---- return 0; } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) { ! if ( !PyArg_Parse(value, "k", &opt->dialogOptionFlags) ) return 0; } else if( strcmp(keystr, "location") == 0 ) { *************** *** 248,252 **** OSErr err; ! if (!PyArg_ParseTuple(args, "K", &howToTranslate)) return NULL; err = NavTranslateFile(&self->itself, howToTranslate); --- 248,252 ---- OSErr err; ! if (!PyArg_ParseTuple(args, "k", &howToTranslate)) return NULL; err = NavTranslateFile(&self->itself, howToTranslate); *************** *** 269,273 **** OSErr err; ! if (!PyArg_ParseTuple(args, "K", &howToTranslate)) return NULL; err = NavCompleteSave(&self->itself, howToTranslate); --- 269,273 ---- OSErr err; ! if (!PyArg_ParseTuple(args, "k", &howToTranslate)) return NULL; err = NavCompleteSave(&self->itself, howToTranslate); *************** *** 529,533 **** if ( kw && PyObject_IsTrue(kw) ) { ! if (!PyArg_ParseTuple(args, "K", &action)) return NULL; dict = kw; --- 529,533 ---- if ( kw && PyObject_IsTrue(kw) ) { ! if (!PyArg_ParseTuple(args, "k", &action)) return NULL; dict = kw; From jackjansen@users.sourceforge.net Thu Apr 17 21:44:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 17 Apr 2003 13:44:55 -0700 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv18669/Python Modified Files: mactoolboxglue.c Log Message: Oops, 'k' is the new format code for un unchecked 32 bit quantity, not 'K'. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mactoolboxglue.c 17 Apr 2003 20:40:05 -0000 1.18 --- mactoolboxglue.c 17 Apr 2003 20:44:18 -0000 1.19 *************** *** 416,420 **** PyMac_GetEventRecord(PyObject *v, EventRecord *e) { ! return PyArg_Parse(v, "(HKK(hh)H)", &e->what, &e->message, --- 416,420 ---- PyMac_GetEventRecord(PyObject *v, EventRecord *e) { ! return PyArg_Parse(v, "(Hkk(hh)H)", &e->what, &e->message, *************** *** 472,476 **** return 1; } ! return PyArg_Parse(v, "(KK)", &rv->hi, &rv->lo); } --- 472,476 ---- return 1; } ! return PyArg_Parse(v, "(kk)", &rv->hi, &rv->lo); } From niemeyer@users.sourceforge.net Thu Apr 17 22:31:37 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu, 17 Apr 2003 14:31:37 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.730,1.731 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1866/Misc Modified Files: NEWS Log Message: Implemented posix-mode parsing support in shlex.py, as dicussed in mailing list, and in patch #722686. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.730 retrieving revision 1.731 diff -C2 -d -r1.730 -r1.731 *** NEWS 17 Apr 2003 17:29:18 -0000 1.730 --- NEWS 17 Apr 2003 21:31:33 -0000 1.731 *************** *** 156,159 **** --- 156,163 ---- - New csv package makes it easy to read/write CSV files. + - Module shlex has been extended to allow posix-like shell parsings, + including a split() function for easy spliting of quoted strings and + commands. An iterator interface was also implemented. + Tools/Demos ----------- From niemeyer@users.sourceforge.net Thu Apr 17 22:31:35 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu, 17 Apr 2003 14:31:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_shlex.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1866/Lib/test Added Files: test_shlex.py Log Message: Implemented posix-mode parsing support in shlex.py, as dicussed in mailing list, and in patch #722686. --- NEW FILE: test_shlex.py --- # -*- coding: iso-8859-1 -*- import unittest import os, sys import shlex try: from cStringIO import StringIO except ImportError: from StringIO import StringIO # The original test data set was from shellwords, by Hartmut Goebel. data = r"""x|x| foo bar|foo|bar| foo bar|foo|bar| foo bar |foo|bar| foo bar bla fasel|foo|bar|bla|fasel| x y z xxxx|x|y|z|xxxx| \x bar|\|x|bar| \ x bar|\|x|bar| \ bar|\|bar| foo \x bar|foo|\|x|bar| foo \ x bar|foo|\|x|bar| foo \ bar|foo|\|bar| foo "bar" bla|foo|"bar"|bla| "foo" "bar" "bla"|"foo"|"bar"|"bla"| "foo" bar "bla"|"foo"|bar|"bla"| "foo" bar bla|"foo"|bar|bla| foo 'bar' bla|foo|'bar'|bla| 'foo' 'bar' 'bla'|'foo'|'bar'|'bla'| 'foo' bar 'bla'|'foo'|bar|'bla'| 'foo' bar bla|'foo'|bar|bla| blurb foo"bar"bar"fasel" baz|blurb|foo"bar"bar"fasel"|baz| blurb foo'bar'bar'fasel' baz|blurb|foo'bar'bar'fasel'|baz| ""|""| ''|''| foo "" bar|foo|""|bar| foo '' bar|foo|''|bar| foo "" "" "" bar|foo|""|""|""|bar| foo '' '' '' bar|foo|''|''|''|bar| \""|\|""| "\"|"\"| "foo\ bar"|"foo\ bar"| "foo\\ bar"|"foo\\ bar"| "foo\\ bar\"|"foo\\ bar\"| "foo\\" bar\""|"foo\\"|bar|\|""| "foo\\ bar\" dfadf"|"foo\\ bar\"|dfadf"| "foo\\\ bar\" dfadf"|"foo\\\ bar\"|dfadf"| "foo\\\x bar\" dfadf"|"foo\\\x bar\"|dfadf"| "foo\x bar\" dfadf"|"foo\x bar\"|dfadf"| \''|\|''| 'foo\ bar'|'foo\ bar'| 'foo\\ bar'|'foo\\ bar'| "foo\\\x bar\" df'a\ 'df'|"foo\\\x bar\"|df'a|\|'df'| \"foo"|\|"foo"| \"foo"\x|\|"foo"|\|x| "foo\x"|"foo\x"| "foo\ "|"foo\ "| foo\ xx|foo|\|xx| foo\ x\x|foo|\|x|\|x| foo\ x\x\""|foo|\|x|\|x|\|""| "foo\ x\x"|"foo\ x\x"| "foo\ x\x\\"|"foo\ x\x\\"| "foo\ x\x\\""foobar"|"foo\ x\x\\"|"foobar"| "foo\ x\x\\"\''"foobar"|"foo\ x\x\\"|\|''|"foobar"| "foo\ x\x\\"\'"fo'obar"|"foo\ x\x\\"|\|'"fo'|obar"| "foo\ x\x\\"\'"fo'obar" 'don'\''t'|"foo\ x\x\\"|\|'"fo'|obar"|'don'|\|''|t'| 'foo\ bar'|'foo\ bar'| 'foo\\ bar'|'foo\\ bar'| foo\ bar|foo|\|bar| foo#bar\nbaz|foobaz| :-) ;-)|:|-|)|;|-|)| áéíóú|á|é|í|ó|ú| """ posix_data = r"""x|x| foo bar|foo|bar| foo bar|foo|bar| foo bar |foo|bar| foo bar bla fasel|foo|bar|bla|fasel| x y z xxxx|x|y|z|xxxx| \x bar|x|bar| \ x bar| x|bar| \ bar| bar| foo \x bar|foo|x|bar| foo \ x bar|foo| x|bar| foo \ bar|foo| bar| foo "bar" bla|foo|bar|bla| "foo" "bar" "bla"|foo|bar|bla| "foo" bar "bla"|foo|bar|bla| "foo" bar bla|foo|bar|bla| foo 'bar' bla|foo|bar|bla| 'foo' 'bar' 'bla'|foo|bar|bla| 'foo' bar 'bla'|foo|bar|bla| 'foo' bar bla|foo|bar|bla| blurb foo"bar"bar"fasel" baz|blurb|foobarbarfasel|baz| blurb foo'bar'bar'fasel' baz|blurb|foobarbarfasel|baz| ""|| ''|| foo "" bar|foo||bar| foo '' bar|foo||bar| foo "" "" "" bar|foo||||bar| foo '' '' '' bar|foo||||bar| \"|"| "\""|"| "foo\ bar"|foo\ bar| "foo\\ bar"|foo\ bar| "foo\\ bar\""|foo\ bar"| "foo\\" bar\"|foo\|bar"| "foo\\ bar\" dfadf"|foo\ bar" dfadf| "foo\\\ bar\" dfadf"|foo\\ bar" dfadf| "foo\\\x bar\" dfadf"|foo\\x bar" dfadf| "foo\x bar\" dfadf"|foo\x bar" dfadf| \'|'| 'foo\ bar'|foo\ bar| 'foo\\ bar'|foo\\ bar| "foo\\\x bar\" df'a\ 'df"|foo\\x bar" df'a\ 'df| \"foo|"foo| \"foo\x|"foox| "foo\x"|foo\x| "foo\ "|foo\ | foo\ xx|foo xx| foo\ x\x|foo xx| foo\ x\x\"|foo xx"| "foo\ x\x"|foo\ x\x| "foo\ x\x\\"|foo\ x\x\| "foo\ x\x\\""foobar"|foo\ x\x\foobar| "foo\ x\x\\"\'"foobar"|foo\ x\x\'foobar| "foo\ x\x\\"\'"fo'obar"|foo\ x\x\'fo'obar| "foo\ x\x\\"\'"fo'obar" 'don'\''t'|foo\ x\x\'fo'obar|don't| "foo\ x\x\\"\'"fo'obar" 'don'\''t' \\|foo\ x\x\'fo'obar|don't|\| 'foo\ bar'|foo\ bar| 'foo\\ bar'|foo\\ bar| foo\ bar|foo bar| foo#bar\nbaz|foo|baz| :-) ;-)|:-)|;-)| áéíóú|áéíóú| """ class ShlexTest(unittest.TestCase): def setUp(self): self.data = [x.split("|")[:-1] for x in data.splitlines()] self.posix_data = [x.split("|")[:-1] for x in posix_data.splitlines()] for item in self.data: item[0] = item[0].replace(r"\n", "\n") for item in self.posix_data: item[0] = item[0].replace(r"\n", "\n") def splitTest(self, data, posix, spaces): for i in range(len(data)): l = shlex.split(data[i][0], posix=posix, spaces=spaces) self.assertEqual(l, data[i][1:], "%s: %s != %s" % (data[i][0], l, data[i][1:])) def oldSplit(self, s): ret = [] lex = shlex.shlex(StringIO(s)) tok = lex.get_token() while tok: ret.append(tok) tok = lex.get_token() return ret def testSplit(self): """Test data splitting with non-posix parser""" self.splitTest(self.data, posix=0, spaces=0) def testSplitPosix(self): """Test data splitting with posix parser""" self.splitTest(self.posix_data, posix=1, spaces=1) def testCompat(self): """Test compatibility interface""" for i in range(len(self.data)): l = self.oldSplit(self.data[i][0]) self.assertEqual(l, self.data[i][1:], "%s: %s != %s" % (self.data[i][0], l, self.data[i][1:])) # Allow this test to be used with old shlex.py if not getattr(shlex, "split", None): for methname in dir(ShlexTest): if methname.startswith("test") and methname != "testCompat": delattr(ShlexTest, methname) if __name__ == "__main__": unittest.main() From niemeyer@users.sourceforge.net Thu Apr 17 22:32:01 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu, 17 Apr 2003 14:32:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1866/Doc/lib Modified Files: libshlex.tex Log Message: Implemented posix-mode parsing support in shlex.py, as dicussed in mailing list, and in patch #722686. Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libshlex.tex 9 May 2001 15:50:17 -0000 1.12 --- libshlex.tex 17 Apr 2003 21:31:28 -0000 1.13 *************** *** 5,9 **** --- 5,11 ---- \modulesynopsis{Simple lexical analysis for \UNIX\ shell-like languages.} \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} + \moduleauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} + \sectionauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \versionadded{1.5.2} *************** *** 11,28 **** The \class{shlex} class makes it easy to write lexical analyzers for simple syntaxes resembling that of the \UNIX{} shell. This will often ! be useful for writing minilanguages, e.g.\ in run control files for ! Python applications. ! ! \begin{classdesc}{shlex}{\optional{stream\optional{, file}}} ! A \class{shlex} instance or subclass instance is a lexical analyzer ! object. The initialization argument, if present, specifies where to ! read characters from. It must be a file- or stream-like object with ! \method{read()} and \method{readline()} methods. If no argument is given, ! input will be taken from \code{sys.stdin}. The second optional ! argument is a filename string, which sets the initial value of the ! \member{infile} member. If the stream argument is omitted or ! equal to \code{sys.stdin}, this second argument defaults to ``stdin''. ! \end{classdesc} ! \begin{seealso} --- 13,18 ---- The \class{shlex} class makes it easy to write lexical analyzers for simple syntaxes resembling that of the \UNIX{} shell. This will often ! be useful for writing minilanguages, (e.g. in run control files for ! Python applications) or for parsing quoted strings. \begin{seealso} *************** *** 32,45 **** \subsection{shlex Objects \label{shlex-objects}} A \class{shlex} instance has the following methods: - \begin{methoddesc}{get_token}{} Return a token. If tokens have been stacked using \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate ! end-of-file, an empty string is returned. \end{methoddesc} --- 22,69 ---- + \subsection{Module Contents} + + The \module{shlex} module defines the following functions: + + \begin{funcdesc}{split}{s\optional{, posix=\code{True}\optional{, + spaces=\code{True}}}} + Split the string \var{s} using shell-like syntax. If \code{posix} is + \code{True}, operate in posix mode. If \code{spaces} is \code{True}, it + will only split words in whitespaces (setting the + \member{whitespace_split} member of the \class{shlex} instance). + \versionadded{2.3} + \end{funcdesc} + + The \module{shlex} module defines the following classes: + + \begin{classdesc}{shlex}{\optional{instream=\code{sys.stdin}\optional{, + infile=\code{None}\optional{, + posix=\code{False}}}}} + A \class{shlex} instance or subclass instance is a lexical analyzer + object. The initialization argument, if present, specifies where to + read characters from. It must be a file-/stream-like object with + \method{read()} and \method{readline()} methods, or a string (strings + are accepted since Python 2.3). If no argument is given, input will be + taken from \code{sys.stdin}. The second optional argument is a filename + string, which sets the initial value of the \member{infile} member. If + the \var{instream} argument is omitted or equal to \code{sys.stdin}, + this second argument defaults to ``stdin''. The \var{posix} argument + was introduced in Python 2.3, and defines the operational mode. When + \var{posix} is not true (default), the \class{shlex} instance will + operate in compatibility mode. When operating in posix mode, + \class{shlex} will try to be as close as possible to the posix shell + parsing rules. See~\ref{shlex-objects}. + \end{classdesc} + \subsection{shlex Objects \label{shlex-objects}} A \class{shlex} instance has the following methods: \begin{methoddesc}{get_token}{} Return a token. If tokens have been stacked using \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate ! end-of-file, \member{self.eof} is returned (the empty string (\code{""}) ! in non-posix mode, and \code{None} in posix mode). \end{methoddesc} *************** *** 133,136 **** --- 157,166 ---- \end{memberdesc} + \begin{memberdesc}{escape} + Characters that will be considered as escape. This will be only used + in posix mode, and includes just \character{\textbackslash} by default. + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}{quotes} Characters that will be considered string quotes. The token *************** *** 140,143 **** --- 170,187 ---- \end{memberdesc} + \begin{memberdesc}{escapedquotes} + Characters in \member{quotes} that will interpret escape characters + defined in \member{escape}. This is only used in posix mode, and includes + just \character{"} by default. + \versionadded{2.3} + \end{memberdesc} + + \begin{memberdesc}{whitespace_split} + If true, tokens will only be split in whitespaces. This is useful, for + example, for parsing command lines with \class{shlex}, getting tokens + in a similar way to shell arguments. + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}{infile} The name of the current input file, as initially set at class *************** *** 169,179 **** \end{memberdesc} - Note that any character not declared to be a word character, - whitespace, or a quote will be returned as a single-character token. - - Quote and comment characters are not recognized within words. Thus, - the bare words \samp{ain't} and \samp{ain\#t} would be returned as single - tokens by the default parser. - \begin{memberdesc}{lineno} Source line number (count of newlines seen so far plus one). --- 213,216 ---- *************** *** 184,185 **** --- 221,275 ---- exceptions. \end{memberdesc} + + \begin{memberdesc}{eof} + Token used to determine end of file. This will be set to the empty + string (\code{""}), in non-posix mode, and to \code{None} in posix + mode. + \versionadded{2.3} + \end{memberdesc} + + \subsection{Parsing Rules\label{shlex-parsing-rules}} + + When operating in non-posix mode, \class{shlex} with try to obey to the + following rules. + + \begin{itemize} + \item Quote characters are not recognized within words + (\code{Do"Not"Separate} is parsed as the single word + \code{Do"Not"Separate}); + \item Escape characters are not recognized; + \item Enclosing characters in quotes preserve the literal value of + all characters within the quotes; + \item Closing quotes separate words (\code{"Do"Separate} is parsed + as \code{"Do"} and \code{Separate}); + \item If \member{whitespace_split} is \code{False}, any character not + declared to be a word character, whitespace, or a quote will be + returned as a single-character token. If it is \code{True}, + \class{shlex} will only split words in whitespaces; + \item EOF is signaled with an empty string (\code{""}); + \item It's not possible to parse empty strings, even if quoted. + \end{itemize} + + When operating in posix mode, \class{shlex} will try to obey to the + following parsing rules. + + \begin{itemize} + \item Quotes are stripped out, and do not separate words + (\code{"Do"Not"Separate"} is parsed as the single word + \code{DoNotSeparate}); + \item Non-quoted escape characters (e.g. \character{\textbackslash}) + preserve the literal value of the next character that follows; + \item Enclosing characters in quotes which are not part of + \member{escapedquotes} (e.g. \character{'}) preserve the literal + value of all characters within the quotes; + \item Enclosing characters in quotes which are part of + \member{escapedquotes} (e.g. \character{"}) preserves the literal + value of all characters within the quotes, with the exception of + the characters mentioned in \member{escape}. The escape characters + retain its special meaning only when followed by the quote in use, + or the escape character itself. Otherwise the escape character + will be considered a normal character. + \item EOF is signaled with a \code{None} value; + \item Quoted empty strings (\code{""}) are allowed; + \end{itemize} + From niemeyer@users.sourceforge.net Thu Apr 17 22:32:04 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu, 17 Apr 2003 14:32:04 -0700 Subject: [Python-checkins] python/dist/src/Lib shlex.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1866/Lib Modified Files: shlex.py Log Message: Implemented posix-mode parsing support in shlex.py, as dicussed in mailing list, and in patch #722686. Index: shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shlex.py 2 Jun 2002 00:40:05 -0000 1.17 --- shlex.py 17 Apr 2003 21:31:29 -0000 1.18 *************** *** 1,2 **** --- 1,3 ---- + # -*- coding: iso-8859-1 -*- """A lexical analyzer class for simple shell-like syntaxes.""" *************** *** 4,16 **** # Input stacking and error message cleanup added by ESR, March 2000 # push_source() and pop_source() made explicit by ESR, January 2001. import os.path import sys ! __all__ = ["shlex"] class shlex: "A lexical analyzer class for simple shell-like syntaxes." ! def __init__(self, instream=None, infile=None): if instream is not None: self.instream = instream --- 5,28 ---- # Input stacking and error message cleanup added by ESR, March 2000 # push_source() and pop_source() made explicit by ESR, January 2001. + # Posix compliance, split(), string arguments, and + # iterator interface by Gustavo Niemeyer, April 2003. import os.path import sys ! from types import StringTypes ! ! try: ! from cStringIO import StringIO ! except ImportError: ! from StringIO import StringIO ! ! __all__ = ["shlex", "split"] class shlex: "A lexical analyzer class for simple shell-like syntaxes." ! def __init__(self, instream=None, infile=None, posix=0): ! if type(instream) in StringTypes: ! instream = StringIO(instream) if instream is not None: self.instream = instream *************** *** 19,27 **** --- 31,50 ---- self.instream = sys.stdin self.infile = None + self.posix = posix + if posix: + self.eof = None + else: + self.eof = '' self.commenters = '#' self.wordchars = ('abcdfeghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_') + if self.posix: + self.wordchars += ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ' + 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ') self.whitespace = ' \t\r\n' + self.whitespace_split = 0 self.quotes = '\'"' + self.escape = '\\' + self.escapedquotes = '"' self.state = ' ' self.pushback = [] *************** *** 43,46 **** --- 66,71 ---- def push_source(self, newstream, newfile=None): "Push an input source onto the lexer's input source stack." + if type(newstream) in StringTypes: + newstream = StringIO(newstream) self.filestack.insert(0, (self.infile, self.instream, self.lineno)) self.infile = newfile *************** *** 74,93 **** raw = self.read_token() # Handle inclusions ! while raw == self.source: ! spec = self.sourcehook(self.read_token()) ! if spec: ! (newfile, newstream) = spec ! self.push_source(newstream, newfile) ! raw = self.get_token() # Maybe we got EOF instead? ! while raw == "": if len(self.filestack) == 0: ! return "" else: self.pop_source() raw = self.get_token() ! # Neither inclusion nor EOF if self.debug >= 1: ! if raw: print "shlex: token=" + `raw` else: --- 99,119 ---- raw = self.read_token() # Handle inclusions ! if self.source is not None: ! while raw == self.source: ! spec = self.sourcehook(self.read_token()) ! if spec: ! (newfile, newstream) = spec ! self.push_source(newstream, newfile) ! raw = self.get_token() # Maybe we got EOF instead? ! while raw == self.eof: if len(self.filestack) == 0: ! return self.eof else: self.pop_source() raw = self.get_token() ! # Neither inclusion nor EOF if self.debug >= 1: ! if raw != self.eof: print "shlex: token=" + `raw` else: *************** *** 96,100 **** def read_token(self): ! "Read a token from the input stream (no pushback or inclusions)" while 1: nextchar = self.instream.read(1) --- 122,127 ---- def read_token(self): ! quoted = 0 ! escapedstate = ' ' while 1: nextchar = self.instream.read(1) *************** *** 114,118 **** if self.debug >= 2: print "shlex: I see whitespace in whitespace state" ! if self.token: break # emit current token else: --- 141,145 ---- if self.debug >= 2: print "shlex: I see whitespace in whitespace state" ! if self.token or (self.posix and quoted): break # emit current token else: *************** *** 121,146 **** self.instream.readline() self.lineno = self.lineno + 1 elif nextchar in self.wordchars: self.token = nextchar self.state = 'a' elif nextchar in self.quotes: ! self.token = nextchar self.state = nextchar else: self.token = nextchar ! if self.token: break # emit current token else: continue elif self.state in self.quotes: ! self.token = self.token + nextchar ! if nextchar == self.state: ! self.state = ' ' ! break ! elif not nextchar: # end of file if self.debug >= 2: print "shlex: I see EOF in quotes state" # XXX what error should be raised here? raise ValueError, "No closing quotation" elif self.state == 'a': if not nextchar: --- 148,203 ---- self.instream.readline() self.lineno = self.lineno + 1 + elif self.posix and nextchar in self.escape: + escapedstate = 'a' + self.state = nextchar elif nextchar in self.wordchars: self.token = nextchar self.state = 'a' elif nextchar in self.quotes: ! if not self.posix: ! self.token = nextchar self.state = nextchar + elif self.whitespace_split: + self.token = nextchar + self.state = 'a' else: self.token = nextchar ! if self.token or (self.posix and quoted): break # emit current token else: continue elif self.state in self.quotes: ! quoted = 1 ! if not nextchar: # end of file if self.debug >= 2: print "shlex: I see EOF in quotes state" # XXX what error should be raised here? raise ValueError, "No closing quotation" + if nextchar == self.state: + if not self.posix: + self.token = self.token + nextchar + self.state = ' ' + break + else: + self.state = 'a' + elif self.posix and nextchar in self.escape and \ + self.state in self.escapedquotes: + escapedstate = self.state + self.state = nextchar + else: + self.token = self.token + nextchar + elif self.state in self.escape: + if not nextchar: # end of file + if self.debug >= 2: + print "shlex: I see EOF in escape state" + # XXX what error should be raised here? + raise ValueError, "No escaped character" + # In posix shells, only the quote itself or the escape + # character may be escaped within quotes. + if escapedstate in self.quotes and \ + nextchar != self.state and nextchar != escapedstate: + self.token = self.token + self.state + self.token = self.token + nextchar + self.state = escapedstate elif self.state == 'a': if not nextchar: *************** *** 151,155 **** print "shlex: I see whitespace in word state" self.state = ' ' ! if self.token: break # emit current token else: --- 208,212 ---- print "shlex: I see whitespace in word state" self.state = ' ' ! if self.token or (self.posix and quoted): break # emit current token else: *************** *** 158,162 **** self.instream.readline() self.lineno = self.lineno + 1 ! elif nextchar in self.wordchars or nextchar in self.quotes: self.token = self.token + nextchar else: --- 215,231 ---- self.instream.readline() self.lineno = self.lineno + 1 ! if self.posix: ! self.state = ' ' ! if self.token or (self.posix and quoted): ! break # emit current token ! else: ! continue ! elif self.posix and nextchar in self.quotes: ! self.state = nextchar ! elif self.posix and nextchar in self.escape: ! escapedstate = 'a' ! self.state = nextchar ! elif nextchar in self.wordchars or nextchar in self.quotes \ ! or self.whitespace_split: self.token = self.token + nextchar else: *************** *** 171,174 **** --- 240,245 ---- result = self.token self.token = '' + if self.posix and not quoted and result == '': + result = None if self.debug > 1: if result: *************** *** 183,187 **** newfile = newfile[1:-1] # This implements cpp-like semantics for relative-path inclusion. ! if type(self.infile) == type("") and not os.path.isabs(newfile): newfile = os.path.join(os.path.dirname(self.infile), newfile) return (newfile, open(newfile, "r")) --- 254,258 ---- newfile = newfile[1:-1] # This implements cpp-like semantics for relative-path inclusion. ! if type(self.infile) in StringTypes and not os.path.isabs(newfile): newfile = os.path.join(os.path.dirname(self.infile), newfile) return (newfile, open(newfile, "r")) *************** *** 195,198 **** --- 266,282 ---- return "\"%s\", line %d: " % (infile, lineno) + def __iter__(self): + return self + + def next(self): + token = self.get_token() + if token == self.eof: + raise StopIteration + return token + + def split(s, posix=1, spaces=1): + lex = shlex(s, posix=posix) + lex.whitespace_split = spaces + return list(lex) if __name__ == '__main__': From fdrake@users.sourceforge.net Thu Apr 17 22:49:06 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 17 Apr 2003 14:49:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10732 Modified Files: libshlex.tex Log Message: markup banalities Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libshlex.tex 17 Apr 2003 21:31:28 -0000 1.13 --- libshlex.tex 17 Apr 2003 21:49:04 -0000 1.14 *************** *** 28,33 **** \begin{funcdesc}{split}{s\optional{, posix=\code{True}\optional{, spaces=\code{True}}}} ! Split the string \var{s} using shell-like syntax. If \code{posix} is ! \code{True}, operate in posix mode. If \code{spaces} is \code{True}, it will only split words in whitespaces (setting the \member{whitespace_split} member of the \class{shlex} instance). --- 28,33 ---- \begin{funcdesc}{split}{s\optional{, posix=\code{True}\optional{, spaces=\code{True}}}} ! Split the string \var{s} using shell-like syntax. If \var{posix} is ! \code{True}, operate in \POSIX{} mode. If \var{spaces} is \code{True}, it will only split words in whitespaces (setting the \member{whitespace_split} member of the \class{shlex} instance). *************** *** 49,57 **** the \var{instream} argument is omitted or equal to \code{sys.stdin}, this second argument defaults to ``stdin''. The \var{posix} argument ! was introduced in Python 2.3, and defines the operational mode. When \var{posix} is not true (default), the \class{shlex} instance will ! operate in compatibility mode. When operating in posix mode, ! \class{shlex} will try to be as close as possible to the posix shell ! parsing rules. See~\ref{shlex-objects}. \end{classdesc} --- 49,57 ---- the \var{instream} argument is omitted or equal to \code{sys.stdin}, this second argument defaults to ``stdin''. The \var{posix} argument ! was introduced in Python 2.3, and defines the operational mode. When \var{posix} is not true (default), the \class{shlex} instance will ! operate in compatibility mode. When operating in \POSIX{} mode, ! \class{shlex} will try to be as close as possible to the \POSIX{} shell ! parsing rules. See~\ref{shlex-objects}. \end{classdesc} *************** *** 64,69 **** \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate ! end-of-file, \member{self.eof} is returned (the empty string (\code{""}) ! in non-posix mode, and \code{None} in posix mode). \end{methoddesc} --- 64,69 ---- \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate ! end-of-file, \member{self.eof} is returned (the empty string (\code{''}) ! in non-\POSIX{} mode, and \code{None} in \POSIX{} mode). \end{methoddesc} *************** *** 159,163 **** \begin{memberdesc}{escape} Characters that will be considered as escape. This will be only used ! in posix mode, and includes just \character{\textbackslash} by default. \versionadded{2.3} \end{memberdesc} --- 159,163 ---- \begin{memberdesc}{escape} Characters that will be considered as escape. This will be only used ! in \POSIX{} mode, and includes just \character{\textbackslash} by default. \versionadded{2.3} \end{memberdesc} *************** *** 172,177 **** \begin{memberdesc}{escapedquotes} Characters in \member{quotes} that will interpret escape characters ! defined in \member{escape}. This is only used in posix mode, and includes ! just \character{"} by default. \versionadded{2.3} \end{memberdesc} --- 172,177 ---- \begin{memberdesc}{escapedquotes} Characters in \member{quotes} that will interpret escape characters ! defined in \member{escape}. This is only used in \POSIX{} mode, and ! includes just \character{"} by default. \versionadded{2.3} \end{memberdesc} *************** *** 224,229 **** \begin{memberdesc}{eof} Token used to determine end of file. This will be set to the empty ! string (\code{""}), in non-posix mode, and to \code{None} in posix ! mode. \versionadded{2.3} \end{memberdesc} --- 224,229 ---- \begin{memberdesc}{eof} Token used to determine end of file. This will be set to the empty ! string (\code{''}), in non-\POSIX{} mode, and to \code{None} in ! \POSIX{} mode. \versionadded{2.3} \end{memberdesc} *************** *** 231,236 **** \subsection{Parsing Rules\label{shlex-parsing-rules}} ! When operating in non-posix mode, \class{shlex} with try to obey to the ! following rules. \begin{itemize} --- 231,236 ---- \subsection{Parsing Rules\label{shlex-parsing-rules}} ! When operating in non-\POSIX{} mode, \class{shlex} will try to obey to ! the following rules. \begin{itemize} *************** *** 247,255 **** returned as a single-character token. If it is \code{True}, \class{shlex} will only split words in whitespaces; ! \item EOF is signaled with an empty string (\code{""}); \item It's not possible to parse empty strings, even if quoted. \end{itemize} ! When operating in posix mode, \class{shlex} will try to obey to the following parsing rules. --- 247,255 ---- returned as a single-character token. If it is \code{True}, \class{shlex} will only split words in whitespaces; ! \item EOF is signaled with an empty string (\code{''}); \item It's not possible to parse empty strings, even if quoted. \end{itemize} ! When operating in \POSIX{} mode, \class{shlex} will try to obey to the following parsing rules. *************** *** 271,275 **** will be considered a normal character. \item EOF is signaled with a \code{None} value; ! \item Quoted empty strings (\code{""}) are allowed; \end{itemize} --- 271,275 ---- will be considered a normal character. \item EOF is signaled with a \code{None} value; ! \item Quoted empty strings (\code{''}) are allowed; \end{itemize} From jackjansen@users.sourceforge.net Thu Apr 17 23:01:16 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 17 Apr 2003 15:01:16 -0700 Subject: [Python-checkins] python/dist/src/Python modsupport.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv16068 Modified Files: modsupport.c Log Message: dded missing k and K format specifiers to Py_BuildValue and friends. Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** modsupport.c 29 Mar 2003 10:04:55 -0000 2.66 --- modsupport.c 17 Apr 2003 22:01:10 -0000 2.67 *************** *** 290,296 **** --- 290,302 ---- return PyInt_FromLong((long)va_arg(*p_va, long)); + case 'k': + return PyInt_FromLong((long)va_arg(*p_va, unsigned long)); + #ifdef HAVE_LONG_LONG case 'L': return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG)); + + case 'K': + return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG)); #endif #ifdef Py_USING_UNICODE From fdrake@users.sourceforge.net Thu Apr 17 23:01:23 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 17 Apr 2003 15:01:23 -0700 Subject: [Python-checkins] python/dist/src/Lib shlex.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16227 Modified Files: shlex.py Log Message: - use Tue/False for booleans - some very minor cleanups Index: shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shlex.py 17 Apr 2003 21:31:29 -0000 1.18 --- shlex.py 17 Apr 2003 22:01:17 -0000 1.19 *************** *** 22,26 **** class shlex: "A lexical analyzer class for simple shell-like syntaxes." ! def __init__(self, instream=None, infile=None, posix=0): if type(instream) in StringTypes: instream = StringIO(instream) --- 22,26 ---- class shlex: "A lexical analyzer class for simple shell-like syntaxes." ! def __init__(self, instream=None, infile=None, posix=False): if type(instream) in StringTypes: instream = StringIO(instream) *************** *** 43,47 **** 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ') self.whitespace = ' \t\r\n' ! self.whitespace_split = 0 self.quotes = '\'"' self.escape = '\\' --- 43,47 ---- 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ') self.whitespace = ' \t\r\n' ! self.whitespace_split = False self.quotes = '\'"' self.escape = '\\' *************** *** 62,66 **** if self.debug >= 1: print "shlex: pushing token " + `tok` ! self.pushback = [tok] + self.pushback def push_source(self, newstream, newfile=None): --- 62,66 ---- if self.debug >= 1: print "shlex: pushing token " + `tok` ! self.pushback.insert(0, tok) def push_source(self, newstream, newfile=None): *************** *** 91,96 **** "Get a token from the input stream (or from stack if it's nonempty)" if self.pushback: ! tok = self.pushback[0] ! self.pushback = self.pushback[1:] if self.debug >= 1: print "shlex: popping token " + `tok` --- 91,95 ---- "Get a token from the input stream (or from stack if it's nonempty)" if self.pushback: ! tok = self.pushback.pop(0) if self.debug >= 1: print "shlex: popping token " + `tok` *************** *** 108,112 **** # Maybe we got EOF instead? while raw == self.eof: ! if len(self.filestack) == 0: return self.eof else: --- 107,111 ---- # Maybe we got EOF instead? while raw == self.eof: ! if not self.filestack: return self.eof else: *************** *** 122,126 **** def read_token(self): ! quoted = 0 escapedstate = ' ' while 1: --- 121,125 ---- def read_token(self): ! quoted = False escapedstate = ' ' while 1: *************** *** 168,172 **** continue elif self.state in self.quotes: ! quoted = 1 if not nextchar: # end of file if self.debug >= 2: --- 167,171 ---- continue elif self.state in self.quotes: ! quoted = True if not nextchar: # end of file if self.debug >= 2: *************** *** 230,234 **** self.token = self.token + nextchar else: ! self.pushback = [nextchar] + self.pushback if self.debug >= 2: print "shlex: I see punctuation in word state" --- 229,233 ---- self.token = self.token + nextchar else: ! self.pushback.insert(0, nextchar) if self.debug >= 2: print "shlex: I see punctuation in word state" From fdrake@users.sourceforge.net Thu Apr 17 23:19:29 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 17 Apr 2003 15:19:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_htmlparser.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22425 Modified Files: test_htmlparser.py Log Message: Add test that demonstrates SGML-style handling of processing instructions. Index: test_htmlparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmlparser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_htmlparser.py 14 Mar 2003 16:21:56 -0000 1.10 --- test_htmlparser.py 17 Apr 2003 22:19:26 -0000 1.11 *************** *** 102,105 **** --- 102,108 ---- ("pi", "processing instruction"), ]) + self._run_check("", [ + ("pi", "processing instruction ?"), + ]) def test_simple_html(self): From nnorwitz@users.sourceforge.net Thu Apr 17 23:23:39 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 17 Apr 2003 15:23:39 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv23434 Modified Files: setup.py Log Message: SF Feature #: 719429, Get the SSL module to build on RedHat 9. krb5.h is in it's own directory Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** setup.py 3 Apr 2003 04:49:11 -0000 1.159 --- setup.py 17 Apr 2003 22:23:36 -0000 1.160 *************** *** 444,447 **** --- 444,451 ---- ] ) + krb5_h = find_file('krb5.h', inc_dirs, + ['/usr/kerberos/include']) + if krb5_h: + ssl_incs += krb5_h ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, ['/usr/local/ssl/lib', From fdrake@users.sourceforge.net Thu Apr 17 23:36:55 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 17 Apr 2003 15:36:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30148 Modified Files: libhtmlparser.tex Log Message: Added documentation for the handle_pi() method, based on SF patch #662464. Closes SF bug #659188, patch #662464. Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libhtmlparser.tex 5 Jul 2001 16:34:36 -0000 1.2 --- libhtmlparser.tex 17 Apr 2003 22:36:52 -0000 1.3 *************** *** 124,129 **** \end{methoddesc} ! \subsection{Example HTML Parser \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the --- 124,143 ---- \end{methoddesc} + \begin{methoddesc}{handle_pi}{data} + Method called when a processing instruction is encountered. The + \var{data} parameter will contain the entire processing instruction. + For example, for the processing instruction \code{}, + this method would be called as \code{handle_pi("proc color='red'")}. It + is intended to be overridden by a derived class; the base class + implementation does nothing. ! \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instruction. An XHTML processing instruction using the ! trailing \character{?} will cause the \character{?} to be included in ! \var{data}.} ! \end{methoddesc} ! ! ! \subsection{Example HTML Parser Application \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the From fdrake@users.sourceforge.net Thu Apr 17 23:37:52 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 17 Apr 2003 15:37:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex,1.2,1.2.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30447 Modified Files: Tag: release22-maint libhtmlparser.tex Log Message: Added documentation for the handle_pi() method, based on SF patch #662464. Closes SF bug #659188, patch #662464. Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.2 retrieving revision 1.2.18.1 diff -C2 -d -r1.2 -r1.2.18.1 *** libhtmlparser.tex 5 Jul 2001 16:34:36 -0000 1.2 --- libhtmlparser.tex 17 Apr 2003 22:37:50 -0000 1.2.18.1 *************** *** 124,129 **** \end{methoddesc} ! \subsection{Example HTML Parser \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the --- 124,143 ---- \end{methoddesc} + \begin{methoddesc}{handle_pi}{data} + Method called when a processing instruction is encountered. The + \var{data} parameter will contain the entire processing instruction. + For example, for the processing instruction \code{}, + this method would be called as \code{handle_pi("proc color='red'")}. It + is intended to be overridden by a derived class; the base class + implementation does nothing. ! \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instruction. An XHTML processing instruction using the ! trailing \character{?} will cause the \character{?} to be included in ! \var{data}.} ! \end{methoddesc} ! ! ! \subsection{Example HTML Parser Application \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the From nnorwitz@users.sourceforge.net Fri Apr 18 00:04:26 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 17 Apr 2003 16:04:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_shlex.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7229/Lib/test Modified Files: test_shlex.py Log Message: Get test to work under regrtest when running whole suite Index: test_shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shlex.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_shlex.py 17 Apr 2003 21:31:32 -0000 1.1 --- test_shlex.py 17 Apr 2003 23:04:22 -0000 1.2 *************** *** 4,7 **** --- 4,9 ---- import shlex + from test import test_support + try: from cStringIO import StringIO *************** *** 188,191 **** delattr(ShlexTest, methname) if __name__ == "__main__": ! unittest.main() --- 190,196 ---- delattr(ShlexTest, methname) + def test_main(): + test_support.run_unittest(ShlexTest) + if __name__ == "__main__": ! test_main() From nnorwitz@users.sourceforge.net Fri Apr 18 00:07:16 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 17 Apr 2003 16:07:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8510/Doc/lib Modified Files: libstring.tex Log Message: Oops, missed updating doc to correct version for split Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** libstring.tex 10 Apr 2003 22:35:29 -0000 1.49 --- libstring.tex 17 Apr 2003 23:07:13 -0000 1.50 *************** *** 265,269 **** the both ends of the string this method is called on. \versionchanged[The \var{chars} parameter was added. The \var{chars} ! parameter cannot be passed in 2.2 or 2.2.1]{2.2.2} \end{funcdesc} --- 265,269 ---- the both ends of the string this method is called on. \versionchanged[The \var{chars} parameter was added. The \var{chars} ! parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} From neal@metaslash.com Fri Apr 18 00:04:38 2003 From: neal@metaslash.com (Neal Norwitz) Date: Thu, 17 Apr 2003 19:04:38 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_shlex.py,NONE,1.1 In-Reply-To: References: Message-ID: <20030417230438.GC28630@epoch.metaslash.com> On Thu, Apr 17, 2003 at 02:31:35PM -0700, niemeyer@users.sourceforge.net wrote: > > Added Files: > test_shlex.py > Log Message: > Implemented posix-mode parsing support in shlex.py, as dicussed in > mailing list, and in patch #722686. [...] > if __name__ == "__main__": > unittest.main() Note: This does not get run under regrtest.py. I've checked in a change so that this works when running the whole suite. Neal From nnorwitz@users.sourceforge.net Fri Apr 18 00:09:10 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 17 Apr 2003 16:09:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8654/Doc/lib Modified Files: libshlex.tex Log Message: Use True in a few more places. Use isinstance(somestring, basestring) instead of type() as per PEP 8 Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libshlex.tex 17 Apr 2003 21:49:04 -0000 1.14 --- libshlex.tex 17 Apr 2003 23:09:04 -0000 1.15 *************** *** 178,182 **** \begin{memberdesc}{whitespace_split} ! If true, tokens will only be split in whitespaces. This is useful, for example, for parsing command lines with \class{shlex}, getting tokens in a similar way to shell arguments. --- 178,182 ---- \begin{memberdesc}{whitespace_split} ! If \code{True}, tokens will only be split in whitespaces. This is useful, for example, for parsing command lines with \class{shlex}, getting tokens in a similar way to shell arguments. From nnorwitz@users.sourceforge.net Fri Apr 18 00:09:10 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 17 Apr 2003 16:09:10 -0700 Subject: [Python-checkins] python/dist/src/Lib shlex.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8654/Lib Modified Files: shlex.py Log Message: Use True in a few more places. Use isinstance(somestring, basestring) instead of type() as per PEP 8 Index: shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shlex.py 17 Apr 2003 22:01:17 -0000 1.19 --- shlex.py 17 Apr 2003 23:09:08 -0000 1.20 *************** *** 11,16 **** import sys - from types import StringTypes - try: from cStringIO import StringIO --- 11,14 ---- *************** *** 23,27 **** "A lexical analyzer class for simple shell-like syntaxes." def __init__(self, instream=None, infile=None, posix=False): ! if type(instream) in StringTypes: instream = StringIO(instream) if instream is not None: --- 21,25 ---- "A lexical analyzer class for simple shell-like syntaxes." def __init__(self, instream=None, infile=None, posix=False): ! if isinstance(instream, basestring): instream = StringIO(instream) if instream is not None: *************** *** 66,70 **** def push_source(self, newstream, newfile=None): "Push an input source onto the lexer's input source stack." ! if type(newstream) in StringTypes: newstream = StringIO(newstream) self.filestack.insert(0, (self.infile, self.instream, self.lineno)) --- 64,68 ---- def push_source(self, newstream, newfile=None): "Push an input source onto the lexer's input source stack." ! if isinstance(newstream, basestring): newstream = StringIO(newstream) self.filestack.insert(0, (self.infile, self.instream, self.lineno)) *************** *** 123,127 **** quoted = False escapedstate = ' ' ! while 1: nextchar = self.instream.read(1) if nextchar == '\n': --- 121,125 ---- quoted = False escapedstate = ' ' ! while True: nextchar = self.instream.read(1) if nextchar == '\n': *************** *** 253,257 **** newfile = newfile[1:-1] # This implements cpp-like semantics for relative-path inclusion. ! if type(self.infile) in StringTypes and not os.path.isabs(newfile): newfile = os.path.join(os.path.dirname(self.infile), newfile) return (newfile, open(newfile, "r")) --- 251,255 ---- newfile = newfile[1:-1] # This implements cpp-like semantics for relative-path inclusion. ! if isinstance(self.infile, basestring) and not os.path.isabs(newfile): newfile = os.path.join(os.path.dirname(self.infile), newfile) return (newfile, open(newfile, "r")) *************** *** 274,278 **** return token ! def split(s, posix=1, spaces=1): lex = shlex(s, posix=posix) lex.whitespace_split = spaces --- 272,276 ---- return token ! def split(s, posix=True, spaces=True): lex = shlex(s, posix=posix) lex.whitespace_split = spaces From gvanrossum@users.sourceforge.net Fri Apr 18 01:12:32 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 17:12:32 -0700 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.98,2.99 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv31308 Modified Files: getargs.c Log Message: Roll back changes to 'h' format code -- too much breaks. Other changes stay. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.98 retrieving revision 2.99 diff -C2 -d -r2.98 -r2.99 *** getargs.c 17 Apr 2003 18:55:45 -0000 2.98 --- getargs.c 18 Apr 2003 00:12:30 -0000 2.99 *************** *** 457,461 **** } ! case 'h': {/* unsigned short int */ short *p = va_arg(*p_va, short *); long ival; --- 457,461 ---- } ! case 'h': {/* signed short int */ short *p = va_arg(*p_va, short *); long ival; *************** *** 465,476 **** if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); ! else if (ival < 0) { PyErr_SetString(PyExc_OverflowError, ! "unsigned short integer is less than minimum"); return converterr("integer", arg, msgbuf, bufsize); } ! else if (ival > USHRT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "unsigned short integer is greater than maximum"); return converterr("integer", arg, msgbuf, bufsize); } --- 465,476 ---- if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); ! else if (ival < SHRT_MIN) { PyErr_SetString(PyExc_OverflowError, ! "signed short integer is less than minimum"); return converterr("integer", arg, msgbuf, bufsize); } ! else if (ival > SHRT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "signed short integer is greater than maximum"); return converterr("integer", arg, msgbuf, bufsize); } From gvanrossum@users.sourceforge.net Fri Apr 18 01:13:56 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 17 Apr 2003 17:13:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_getargs2.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31653 Modified Files: test_getargs2.py Log Message: Delete the 'h' test -- 'h' is no longer unsigned so the machinery here can't test it. It's unchanged so why would we test it anyway... Index: test_getargs2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_getargs2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_getargs2.py 17 Apr 2003 18:55:18 -0000 1.1 --- test_getargs2.py 18 Apr 2003 00:13:53 -0000 1.2 *************** *** 13,17 **** > > b unsigned char 0..UCHAR_MAX ! > h unsigned short 0..USHRT_MAX > B unsigned char none ** > H unsigned short none ** --- 13,17 ---- > > b unsigned char 0..UCHAR_MAX ! > h signed short SHRT_MIN..SHRT_MAX > B unsigned char none ** > H unsigned short none ** *************** *** 80,98 **** self.failUnlessEqual(42, ul_convert("b", 42L)) self.assertRaises(OverflowError, ul_convert, "b", VERY_LARGE) - - def test_h(self): - # h returns 'unsigned short', and does range checking (0 ... USHRT_MAX) - self.failUnlessEqual(3, ul_convert("h", 3.14)) - self.failUnlessEqual(99, ul_convert("h", Long())) - self.failUnlessEqual(99, ul_convert("h", Int())) - - self.assertRaises(OverflowError, ul_convert, "h", -1) - self.failUnlessEqual(0, ul_convert("h", 0)) - self.failUnlessEqual(USHRT_MAX, ul_convert("h", USHRT_MAX)) - self.assertRaises(OverflowError, ul_convert, "h", USHRT_MAX+1) - - self.failUnlessEqual(42, ul_convert("h", 42)) - self.failUnlessEqual(42, ul_convert("h", 42L)) - self.assertRaises(OverflowError, ul_convert, "h", VERY_LARGE) def test_B(self): --- 80,83 ---- From tim_one@users.sourceforge.net Fri Apr 18 01:46:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 17:46:01 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.208,2.209 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8410/python/Objects Modified Files: object.c Log Message: _Py_PrintReferenceAddresses(): also print the type name. In real use I'm finding some pretty baffling output, like reprs consisting entirely of three left parens. At least this will let us know what type the object is (it's not str -- there's no quote character in the repr). New tool combinerefs.py, to combine the two output blocks produced via PYTHONDUMPREFS. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.208 retrieving revision 2.209 diff -C2 -d -r2.208 -r2.209 *** object.c 17 Apr 2003 19:52:28 -0000 2.208 --- object.c 18 Apr 2003 00:45:58 -0000 2.209 *************** *** 2048,2052 **** fprintf(fp, "Remaining object addresses:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) ! fprintf(fp, "%p [%d]\n", op, op->ob_refcnt); } --- 2048,2053 ---- fprintf(fp, "Remaining object addresses:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) ! fprintf(fp, "%p [%d] %s\n", op, op->ob_refcnt, ! op->ob_type->tp_name); } From tim_one@users.sourceforge.net Fri Apr 18 01:46:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 17:46:01 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.731,1.732 SpecialBuilds.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv8410/python/Misc Modified Files: NEWS SpecialBuilds.txt Log Message: _Py_PrintReferenceAddresses(): also print the type name. In real use I'm finding some pretty baffling output, like reprs consisting entirely of three left parens. At least this will let us know what type the object is (it's not str -- there's no quote character in the repr). New tool combinerefs.py, to combine the two output blocks produced via PYTHONDUMPREFS. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.731 retrieving revision 1.732 diff -C2 -d -r1.731 -r1.732 *** NEWS 17 Apr 2003 21:31:33 -0000 1.731 --- NEWS 18 Apr 2003 00:45:58 -0000 1.732 *************** *** 163,166 **** --- 163,169 ---- ----------- + - New script combinerefs.py helps analyze new PYTHONDUMPREFS output. + See the module docstring for details. + TBD Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SpecialBuilds.txt 23 Mar 2003 02:51:01 -0000 1.14 --- SpecialBuilds.txt 18 Apr 2003 00:45:58 -0000 1.15 *************** *** 63,67 **** envar PYTHONDUMPREFS If this envar exists, Py_Finalize() arranges to print a list of ! all still-live heap objects. --------------------------------------------------------------------------- PYMALLOC_DEBUG introduced in 2.3 --- 63,76 ---- envar PYTHONDUMPREFS If this envar exists, Py_Finalize() arranges to print a list of ! all still-live heap objects. This is printed twice, in different ! formats, before and after Py_Finalize has cleaned up everything it ! can clean up. The first output block produces the repr() of each ! object so is more informative; however, a lot of stuff destined to ! die is still alive then. The second output block is much harder ! to work with (repr() can't be invoked anymore -- the interpreter ! has been torn down too far), but doesn't list any objects that will ! die. The tool script combinerefs.py can be run over this to combine ! the info from both output blocks. The second output block, and ! combinerefs.py, were new in Python 2.3b1. --------------------------------------------------------------------------- PYMALLOC_DEBUG introduced in 2.3 From tim_one@users.sourceforge.net Fri Apr 18 01:46:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 17:46:01 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts combinerefs.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv8410/python/Tools/scripts Added Files: combinerefs.py Log Message: _Py_PrintReferenceAddresses(): also print the type name. In real use I'm finding some pretty baffling output, like reprs consisting entirely of three left parens. At least this will let us know what type the object is (it's not str -- there's no quote character in the repr). New tool combinerefs.py, to combine the two output blocks produced via PYTHONDUMPREFS. --- NEW FILE: combinerefs.py --- #! /usr/bin/env python """ combinerefs path A helper for analyzing PYTHONDUMPREFS output. When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown time Py_Finalize() prints the list of all live objects twice: first it prints the repr() of each object while the interpreter is still fully intact. After cleaning up everything it can, it prints all remaining live objects again, but the second time just prints their addresses, refcounts, and type names. Save all this output into a file, then run this script passing the path to that file. The script finds both output chunks, combines them, then prints a line of output for each object still alive at the end: address refcnt typename repr address is the address of the object, in whatever format the platform C produces for a %p format code. refcnt is of the form "[" ref "]" when the object's refcount is the same in both PYTHONDUMPREFS output blocks, or "[" ref_before "->" ref_after "]" if the refcount changed. typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS output block. repr is repr(object), extracted from the first PYTHONDUMPREFS output block. The objects are listed in allocation order, with most-recently allocated printed first, and the first object allocated printed last. Simple examples: 00857060 [14] str '__len__' The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS output blocks said there were 14 references to it. This is probably due to C modules that intern the string "__len__" and keep a reference to it in a file static. 00857038 [46->5] tuple () 46-5 = 41 references to the empty tuple were removed by the cleanup actions between the times PYTHONDUMPREFS produced output. 00858028 [1025->1456] str '' The string '', which is used in dictobject.c as the name of the dummy key that overwrites a real key that gets deleted, actually grew several hundred references during cleanup. It suggests that stuff did get removed from dicts by cleanup, but that the dicts themselves are staying alive for some reason. """ import re import sys # Generate lines from fileiter. If whilematch is true, continue reading # while the regexp object pat matches line. If whilematch is false, lines # are read so long as pat doesn't match them. In any case, the first line # that doesn't match pat (when whilematch is true), or that does match pat # (when whilematch is false), is lost, and fileiter will resume at the line # following it. def read(fileiter, pat, whilematch): result = [] for line in fileiter: if bool(pat.match(line)) == whilematch: result.append(line) else: break return result def combine(fname): f = file(fname) fi = iter(f) for line in read(fi, re.compile(r'^Remaining objects:$'), False): pass crack = re.compile(r'([a-zA-Z\d]+) \[(\d+)\] (.*)') addr2rc = {} addr2guts = {} before = 0 for line in read(fi, re.compile(r'^Remaining object addresses:$'), False): m = crack.match(line) if m: addr, addr2rc[addr], addr2guts[addr] = m.groups() before += 1 else: print '??? skipped:', line after = 0 for line in read(fi, crack, True): after += 1 m = crack.match(line) assert m addr, rc, guts = m.groups() # guts is type name here if addr not in addr2rc: print '??? new object created while tearing down:', line continue print addr, if rc == addr2rc[addr]: print '[%s]' % rc, else: print '[%s->%s]' % (addr2rc[addr], rc), print guts, addr2guts[addr] f.close() print "%d objects before, %d after" % (before, after) if __name__ == '__main__': combine(sys.argv[1]) From tim_one@users.sourceforge.net Fri Apr 18 02:02:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 17 Apr 2003 18:02:41 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts combinerefs.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv14422/Tools/scripts Modified Files: combinerefs.py Log Message: Heh -- I checked in an old version of this, at a time I documented the internal read() as being a generator but hadn't yet changed it into one. Index: combinerefs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/combinerefs.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** combinerefs.py 18 Apr 2003 00:45:59 -0000 1.1 --- combinerefs.py 18 Apr 2003 01:02:37 -0000 1.2 *************** *** 75,85 **** # following it. def read(fileiter, pat, whilematch): - result = [] for line in fileiter: if bool(pat.match(line)) == whilematch: ! result.append(line) else: break - return result def combine(fname): --- 75,83 ---- # following it. def read(fileiter, pat, whilematch): for line in fileiter: if bool(pat.match(line)) == whilematch: ! yield line else: break def combine(fname): From niemeyer@conectiva.com Fri Apr 18 02:55:02 2003 From: niemeyer@conectiva.com (Gustavo Niemeyer) Date: Thu, 17 Apr 2003 22:55:02 -0300 Subject: [Python-checkins] python/dist/src/Lib/test test_shlex.py,NONE,1.1 In-Reply-To: <20030417230438.GC28630@epoch.metaslash.com> References: <20030417230438.GC28630@epoch.metaslash.com> Message-ID: <20030418015502.GC24245@localhost.distro.conectiva> > > Added Files: > > test_shlex.py > > Log Message: > > Implemented posix-mode parsing support in shlex.py, as dicussed in > > mailing list, and in patch #722686. > [...] > > if __name__ == "__main__": > > unittest.main() > > Note: This does not get run under regrtest.py. I've checked in > a change so that this works when running the whole suite. Oops.. Thanks! -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ] From jackjansen@users.sourceforge.net Fri Apr 18 09:59:03 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:03 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenType.py,1.11,1.11.4.1 macsupport.py,1.29,1.29.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Tools/bgen/bgen Modified Files: Tag: getargs_mask_mods bgenType.py macsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: bgenType.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenType.py,v retrieving revision 1.11 retrieving revision 1.11.4.1 diff -C2 -d -r1.11 -r1.11.4.1 *** bgenType.py 24 Jan 2003 09:23:13 -0000 1.11 --- bgenType.py 18 Apr 2003 08:58:30 -0000 1.11.4.1 *************** *** 140,148 **** void = None char = Type("char", "c") ! short = Type("short", "h") unsigned_short = Type("unsigned short", "H") int = Type("int", "i") long = Type("long", "l") ! unsigned_long = Type("unsigned long", "l") float = Type("float", "f") double = Type("double", "d") --- 140,148 ---- void = None char = Type("char", "c") ! short = Type("short", "H") unsigned_short = Type("unsigned short", "H") int = Type("int", "i") long = Type("long", "l") ! unsigned_long = Type("unsigned long", "k") float = Type("float", "f") double = Type("double", "d") Index: macsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/macsupport.py,v retrieving revision 1.29 retrieving revision 1.29.4.1 diff -C2 -d -r1.29 -r1.29.4.1 *** macsupport.py 19 Jan 2003 21:53:57 -0000 1.29 --- macsupport.py 18 Apr 2003 08:58:30 -0000 1.29.4.1 *************** *** 12,36 **** # Simple types Boolean = Type("Boolean", "b") ! SignedByte = Type("SignedByte", "b") Size = Type("Size", "l") ! Style = Type("Style", "b") ! StyleParameter = Type("StyleParameter", "h") ! CharParameter = Type("CharParameter", "h") ! TextEncoding = Type("TextEncoding", "l") ! ByteCount = Type("ByteCount", "l") ! Duration = Type("Duration", "l") ! ByteOffset = Type("ByteOffset", "l") ! OptionBits = Type("OptionBits", "l") ! ItemCount = Type("ItemCount", "l") ! PBVersion = Type("PBVersion", "l") ! ScriptCode = Type("ScriptCode", "h") ! LangCode = Type("LangCode", "h") ! RegionCode = Type("RegionCode", "h") UInt8 = Type("UInt8", "b") ! SInt8 = Type("SInt8", "b") UInt16 = Type("UInt16", "H") ! SInt16 = Type("SInt16", "h") ! UInt32 = Type("UInt32", "l") SInt32 = Type("SInt32", "l") Float32 = Type("Float32", "f") --- 12,36 ---- # Simple types Boolean = Type("Boolean", "b") ! SignedByte = Type("SignedByte", "B") Size = Type("Size", "l") ! Style = Type("Style", "B") ! StyleParameter = Type("StyleParameter", "H") ! CharParameter = Type("CharParameter", "H") ! TextEncoding = Type("TextEncoding", "k") ! ByteCount = Type("ByteCount", "k") ! Duration = Type("Duration", "k") ! ByteOffset = Type("ByteOffset", "k") ! OptionBits = Type("OptionBits", "k") ! ItemCount = Type("ItemCount", "k") ! PBVersion = Type("PBVersion", "k") ! ScriptCode = Type("ScriptCode", "H") ! LangCode = Type("LangCode", "H") ! RegionCode = Type("RegionCode", "H") UInt8 = Type("UInt8", "b") ! SInt8 = Type("SInt8", "B") UInt16 = Type("UInt16", "H") ! SInt16 = Type("SInt16", "H") ! UInt32 = Type("UInt32", "k") SInt32 = Type("SInt32", "l") Float32 = Type("Float32", "f") *************** *** 108,113 **** Output("if (%s != noErr) return PyMac_Error(%s);", name, name) self.used = 1 ! OSErr = OSErrType("OSErr", 'h') ! OSStatus = OSErrType("OSStatus", 'l') --- 108,113 ---- Output("if (%s != noErr) return PyMac_Error(%s);", name, name) self.used = 1 ! OSErr = OSErrType("OSErr", 'H') ! OSStatus = OSErrType("OSStatus", 'k') From jackjansen@users.sourceforge.net Fri Apr 18 09:59:04 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ae _AEmodule.c,1.19,1.19.4.1 aesupport.py,1.30,1.30.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/ae Modified Files: Tag: getargs_mask_mods _AEmodule.c aesupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _AEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/_AEmodule.c,v retrieving revision 1.19 retrieving revision 1.19.4.1 diff -C2 -d -r1.19 -r1.19.4.1 *** _AEmodule.c 17 Jan 2003 23:11:17 -0000 1.19 --- _AEmodule.c 18 Apr 2003 08:58:31 -0000 1.19.4.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 636,640 **** PyMac_PRECHECK(AESend); #endif ! if (!PyArg_ParseTuple(_args, "lhl", &sendMode, &sendPriority, --- 636,640 ---- PyMac_PRECHECK(AESend); #endif ! if (!PyArg_ParseTuple(_args, "khl", &sendMode, &sendPriority, *************** *** 751,755 **** PyMac_PRECHECK(AEResolve); #endif ! if (!PyArg_ParseTuple(_args, "h", &callbackFlags)) return NULL; --- 751,755 ---- PyMac_PRECHECK(AEResolve); #endif ! if (!PyArg_ParseTuple(_args, "H", &callbackFlags)) return NULL; *************** *** 1039,1043 **** PyMac_PRECHECK(AECreateAppleEvent); #endif ! if (!PyArg_ParseTuple(_args, "O&O&O&hl", PyMac_GetOSType, &theAEEventClass, PyMac_GetOSType, &theAEEventID, --- 1039,1043 ---- PyMac_PRECHECK(AECreateAppleEvent); #endif ! if (!PyArg_ParseTuple(_args, "O&O&O&hk", PyMac_GetOSType, &theAEEventClass, PyMac_GetOSType, &theAEEventID, Index: aesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aesupport.py,v retrieving revision 1.30 retrieving revision 1.30.4.1 diff -C2 -d -r1.30 -r1.30.4.1 *** aesupport.py 17 Jan 2003 23:11:17 -0000 1.30 --- aesupport.py 18 Apr 2003 08:58:31 -0000 1.30.4.1 *************** *** 9,17 **** AEArrayType = Type("AEArrayType", "c") ! AESendMode = Type("AESendMode", "l") AESendPriority = Type("AESendPriority", "h") AEInteractAllowed = Type("AEInteractAllowed", "b") AEReturnID = Type("AEReturnID", "h") ! AETransactionID = Type("AETransactionID", "l") --- 9,17 ---- AEArrayType = Type("AEArrayType", "c") ! AESendMode = Type("AESendMode", "k") AESendPriority = Type("AESendPriority", "h") AEInteractAllowed = Type("AEInteractAllowed", "b") AEReturnID = Type("AEReturnID", "h") ! AETransactionID = Type("AETransactionID", "k") From jackjansen@users.sourceforge.net Fri Apr 18 09:59:04 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ah _AHmodule.c,1.2,1.2.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ah In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/ah Modified Files: Tag: getargs_mask_mods _AHmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _AHmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ah/_AHmodule.c,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** _AHmodule.c 30 Aug 2002 23:02:09 -0000 1.2 --- _AHmodule.c 18 Apr 2003 08:58:32 -0000 1.2.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) From jackjansen@users.sourceforge.net Fri Apr 18 09:59:05 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/app _Appmodule.c,1.17,1.17.6.1 appsupport.py,1.17,1.17.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/app Modified Files: Tag: getargs_mask_mods _Appmodule.c appsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Appmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -C2 -d -r1.17 -r1.17.6.1 *** _Appmodule.c 23 Dec 2002 23:16:20 -0000 1.17 --- _Appmodule.c 18 Apr 2003 08:58:33 -0000 1.17.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 86,90 **** _rv = SetThemeDrawingState(_self->ob_itself, inDisposeNow); ! _res = Py_BuildValue("l", _rv); return _res; --- 86,90 ---- _rv = SetThemeDrawingState(_self->ob_itself, inDisposeNow); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 101,105 **** return NULL; _rv = DisposeThemeDrawingState(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 101,105 ---- return NULL; _rv = DisposeThemeDrawingState(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 230,234 **** PyMac_PRECHECK(SetThemePen); #endif ! if (!PyArg_ParseTuple(_args, "hhb", &inBrush, &inDepth, --- 230,234 ---- PyMac_PRECHECK(SetThemePen); #endif ! if (!PyArg_ParseTuple(_args, "hHb", &inBrush, &inDepth, *************** *** 254,258 **** PyMac_PRECHECK(SetThemeBackground); #endif ! if (!PyArg_ParseTuple(_args, "hhb", &inBrush, &inDepth, --- 254,258 ---- PyMac_PRECHECK(SetThemeBackground); #endif ! if (!PyArg_ParseTuple(_args, "hHb", &inBrush, &inDepth, *************** *** 278,282 **** PyMac_PRECHECK(SetThemeTextColor); #endif ! if (!PyArg_ParseTuple(_args, "hhb", &inColor, &inDepth, --- 278,282 ---- PyMac_PRECHECK(SetThemeTextColor); #endif ! if (!PyArg_ParseTuple(_args, "hHb", &inColor, &inDepth, *************** *** 325,329 **** PyMac_PRECHECK(DrawThemeWindowHeader); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 325,329 ---- PyMac_PRECHECK(DrawThemeWindowHeader); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 346,350 **** PyMac_PRECHECK(DrawThemeWindowListViewHeader); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 346,350 ---- PyMac_PRECHECK(DrawThemeWindowListViewHeader); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 367,371 **** PyMac_PRECHECK(DrawThemePlacard); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 367,371 ---- PyMac_PRECHECK(DrawThemePlacard); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 388,392 **** PyMac_PRECHECK(DrawThemeEditTextFrame); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 388,392 ---- PyMac_PRECHECK(DrawThemeEditTextFrame); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 409,413 **** PyMac_PRECHECK(DrawThemeListBoxFrame); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 409,413 ---- PyMac_PRECHECK(DrawThemeListBoxFrame); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 451,455 **** PyMac_PRECHECK(DrawThemePrimaryGroup); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 451,455 ---- PyMac_PRECHECK(DrawThemePrimaryGroup); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 472,476 **** PyMac_PRECHECK(DrawThemeSecondaryGroup); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 472,476 ---- PyMac_PRECHECK(DrawThemeSecondaryGroup); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 493,497 **** PyMac_PRECHECK(DrawThemeSeparator); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 493,497 ---- PyMac_PRECHECK(DrawThemeSeparator); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 514,518 **** PyMac_PRECHECK(DrawThemeModelessDialogFrame); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 514,518 ---- PyMac_PRECHECK(DrawThemeModelessDialogFrame); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 536,540 **** PyMac_PRECHECK(DrawThemeGenericWell); #endif ! if (!PyArg_ParseTuple(_args, "O&lb", PyMac_GetRect, &inRect, &inState, --- 536,540 ---- PyMac_PRECHECK(DrawThemeGenericWell); #endif ! if (!PyArg_ParseTuple(_args, "O&kb", PyMac_GetRect, &inRect, &inState, *************** *** 578,582 **** PyMac_PRECHECK(IsThemeInColor); #endif ! if (!PyArg_ParseTuple(_args, "hb", &inDepth, &inIsColorDevice)) --- 578,582 ---- PyMac_PRECHECK(IsThemeInColor); #endif ! if (!PyArg_ParseTuple(_args, "Hb", &inDepth, &inIsColorDevice)) *************** *** 616,620 **** PyMac_PRECHECK(DrawThemeMenuBarBackground); #endif ! if (!PyArg_ParseTuple(_args, "O&Hl", PyMac_GetRect, &inBounds, &inState, --- 616,620 ---- PyMac_PRECHECK(DrawThemeMenuBarBackground); #endif ! if (!PyArg_ParseTuple(_args, "O&Hk", PyMac_GetRect, &inBounds, &inState, *************** *** 642,646 **** _err = GetThemeMenuBarHeight(&outHeight); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", outHeight); return _res; --- 642,646 ---- _err = GetThemeMenuBarHeight(&outHeight); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", outHeight); return _res; *************** *** 720,724 **** _err = GetThemeMenuSeparatorHeight(&outHeight); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", outHeight); return _res; --- 720,724 ---- _err = GetThemeMenuSeparatorHeight(&outHeight); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", outHeight); return _res; *************** *** 742,746 **** &outWidth); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("hh", outHeight, outWidth); --- 742,746 ---- &outWidth); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("HH", outHeight, outWidth); *************** *** 763,767 **** inIsSquished); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", outWidth); return _res; --- 763,767 ---- inIsSquished); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", outWidth); return _res; *************** *** 777,781 **** PyMac_PRECHECK(DrawThemeTabPane); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &inRect, &inState)) --- 777,781 ---- PyMac_PRECHECK(DrawThemeTabPane); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &inRect, &inState)) *************** *** 822,826 **** PyMac_PRECHECK(SetThemeCursor); #endif ! if (!PyArg_ParseTuple(_args, "l", &inCursor)) return NULL; --- 822,826 ---- PyMac_PRECHECK(SetThemeCursor); #endif ! if (!PyArg_ParseTuple(_args, "k", &inCursor)) return NULL; *************** *** 841,845 **** PyMac_PRECHECK(SetAnimatedThemeCursor); #endif ! if (!PyArg_ParseTuple(_args, "ll", &inCursor, &inAnimationStep)) --- 841,845 ---- PyMac_PRECHECK(SetAnimatedThemeCursor); #endif ! if (!PyArg_ParseTuple(_args, "kk", &inCursor, &inAnimationStep)) *************** *** 913,917 **** PyMac_PRECHECK(UseThemeFont); #endif ! if (!PyArg_ParseTuple(_args, "Hh", &inFontID, &inScript)) --- 913,917 ---- PyMac_PRECHECK(UseThemeFont); #endif ! if (!PyArg_ParseTuple(_args, "HH", &inFontID, &inScript)) *************** *** 938,942 **** PyMac_PRECHECK(DrawThemeTextBox); #endif ! if (!PyArg_ParseTuple(_args, "O&HlbO&h", CFStringRefObj_Convert, &inString, &inFontID, --- 938,942 ---- PyMac_PRECHECK(DrawThemeTextBox); #endif ! if (!PyArg_ParseTuple(_args, "O&HkbO&H", CFStringRefObj_Convert, &inString, &inFontID, *************** *** 972,976 **** PyMac_PRECHECK(TruncateThemeText); #endif ! if (!PyArg_ParseTuple(_args, "O&Hlhh", CFMutableStringRefObj_Convert, &inString, &inFontID, --- 972,976 ---- PyMac_PRECHECK(TruncateThemeText); #endif ! if (!PyArg_ParseTuple(_args, "O&HkHh", CFMutableStringRefObj_Convert, &inString, &inFontID, *************** *** 1004,1008 **** PyMac_PRECHECK(GetThemeTextDimensions); #endif ! if (!PyArg_ParseTuple(_args, "O&HlbO&", CFStringRefObj_Convert, &inString, &inFontID, --- 1004,1008 ---- PyMac_PRECHECK(GetThemeTextDimensions); #endif ! if (!PyArg_ParseTuple(_args, "O&HkbO&", CFStringRefObj_Convert, &inString, &inFontID, *************** *** 1018,1022 **** &outBaseline); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&h", PyMac_BuildPoint, ioBounds, outBaseline); --- 1018,1022 ---- &outBaseline); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&H", PyMac_BuildPoint, ioBounds, outBaseline); *************** *** 1034,1038 **** PyMac_PRECHECK(GetThemeTextShadowOutset); #endif ! if (!PyArg_ParseTuple(_args, "Hl", &inFontID, &inState)) --- 1034,1038 ---- PyMac_PRECHECK(GetThemeTextShadowOutset); #endif ! if (!PyArg_ParseTuple(_args, "Hk", &inFontID, &inState)) *************** *** 1151,1155 **** PyMac_PRECHECK(DrawThemeScrollBarDelimiters); #endif ! if (!PyArg_ParseTuple(_args, "HO&ll", &flavor, PyMac_GetRect, &inContRect, --- 1151,1155 ---- PyMac_PRECHECK(DrawThemeScrollBarDelimiters); #endif ! if (!PyArg_ParseTuple(_args, "HO&kk", &flavor, PyMac_GetRect, &inContRect, *************** *** 1179,1183 **** PyMac_PRECHECK(DrawThemeButton); #endif ! if (!PyArg_ParseTuple(_args, "O&HO&O&l", PyMac_GetRect, &inBounds, &inKind, --- 1179,1183 ---- PyMac_PRECHECK(DrawThemeButton); #endif ! if (!PyArg_ParseTuple(_args, "O&HO&O&k", PyMac_GetRect, &inBounds, &inKind, *************** *** 1337,1341 **** PyMac_PRECHECK(DrawThemeTickMark); #endif ! if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetRect, &bounds, &state)) --- 1337,1341 ---- PyMac_PRECHECK(DrawThemeTickMark); #endif ! if (!PyArg_ParseTuple(_args, "O&k", PyMac_GetRect, &bounds, &state)) *************** *** 1360,1364 **** PyMac_PRECHECK(DrawThemeChasingArrows); #endif ! if (!PyArg_ParseTuple(_args, "O&lll", PyMac_GetRect, &bounds, &index, --- 1360,1364 ---- PyMac_PRECHECK(DrawThemeChasingArrows); #endif ! if (!PyArg_ParseTuple(_args, "O&kkk", PyMac_GetRect, &bounds, &index, *************** *** 1389,1393 **** PyMac_PRECHECK(DrawThemePopupArrow); #endif ! if (!PyArg_ParseTuple(_args, "O&HHll", PyMac_GetRect, &bounds, &orientation, --- 1389,1393 ---- PyMac_PRECHECK(DrawThemePopupArrow); #endif ! if (!PyArg_ParseTuple(_args, "O&HHkk", PyMac_GetRect, &bounds, &orientation, *************** *** 1419,1423 **** PyMac_PRECHECK(DrawThemeStandaloneGrowBox); #endif ! if (!PyArg_ParseTuple(_args, "O&Hbl", PyMac_GetPoint, &origin, &growDirection, --- 1419,1423 ---- PyMac_PRECHECK(DrawThemeStandaloneGrowBox); #endif ! if (!PyArg_ParseTuple(_args, "O&Hbk", PyMac_GetPoint, &origin, &growDirection, *************** *** 1446,1450 **** PyMac_PRECHECK(DrawThemeStandaloneNoGrowBox); #endif ! if (!PyArg_ParseTuple(_args, "O&Hbl", PyMac_GetPoint, &origin, &growDirection, --- 1446,1450 ---- PyMac_PRECHECK(DrawThemeStandaloneNoGrowBox); #endif ! if (!PyArg_ParseTuple(_args, "O&Hbk", PyMac_GetPoint, &origin, &growDirection, *************** *** 1533,1537 **** PyMac_PRECHECK(ApplyThemeBackground); #endif ! if (!PyArg_ParseTuple(_args, "lO&lhb", &inKind, PyMac_GetRect, &bounds, --- 1533,1537 ---- PyMac_PRECHECK(ApplyThemeBackground); #endif ! if (!PyArg_ParseTuple(_args, "kO&kHb", &inKind, PyMac_GetRect, &bounds, *************** *** 1562,1566 **** PyMac_PRECHECK(SetThemeTextColorForWindow); #endif ! if (!PyArg_ParseTuple(_args, "O&bhb", WinObj_Convert, &window, &isActive, --- 1562,1566 ---- PyMac_PRECHECK(SetThemeTextColorForWindow); #endif ! if (!PyArg_ParseTuple(_args, "O&bHb", WinObj_Convert, &window, &isActive, *************** *** 1606,1610 **** PyMac_PRECHECK(GetThemeBrushAsColor); #endif ! if (!PyArg_ParseTuple(_args, "hhb", &inBrush, &inDepth, --- 1606,1610 ---- PyMac_PRECHECK(GetThemeBrushAsColor); #endif ! if (!PyArg_ParseTuple(_args, "hHb", &inBrush, &inDepth, *************** *** 1632,1636 **** PyMac_PRECHECK(GetThemeTextColor); #endif ! if (!PyArg_ParseTuple(_args, "hhb", &inColor, &inDepth, --- 1632,1636 ---- PyMac_PRECHECK(GetThemeTextColor); #endif ! if (!PyArg_ParseTuple(_args, "hHb", &inColor, &inDepth, *************** *** 1656,1660 **** PyMac_PRECHECK(GetThemeMetric); #endif ! if (!PyArg_ParseTuple(_args, "l", &inMetric)) return NULL; --- 1656,1660 ---- PyMac_PRECHECK(GetThemeMetric); #endif ! if (!PyArg_ParseTuple(_args, "k", &inMetric)) return NULL; Index: appsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -C2 -d -r1.17 -r1.17.6.1 *** appsupport.py 3 Dec 2002 23:40:19 -0000 1.17 --- appsupport.py 18 Apr 2003 08:58:33 -0000 1.17.6.1 *************** *** 48,53 **** ThemeTabStyle = Type("ThemeTabStyle", "H") ThemeTabDirection = Type("ThemeTabDirection", "H") ! ThemeDrawState = Type("ThemeDrawState", "l") ! ThemeCursor = Type("ThemeCursor", "l") ThemeCheckBoxStyle = Type("ThemeCheckBoxStyle", "H") ThemeScrollBarArrowStyle = Type("ThemeScrollBarArrowStyle", "H") --- 48,53 ---- ThemeTabStyle = Type("ThemeTabStyle", "H") ThemeTabDirection = Type("ThemeTabDirection", "H") ! ThemeDrawState = Type("ThemeDrawState", "k") ! ThemeCursor = Type("ThemeCursor", "k") ThemeCheckBoxStyle = Type("ThemeCheckBoxStyle", "H") ThemeScrollBarArrowStyle = Type("ThemeScrollBarArrowStyle", "H") *************** *** 59,63 **** ThemeTrackAttributes = Type("ThemeTrackAttributes", "H") ControlPartCode = Type("ControlPartCode", "h") ! ThemeWindowAttributes = Type("ThemeWindowAttributes", "l") ThemeWindowType = Type("ThemeWindowType", "H") ThemeTitleBarWidget = Type("ThemeTitleBarWidget", "H") --- 59,63 ---- ThemeTrackAttributes = Type("ThemeTrackAttributes", "H") ControlPartCode = Type("ControlPartCode", "h") ! ThemeWindowAttributes = Type("ThemeWindowAttributes", "k") ThemeWindowType = Type("ThemeWindowType", "H") ThemeTitleBarWidget = Type("ThemeTitleBarWidget", "H") *************** *** 67,72 **** ThemeSoundKind = OSTypeType("ThemeSoundKind") ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind") ! ThemeBackgroundKind = Type("ThemeBackgroundKind", "l") ! ThemeMetric = Type("ThemeMetric", "l") RGBColor = OpaqueType("RGBColor", "QdRGB") TruncCode = Type("TruncCode", "h") --- 67,72 ---- ThemeSoundKind = OSTypeType("ThemeSoundKind") ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind") ! ThemeBackgroundKind = Type("ThemeBackgroundKind", "k") ! ThemeMetric = Type("ThemeMetric", "k") RGBColor = OpaqueType("RGBColor", "QdRGB") TruncCode = Type("TruncCode", "h") From jackjansen@users.sourceforge.net Fri Apr 18 09:59:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt CarbonEvtsupport.py,1.13,1.13.6.1 _CarbonEvtmodule.c,1.14,1.14.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/carbonevt Modified Files: Tag: getargs_mask_mods CarbonEvtsupport.py _CarbonEvtmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: CarbonEvtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/CarbonEvtsupport.py,v retrieving revision 1.13 retrieving revision 1.13.6.1 diff -C2 -d -r1.13 -r1.13.6.1 *** CarbonEvtsupport.py 23 Dec 2002 23:16:21 -0000 1.13 --- CarbonEvtsupport.py 18 Apr 2003 08:58:33 -0000 1.13.6.1 *************** *** 117,121 **** EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out) { ! if (PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &(out->eventClass), &(out->eventKind))) --- 117,121 ---- EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out) { ! if (PyArg_Parse(v, "(O&k)", PyMac_GetOSType, &(out->eventClass), &(out->eventKind))) *************** *** 157,161 **** EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out) { ! if (PyArg_ParseTuple(v, "ll", &out->signature, &out->id)) return 1; return NULL; --- 157,161 ---- EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out) { ! if (PyArg_ParseTuple(v, "kk", &out->signature, &out->id)) return 1; return NULL; Index: _CarbonEvtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/_CarbonEvtmodule.c,v retrieving revision 1.14 retrieving revision 1.14.6.1 diff -C2 -d -r1.14 -r1.14.6.1 *** _CarbonEvtmodule.c 23 Dec 2002 23:16:21 -0000 1.14 --- _CarbonEvtmodule.c 18 Apr 2003 08:58:33 -0000 1.14.6.1 *************** *** 48,52 **** EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out) { ! if (PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &(out->eventClass), &(out->eventKind))) --- 48,52 ---- EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out) { ! if (PyArg_Parse(v, "(O&k)", PyMac_GetOSType, &(out->eventClass), &(out->eventKind))) *************** *** 88,92 **** EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out) { ! if (PyArg_ParseTuple(v, "ll", &out->signature, &out->id)) return 1; return NULL; --- 88,92 ---- EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out) { ! if (PyArg_ParseTuple(v, "kk", &out->signature, &out->id)) return 1; return NULL; *************** *** 194,198 **** return NULL; _rv = GetEventRetainCount(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 194,198 ---- return NULL; _rv = GetEventRetainCount(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 242,246 **** return NULL; _rv = GetEventClass(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 242,246 ---- return NULL; _rv = GetEventClass(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 254,258 **** return NULL; _rv = GetEventKind(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 254,258 ---- return NULL; _rv = GetEventKind(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 525,529 **** EventRef inEvent; SInt16 inPriority; ! if (!PyArg_ParseTuple(_args, "O&h", EventRef_Convert, &inEvent, &inPriority)) --- 525,529 ---- EventRef inEvent; SInt16 inPriority; ! if (!PyArg_ParseTuple(_args, "O&H", EventRef_Convert, &inEvent, &inPriority)) *************** *** 544,548 **** UInt32 inNumTypes; EventTypeSpec inList; ! if (!PyArg_ParseTuple(_args, "lO&", &inNumTypes, EventTypeSpec_Convert, &inList)) --- 544,548 ---- UInt32 inNumTypes; EventTypeSpec inList; ! if (!PyArg_ParseTuple(_args, "kO&", &inNumTypes, EventTypeSpec_Convert, &inList)) *************** *** 577,581 **** return NULL; _rv = GetNumEventsInQueue(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 577,581 ---- return NULL; _rv = GetNumEventsInQueue(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 1030,1034 **** return NULL; } ! if (!PyArg_ParseTuple(_args, "lO&", &inNumTypes, EventTypeSpec_Convert, &inList)) --- 1030,1034 ---- return NULL; } ! if (!PyArg_ParseTuple(_args, "kO&", &inNumTypes, EventTypeSpec_Convert, &inList)) *************** *** 1053,1057 **** return NULL; } ! if (!PyArg_ParseTuple(_args, "lO&", &inNumTypes, EventTypeSpec_Convert, &inList)) --- 1053,1057 ---- return NULL; } ! if (!PyArg_ParseTuple(_args, "kO&", &inNumTypes, EventTypeSpec_Convert, &inList)) *************** *** 1634,1638 **** Boolean inPullEvent; EventRef outEvent; ! if (!PyArg_ParseTuple(_args, "lO&db", &inNumTypes, EventTypeSpec_Convert, &inList, --- 1634,1638 ---- Boolean inPullEvent; EventRef outEvent; ! if (!PyArg_ParseTuple(_args, "kO&db", &inNumTypes, EventTypeSpec_Convert, &inList, *************** *** 1717,1721 **** UInt32 outModifiers; UInt16 outResult; ! if (!PyArg_ParseTuple(_args, "O&ld", GrafObj_Convert, &inPort, &inOptions, --- 1717,1721 ---- UInt32 outModifiers; UInt16 outResult; ! if (!PyArg_ParseTuple(_args, "O&kd", GrafObj_Convert, &inPort, &inOptions, *************** *** 1729,1733 **** &outResult); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&lH", PyMac_BuildPoint, outPt, outModifiers, --- 1729,1733 ---- &outResult); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&kH", PyMac_BuildPoint, outPt, outModifiers, *************** *** 2028,2032 **** OptionBits inOptions; EventHotKeyRef outRef; ! if (!PyArg_ParseTuple(_args, "llO&O&l", &inHotKeyCode, &inHotKeyModifiers, --- 2028,2032 ---- OptionBits inOptions; EventHotKeyRef outRef; ! if (!PyArg_ParseTuple(_args, "kkO&O&k", &inHotKeyCode, &inHotKeyModifiers, From jackjansen@users.sourceforge.net Fri Apr 18 09:59:07 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg _CGmodule.c,1.11,1.11.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/cg Modified Files: Tag: getargs_mask_mods _CGmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _CGmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/_CGmodule.c,v retrieving revision 1.11 retrieving revision 1.11.6.1 diff -C2 -d -r1.11 -r1.11.6.1 *** _CGmodule.c 23 Dec 2002 23:16:21 -0000 1.11 --- _CGmodule.c 18 Apr 2003 08:58:35 -0000 1.11.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) From jackjansen@users.sourceforge.net Fri Apr 18 09:59:07 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.20,1.20.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/cf Modified Files: Tag: getargs_mask_mods _CFmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.20 retrieving revision 1.20.2.1 diff -C2 -d -r1.20 -r1.20.2.1 *** _CFmodule.c 3 Mar 2003 13:12:58 -0000 1.20 --- _CFmodule.c 18 Apr 2003 08:58:34 -0000 1.20.2.1 *************** *** 1458,1462 **** if (v == Py_None) { *p_itself = NULL; return 1; } if (PyString_Check(v)) { ! char *cStr = PyString_AsString(v); *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; --- 1458,1464 ---- if (v == Py_None) { *p_itself = NULL; return 1; } if (PyString_Check(v)) { ! char *cStr; ! if (!PyArg_Parse(v, "es", "ascii", &cStr)) ! return NULL; *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; *************** *** 3931,3935 **** return NULL; _rv = CFStringConvertEncodingToNSStringEncoding(encoding); ! _res = Py_BuildValue("l", _rv); return _res; --- 3933,3937 ---- return NULL; _rv = CFStringConvertEncodingToNSStringEncoding(encoding); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 3944,3948 **** PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding); #endif ! if (!PyArg_ParseTuple(_args, "l", &encoding)) return NULL; --- 3946,3950 ---- PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding); #endif ! if (!PyArg_ParseTuple(_args, "k", &encoding)) return NULL; *************** *** 3965,3969 **** return NULL; _rv = CFStringConvertEncodingToWindowsCodepage(encoding); ! _res = Py_BuildValue("l", _rv); return _res; --- 3967,3971 ---- return NULL; _rv = CFStringConvertEncodingToWindowsCodepage(encoding); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 3978,3982 **** PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding); #endif ! if (!PyArg_ParseTuple(_args, "l", &codepage)) return NULL; --- 3980,3984 ---- PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding); #endif ! if (!PyArg_ParseTuple(_args, "k", &codepage)) return NULL; From jackjansen@users.sourceforge.net Fri Apr 18 09:59:08 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cm _Cmmodule.c,1.15,1.15.6.1 cmsupport.py,1.8,1.8.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/cm Modified Files: Tag: getargs_mask_mods _Cmmodule.c cmsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Cmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/_Cmmodule.c,v retrieving revision 1.15 retrieving revision 1.15.6.1 diff -C2 -d -r1.15 -r1.15.6.1 *** _Cmmodule.c 23 Dec 2002 23:16:21 -0000 1.15 --- _Cmmodule.c 18 Apr 2003 08:58:35 -0000 1.15.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 56,60 **** CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself) { ! return PyArg_ParseTuple(v, "O&O&O&ll", PyMac_GetOSType, &p_itself->componentType, PyMac_GetOSType, &p_itself->componentSubType, --- 56,60 ---- CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself) { ! return PyArg_ParseTuple(v, "O&O&O&kk", PyMac_GetOSType, &p_itself->componentType, PyMac_GetOSType, &p_itself->componentSubType, *************** *** 145,149 **** PyMac_PRECHECK(SetComponentInstanceError); #endif ! if (!PyArg_ParseTuple(_args, "h", &theError)) return NULL; --- 145,149 ---- PyMac_PRECHECK(SetComponentInstanceError); #endif ! if (!PyArg_ParseTuple(_args, "H", &theError)) return NULL; *************** *** 195,199 **** PyMac_PRECHECK(ComponentFunctionImplemented); #endif ! if (!PyArg_ParseTuple(_args, "h", &ftnNumber)) return NULL; --- 195,199 ---- PyMac_PRECHECK(ComponentFunctionImplemented); #endif ! if (!PyArg_ParseTuple(_args, "H", &ftnNumber)) return NULL; *************** *** 460,464 **** PyMac_PRECHECK(GetComponentPublicIndString); #endif ! if (!PyArg_ParseTuple(_args, "O&hh", PyMac_GetStr255, theString, &strListID, --- 460,464 ---- PyMac_PRECHECK(GetComponentPublicIndString); #endif ! if (!PyArg_ParseTuple(_args, "O&HH", PyMac_GetStr255, theString, &strListID, *************** *** 517,521 **** return NULL; _rv = OpenComponentResFile(_self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 517,521 ---- return NULL; _rv = OpenComponentResFile(_self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 532,536 **** PyMac_PRECHECK(GetComponentResource); #endif ! if (!PyArg_ParseTuple(_args, "O&h", PyMac_GetOSType, &resType, &resID)) --- 532,536 ---- PyMac_PRECHECK(GetComponentResource); #endif ! if (!PyArg_ParseTuple(_args, "O&H", PyMac_GetOSType, &resType, &resID)) *************** *** 556,560 **** PyMac_PRECHECK(GetComponentIndString); #endif ! if (!PyArg_ParseTuple(_args, "O&hh", PyMac_GetStr255, theString, &strListID, --- 556,560 ---- PyMac_PRECHECK(GetComponentIndString); #endif ! if (!PyArg_ParseTuple(_args, "O&HH", PyMac_GetStr255, theString, &strListID, *************** *** 594,598 **** PyMac_PRECHECK(SetDefaultComponent); #endif ! if (!PyArg_ParseTuple(_args, "h", &flags)) return NULL; --- 594,598 ---- PyMac_PRECHECK(SetDefaultComponent); #endif ! if (!PyArg_ParseTuple(_args, "H", &flags)) return NULL; *************** *** 774,778 **** PyMac_PRECHECK(RegisterComponentResource); #endif ! if (!PyArg_ParseTuple(_args, "O&h", ResObj_Convert, &cr, &global)) --- 774,778 ---- PyMac_PRECHECK(RegisterComponentResource); #endif ! if (!PyArg_ParseTuple(_args, "O&H", ResObj_Convert, &cr, &global)) *************** *** 845,849 **** PyMac_PRECHECK(CloseComponentResFile); #endif ! if (!PyArg_ParseTuple(_args, "h", &refnum)) return NULL; --- 845,849 ---- PyMac_PRECHECK(CloseComponentResFile); #endif ! if (!PyArg_ParseTuple(_args, "H", &refnum)) return NULL; *************** *** 884,888 **** PyMac_PRECHECK(RegisterComponentResourceFile); #endif ! if (!PyArg_ParseTuple(_args, "hh", &resRefNum, &global)) --- 884,888 ---- PyMac_PRECHECK(RegisterComponentResourceFile); #endif ! if (!PyArg_ParseTuple(_args, "HH", &resRefNum, &global)) Index: cmsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmsupport.py,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -C2 -d -r1.8 -r1.8.6.1 *** cmsupport.py 3 Dec 2002 23:40:19 -0000 1.8 --- cmsupport.py 18 Apr 2003 08:58:36 -0000 1.8.6.1 *************** *** 57,61 **** CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself) { ! return PyArg_ParseTuple(v, "O&O&O&ll", PyMac_GetOSType, &p_itself->componentType, PyMac_GetOSType, &p_itself->componentSubType, --- 57,61 ---- CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself) { ! return PyArg_ParseTuple(v, "O&O&O&kk", PyMac_GetOSType, &p_itself->componentType, PyMac_GetOSType, &p_itself->componentSubType, *************** *** 76,80 **** Component = OpaqueByValueType('Component', C_OBJECTPREFIX) ComponentInstance = OpaqueByValueType('ComponentInstance', CI_OBJECTPREFIX) ! ComponentResult = Type("ComponentResult", "l") ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj") --- 76,80 ---- Component = OpaqueByValueType('Component', C_OBJECTPREFIX) ComponentInstance = OpaqueByValueType('ComponentInstance', CI_OBJECTPREFIX) ! ComponentResult = Type("ComponentResult", "k") ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj") From jackjansen@users.sourceforge.net Fri Apr 18 09:59:10 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:10 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.24,1.24.6.1 ctlsupport.py,1.53,1.53.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/ctl Modified Files: Tag: getargs_mask_mods _Ctlmodule.c ctlsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v retrieving revision 1.24 retrieving revision 1.24.6.1 diff -C2 -d -r1.24 -r1.24.6.1 *** _Ctlmodule.c 23 Dec 2002 23:16:21 -0000 1.24 --- _Ctlmodule.c 18 Apr 2003 08:58:36 -0000 1.24.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ [...1103 lines suppressed...] PyMac_GetRect, &inBoundsRect, --- 5284,5288 ---- PyMac_PRECHECK(CreateRoundButtonControl); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HO&", WinObj_Convert, &inWindow, PyMac_GetRect, &inBoundsRect, *************** *** 5380,5384 **** inWindow, &outPart); ! _res = Py_BuildValue("O&h", CtlObj_WhichControl, _rv, outPart); --- 5380,5384 ---- inWindow, &outPart); ! _res = Py_BuildValue("O&H", CtlObj_WhichControl, _rv, outPart); Index: ctlsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlsupport.py,v retrieving revision 1.53 retrieving revision 1.53.6.1 diff -C2 -d -r1.53 -r1.53.6.1 *** ctlsupport.py 12 Dec 2002 10:31:50 -0000 1.53 --- ctlsupport.py 18 Apr 2003 08:58:36 -0000 1.53.6.1 *************** *** 34,38 **** IconTransformType = Type("IconTransformType", "h") EventModifiers = Type("EventModifiers", "H") ! ClickActivationResult = Type("ClickActivationResult", "l") ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h") ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h") --- 34,38 ---- IconTransformType = Type("IconTransformType", "h") EventModifiers = Type("EventModifiers", "H") ! ClickActivationResult = Type("ClickActivationResult", "k") ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h") ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h") *************** *** 172,176 **** PyControlID_Convert(PyObject *v, ControlID *itself) { ! return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id); } --- 172,176 ---- PyControlID_Convert(PyObject *v, ControlID *itself) { ! return PyArg_Parse(v, "(O&k)", PyMac_GetOSType, &itself->signature, &itself->id); } *************** *** 181,185 **** DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself) { ! return PyArg_Parse(v, "(lO&l)", &itself->propertyID, PyMac_GetOSType, &itself->propertyType, --- 181,185 ---- DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself) { ! return PyArg_Parse(v, "(kO&k)", &itself->propertyID, PyMac_GetOSType, &itself->propertyType, From jackjansen@users.sourceforge.net Fri Apr 18 09:59:10 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:10 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/dlg _Dlgmodule.c,1.18,1.18.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/dlg Modified Files: Tag: getargs_mask_mods _Dlgmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Dlgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/_Dlgmodule.c,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -C2 -d -r1.18 -r1.18.2.1 *** _Dlgmodule.c 27 Feb 2003 22:50:49 -0000 1.18 --- _Dlgmodule.c 18 Apr 2003 08:58:37 -0000 1.18.2.1 *************** *** 375,379 **** PyMac_PRECHECK(SelectDialogItemText); #endif ! if (!PyArg_ParseTuple(_args, "hhh", &itemNo, &strtSel, --- 375,379 ---- PyMac_PRECHECK(SelectDialogItemText); #endif ! if (!PyArg_ParseTuple(_args, "hHH", &itemNo, &strtSel, *************** *** 599,603 **** PyMac_PRECHECK(GetDialogItemAsControl); #endif ! if (!PyArg_ParseTuple(_args, "h", &inItemNo)) return NULL; --- 599,603 ---- PyMac_PRECHECK(GetDialogItemAsControl); #endif ! if (!PyArg_ParseTuple(_args, "H", &inItemNo)) return NULL; *************** *** 621,625 **** PyMac_PRECHECK(MoveDialogItem); #endif ! if (!PyArg_ParseTuple(_args, "hhh", &inItemNo, &inHoriz, --- 621,625 ---- PyMac_PRECHECK(MoveDialogItem); #endif ! if (!PyArg_ParseTuple(_args, "HHH", &inItemNo, &inHoriz, *************** *** 646,650 **** PyMac_PRECHECK(SizeDialogItem); #endif ! if (!PyArg_ParseTuple(_args, "hhh", &inItemNo, &inWidth, --- 646,650 ---- PyMac_PRECHECK(SizeDialogItem); #endif ! if (!PyArg_ParseTuple(_args, "HHH", &inItemNo, &inWidth, *************** *** 670,674 **** PyMac_PRECHECK(AppendDialogItemList); #endif ! if (!PyArg_ParseTuple(_args, "hh", &ditlID, &method)) --- 670,674 ---- PyMac_PRECHECK(AppendDialogItemList); #endif ! if (!PyArg_ParseTuple(_args, "Hh", &ditlID, &method)) *************** *** 692,696 **** PyMac_PRECHECK(SetDialogTimeout); #endif ! if (!PyArg_ParseTuple(_args, "hl", &inButtonToPress, &inSecondsToWait)) --- 692,696 ---- PyMac_PRECHECK(SetDialogTimeout); #endif ! if (!PyArg_ParseTuple(_args, "Hk", &inButtonToPress, &inSecondsToWait)) *************** *** 722,726 **** &outSecondsRemaining); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("hll", outButtonToPress, outSecondsToWait, --- 722,726 ---- &outSecondsRemaining); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("Hkk", outButtonToPress, outSecondsToWait, *************** *** 806,810 **** return NULL; _rv = GetDialogDefaultItem(_self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 806,810 ---- return NULL; _rv = GetDialogDefaultItem(_self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 821,825 **** return NULL; _rv = GetDialogCancelItem(_self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 821,825 ---- return NULL; _rv = GetDialogCancelItem(_self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 836,840 **** return NULL; _rv = GetDialogKeyboardFocusItem(_self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 836,840 ---- return NULL; _rv = GetDialogKeyboardFocusItem(_self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 1045,1049 **** PyMac_PRECHECK(NewDialog); #endif ! if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&", PyMac_GetRect, &boundsRect, PyMac_GetStr255, title, --- 1045,1049 ---- PyMac_PRECHECK(NewDialog); #endif ! if (!PyArg_ParseTuple(_args, "O&O&bHO&blO&", PyMac_GetRect, &boundsRect, PyMac_GetStr255, title, *************** *** 1078,1082 **** PyMac_PRECHECK(GetNewDialog); #endif ! if (!PyArg_ParseTuple(_args, "hO&", &dialogID, WinObj_Convert, &behind)) --- 1078,1082 ---- PyMac_PRECHECK(GetNewDialog); #endif ! if (!PyArg_ParseTuple(_args, "HO&", &dialogID, WinObj_Convert, &behind)) *************** *** 1105,1109 **** PyMac_PRECHECK(NewColorDialog); #endif ! if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&", PyMac_GetRect, &boundsRect, PyMac_GetStr255, title, --- 1105,1109 ---- PyMac_PRECHECK(NewColorDialog); #endif ! if (!PyArg_ParseTuple(_args, "O&O&bHO&blO&", PyMac_GetRect, &boundsRect, PyMac_GetStr255, title, *************** *** 1196,1200 **** PyMac_PRECHECK(Alert); #endif ! if (!PyArg_ParseTuple(_args, "hO", &alertID, &modalFilter)) --- 1196,1200 ---- PyMac_PRECHECK(Alert); #endif ! if (!PyArg_ParseTuple(_args, "HO", &alertID, &modalFilter)) *************** *** 1216,1220 **** PyMac_PRECHECK(StopAlert); #endif ! if (!PyArg_ParseTuple(_args, "hO", &alertID, &modalFilter)) --- 1216,1220 ---- PyMac_PRECHECK(StopAlert); #endif ! if (!PyArg_ParseTuple(_args, "HO", &alertID, &modalFilter)) *************** *** 1236,1240 **** PyMac_PRECHECK(NoteAlert); #endif ! if (!PyArg_ParseTuple(_args, "hO", &alertID, &modalFilter)) --- 1236,1240 ---- PyMac_PRECHECK(NoteAlert); #endif ! if (!PyArg_ParseTuple(_args, "HO", &alertID, &modalFilter)) *************** *** 1256,1260 **** PyMac_PRECHECK(CautionAlert); #endif ! if (!PyArg_ParseTuple(_args, "hO", &alertID, &modalFilter)) --- 1256,1260 ---- PyMac_PRECHECK(CautionAlert); #endif ! if (!PyArg_ParseTuple(_args, "HO", &alertID, &modalFilter)) *************** *** 1339,1343 **** return NULL; _rv = GetAlertStage(); ! _res = Py_BuildValue("h", _rv); return _res; --- 1339,1343 ---- return NULL; _rv = GetAlertStage(); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 1351,1355 **** PyMac_PRECHECK(SetDialogFont); #endif ! if (!PyArg_ParseTuple(_args, "h", &fontNum)) return NULL; --- 1351,1355 ---- PyMac_PRECHECK(SetDialogFont); #endif ! if (!PyArg_ParseTuple(_args, "H", &fontNum)) return NULL; *************** *** 1415,1419 **** PyMac_PRECHECK(NewFeaturesDialog); #endif ! if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&l", PyMac_GetRect, &inBoundsRect, PyMac_GetStr255, inTitle, --- 1415,1419 ---- PyMac_PRECHECK(NewFeaturesDialog); #endif ! if (!PyArg_ParseTuple(_args, "O&O&bHO&blO&k", PyMac_GetRect, &inBoundsRect, PyMac_GetStr255, inTitle, From jackjansen@users.sourceforge.net Fri Apr 18 09:59:12 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/evt _Evtmodule.c,1.8,1.8.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/evt Modified Files: Tag: getargs_mask_mods _Evtmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Evtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/_Evtmodule.c,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -C2 -d -r1.8 -r1.8.6.1 *** _Evtmodule.c 12 Dec 2002 10:31:50 -0000 1.8 --- _Evtmodule.c 18 Apr 2003 08:58:39 -0000 1.8.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 100,104 **** return NULL; _rv = GetCaretTime(); ! _res = Py_BuildValue("l", _rv); return _res; --- 100,104 ---- return NULL; _rv = GetCaretTime(); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 130,134 **** return NULL; _rv = GetDblTime(); ! _res = Py_BuildValue("l", _rv); return _res; --- 130,134 ---- return NULL; _rv = GetDblTime(); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 200,204 **** PyMac_PRECHECK(PostEvent); #endif ! if (!PyArg_ParseTuple(_args, "Hl", &eventNum, &eventMsg)) --- 200,204 ---- PyMac_PRECHECK(PostEvent); #endif ! if (!PyArg_ParseTuple(_args, "Hk", &eventNum, &eventMsg)) *************** *** 256,260 **** return NULL; _rv = GetCurrentKeyModifiers(); ! _res = Py_BuildValue("l", _rv); return _res; --- 256,260 ---- return NULL; _rv = GetCurrentKeyModifiers(); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 283,287 **** PyMac_PRECHECK(KeyScript); #endif ! if (!PyArg_ParseTuple(_args, "h", &code)) return NULL; --- 283,287 ---- PyMac_PRECHECK(KeyScript); #endif ! if (!PyArg_ParseTuple(_args, "H", &code)) return NULL; *************** *** 301,305 **** PyMac_PRECHECK(IsCmdChar); #endif ! if (!PyArg_ParseTuple(_args, "O&h", PyMac_GetEventRecord, &event, &test)) --- 301,305 ---- PyMac_PRECHECK(IsCmdChar); #endif ! if (!PyArg_ParseTuple(_args, "O&H", PyMac_GetEventRecord, &event, &test)) *************** *** 322,326 **** return NULL; _rv = LMGetKeyThresh(); ! _res = Py_BuildValue("h", _rv); return _res; --- 322,326 ---- return NULL; _rv = LMGetKeyThresh(); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 334,338 **** PyMac_PRECHECK(LMSetKeyThresh); #endif ! if (!PyArg_ParseTuple(_args, "h", &value)) return NULL; --- 334,338 ---- PyMac_PRECHECK(LMSetKeyThresh); #endif ! if (!PyArg_ParseTuple(_args, "H", &value)) return NULL; *************** *** 353,357 **** return NULL; _rv = LMGetKeyRepThresh(); ! _res = Py_BuildValue("h", _rv); return _res; --- 353,357 ---- return NULL; _rv = LMGetKeyRepThresh(); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 365,369 **** PyMac_PRECHECK(LMSetKeyRepThresh); #endif ! if (!PyArg_ParseTuple(_args, "h", &value)) return NULL; --- 365,369 ---- PyMac_PRECHECK(LMSetKeyRepThresh); #endif ! if (!PyArg_ParseTuple(_args, "H", &value)) return NULL; *************** *** 446,450 **** return NULL; _rv = TickCount(); ! _res = Py_BuildValue("l", _rv); return _res; --- 446,450 ---- return NULL; _rv = TickCount(); ! _res = Py_BuildValue("k", _rv); return _res; From jackjansen@users.sourceforge.net Fri Apr 18 09:59:12 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag _Dragmodule.c,1.14,1.14.6.1 dragsupport.py,1.12,1.12.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/drag Modified Files: Tag: getargs_mask_mods _Dragmodule.c dragsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Dragmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/_Dragmodule.c,v retrieving revision 1.14 retrieving revision 1.14.6.1 diff -C2 -d -r1.14 -r1.14.6.1 *** _Dragmodule.c 23 Dec 2002 23:16:22 -0000 1.14 --- _Dragmodule.c 18 Apr 2003 08:58:38 -0000 1.14.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 117,121 **** PyMac_PRECHECK(AddDragItemFlavor); #endif ! if (!PyArg_ParseTuple(_args, "lO&z#l", &theItemRef, PyMac_GetOSType, &theType, --- 117,121 ---- PyMac_PRECHECK(AddDragItemFlavor); #endif ! if (!PyArg_ParseTuple(_args, "kO&z#k", &theItemRef, PyMac_GetOSType, &theType, *************** *** 148,152 **** PyMac_PRECHECK(SetDragItemFlavorData); #endif ! if (!PyArg_ParseTuple(_args, "lO&z#l", &theItemRef, PyMac_GetOSType, &theType, --- 148,152 ---- PyMac_PRECHECK(SetDragItemFlavorData); #endif ! if (!PyArg_ParseTuple(_args, "kO&z#k", &theItemRef, PyMac_GetOSType, &theType, *************** *** 177,181 **** PyMac_PRECHECK(SetDragImage); #endif ! if (!PyArg_ParseTuple(_args, "O&O&O&l", ResObj_Convert, &imagePixMap, ResObj_Convert, &imageRgn, --- 177,181 ---- PyMac_PRECHECK(SetDragImage); #endif ! if (!PyArg_ParseTuple(_args, "O&O&O&k", ResObj_Convert, &imagePixMap, ResObj_Convert, &imageRgn, *************** *** 203,207 **** PyMac_PRECHECK(ChangeDragBehaviors); #endif ! if (!PyArg_ParseTuple(_args, "ll", &inBehaviorsToSet, &inBehaviorsToClear)) --- 203,207 ---- PyMac_PRECHECK(ChangeDragBehaviors); #endif ! if (!PyArg_ParseTuple(_args, "kk", &inBehaviorsToSet, &inBehaviorsToClear)) *************** *** 272,276 **** &theItemRef); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("l", theItemRef); return _res; --- 272,276 ---- &theItemRef); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("k", theItemRef); return _res; *************** *** 286,290 **** PyMac_PRECHECK(CountDragItemFlavors); #endif ! if (!PyArg_ParseTuple(_args, "l", &theItemRef)) return NULL; --- 286,290 ---- PyMac_PRECHECK(CountDragItemFlavors); #endif ! if (!PyArg_ParseTuple(_args, "k", &theItemRef)) return NULL; *************** *** 308,312 **** PyMac_PRECHECK(GetFlavorType); #endif ! if (!PyArg_ParseTuple(_args, "lH", &theItemRef, &index)) --- 308,312 ---- PyMac_PRECHECK(GetFlavorType); #endif ! if (!PyArg_ParseTuple(_args, "kH", &theItemRef, &index)) *************** *** 332,336 **** PyMac_PRECHECK(GetFlavorFlags); #endif ! if (!PyArg_ParseTuple(_args, "lO&", &theItemRef, PyMac_GetOSType, &theType)) --- 332,336 ---- PyMac_PRECHECK(GetFlavorFlags); #endif ! if (!PyArg_ParseTuple(_args, "kO&", &theItemRef, PyMac_GetOSType, &theType)) *************** *** 341,345 **** &theFlags); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("l", theFlags); return _res; --- 341,345 ---- &theFlags); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("k", theFlags); return _res; *************** *** 356,360 **** PyMac_PRECHECK(GetFlavorDataSize); #endif ! if (!PyArg_ParseTuple(_args, "lO&", &theItemRef, PyMac_GetOSType, &theType)) --- 356,360 ---- PyMac_PRECHECK(GetFlavorDataSize); #endif ! if (!PyArg_ParseTuple(_args, "kO&", &theItemRef, PyMac_GetOSType, &theType)) *************** *** 383,387 **** PyMac_PRECHECK(GetFlavorData); #endif ! if (!PyArg_ParseTuple(_args, "lO&il", &theItemRef, PyMac_GetOSType, &theType, --- 383,387 ---- PyMac_PRECHECK(GetFlavorData); #endif ! if (!PyArg_ParseTuple(_args, "kO&ik", &theItemRef, PyMac_GetOSType, &theType, *************** *** 417,421 **** PyMac_PRECHECK(GetDragItemBounds); #endif ! if (!PyArg_ParseTuple(_args, "l", &theItemRef)) return NULL; --- 417,421 ---- PyMac_PRECHECK(GetDragItemBounds); #endif ! if (!PyArg_ParseTuple(_args, "k", &theItemRef)) return NULL; *************** *** 438,442 **** PyMac_PRECHECK(SetDragItemBounds); #endif ! if (!PyArg_ParseTuple(_args, "lO&", &theItemRef, PyMac_GetRect, &itemBounds)) --- 438,442 ---- PyMac_PRECHECK(SetDragItemBounds); #endif ! if (!PyArg_ParseTuple(_args, "kO&", &theItemRef, PyMac_GetRect, &itemBounds)) *************** *** 501,505 **** &flags); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("l", flags); return _res; --- 501,505 ---- &flags); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("k", flags); return _res; *************** *** 581,585 **** &mouseUpModifiers); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("hhh", modifiers, mouseDownModifiers, --- 581,585 ---- &mouseUpModifiers); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("HHH", modifiers, mouseDownModifiers, *************** *** 635,639 **** PyMac_PRECHECK(DragPreScroll); #endif ! if (!PyArg_ParseTuple(_args, "hh", &dH, &dV)) --- 635,639 ---- PyMac_PRECHECK(DragPreScroll); #endif ! if (!PyArg_ParseTuple(_args, "HH", &dH, &dV)) *************** *** 880,884 **** PyMac_PRECHECK(ZoomRects); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hh", PyMac_GetRect, &fromRect, PyMac_GetRect, &toRect, --- 880,884 ---- PyMac_PRECHECK(ZoomRects); #endif ! if (!PyArg_ParseTuple(_args, "O&O&Hh", PyMac_GetRect, &fromRect, PyMac_GetRect, &toRect, *************** *** 907,911 **** PyMac_PRECHECK(ZoomRegion); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hh", ResObj_Convert, ®ion, PyMac_GetPoint, &zoomDistance, --- 907,911 ---- PyMac_PRECHECK(ZoomRegion); #endif ! if (!PyArg_ParseTuple(_args, "O&O&Hh", ResObj_Convert, ®ion, PyMac_GetPoint, &zoomDistance, *************** *** 1040,1044 **** i = 0; else ! PyArg_Parse(rv, "l", &i); Py_DECREF(rv); return i; --- 1040,1044 ---- i = 0; else ! PyArg_Parse(rv, "k", &i); Py_DECREF(rv); return i; *************** *** 1066,1070 **** i = 0; else ! PyArg_Parse(rv, "l", &i); Py_DECREF(rv); return i; --- 1066,1070 ---- i = 0; else ! PyArg_Parse(rv, "k", &i); Py_DECREF(rv); return i; *************** *** 1095,1099 **** i = 0; else ! PyArg_Parse(rv, "l", &i); Py_DECREF(rv); return i; --- 1095,1099 ---- i = 0; else ! PyArg_Parse(rv, "k", &i); Py_DECREF(rv); return i; Index: dragsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragsupport.py,v retrieving revision 1.12 retrieving revision 1.12.6.1 diff -C2 -d -r1.12 -r1.12.6.1 *** dragsupport.py 3 Dec 2002 23:40:20 -0000 1.12 --- dragsupport.py 18 Apr 2003 08:58:38 -0000 1.12.6.1 *************** *** 23,27 **** DragRef = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) ! DragItemRef = Type("ItemReference", "l") # Old names DragReference = DragRef --- 23,27 ---- DragRef = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) ! DragItemRef = Type("ItemReference", "k") # Old names DragReference = DragRef *************** *** 35,45 **** FlavorType = OSTypeType("FlavorType") ! DragAttributes = Type("DragAttributes", "l") ! DragBehaviors = Type("DragBehaviors", "l") ! DragImageFlags = Type("DragImageFlags", "l") ! DragImageTranslucency = Type("DragImageTranslucency", "l") DragRegionMessage = Type("DragRegionMessage", "h") ZoomAcceleration = Type("ZoomAcceleration", "h") ! FlavorFlags = Type("FlavorFlags", "l") DragTrackingMessage = Type("DragTrackingMessage", "h") --- 35,45 ---- FlavorType = OSTypeType("FlavorType") ! DragAttributes = Type("DragAttributes", "k") ! DragBehaviors = Type("DragBehaviors", "k") ! DragImageFlags = Type("DragImageFlags", "k") ! DragImageTranslucency = Type("DragImageTranslucency", "k") DragRegionMessage = Type("DragRegionMessage", "h") ZoomAcceleration = Type("ZoomAcceleration", "h") ! FlavorFlags = Type("FlavorFlags", "k") DragTrackingMessage = Type("DragTrackingMessage", "h") *************** *** 91,95 **** i = 0; else ! PyArg_Parse(rv, "l", &i); Py_DECREF(rv); return i; --- 91,95 ---- i = 0; else ! PyArg_Parse(rv, "k", &i); Py_DECREF(rv); return i; *************** *** 117,121 **** i = 0; else ! PyArg_Parse(rv, "l", &i); Py_DECREF(rv); return i; --- 117,121 ---- i = 0; else ! PyArg_Parse(rv, "k", &i); Py_DECREF(rv); return i; *************** *** 146,150 **** i = 0; else ! PyArg_Parse(rv, "l", &i); Py_DECREF(rv); return i; --- 146,150 ---- i = 0; else ! PyArg_Parse(rv, "k", &i); Py_DECREF(rv); return i; From jackjansen@users.sourceforge.net Fri Apr 18 09:59:15 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:15 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/fm _Fmmodule.c,1.8,1.8.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/fm In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/fm Modified Files: Tag: getargs_mask_mods _Fmmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Fmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/_Fmmodule.c,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -C2 -d -r1.8 -r1.8.6.1 *** _Fmmodule.c 12 Dec 2002 10:31:50 -0000 1.8 --- _Fmmodule.c 18 Apr 2003 08:58:42 -0000 1.8.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 68,72 **** PyMac_PRECHECK(GetFontName); #endif ! if (!PyArg_ParseTuple(_args, "h", &familyID)) return NULL; --- 68,72 ---- PyMac_PRECHECK(GetFontName); #endif ! if (!PyArg_ParseTuple(_args, "H", &familyID)) return NULL; *************** *** 91,95 **** GetFNum(name, &familyID); ! _res = Py_BuildValue("h", familyID); return _res; --- 91,95 ---- GetFNum(name, &familyID); ! _res = Py_BuildValue("H", familyID); return _res; *************** *** 105,109 **** PyMac_PRECHECK(RealFont); #endif ! if (!PyArg_ParseTuple(_args, "hh", &fontNum, &size)) --- 105,109 ---- PyMac_PRECHECK(RealFont); #endif ! if (!PyArg_ParseTuple(_args, "HH", &fontNum, &size)) *************** *** 173,177 **** return NULL; _rv = GetDefFontSize(); ! _res = Py_BuildValue("h", _rv); return _res; --- 173,177 ---- return NULL; _rv = GetDefFontSize(); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 270,274 **** return NULL; _rv = GetSysFont(); ! _res = Py_BuildValue("h", _rv); return _res; --- 270,274 ---- return NULL; _rv = GetSysFont(); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 285,289 **** return NULL; _rv = GetAppFont(); ! _res = Py_BuildValue("h", _rv); return _res; --- 285,289 ---- return NULL; _rv = GetAppFont(); ! _res = Py_BuildValue("H", _rv); return _res; From jackjansen@users.sourceforge.net Fri Apr 18 09:59:15 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:15 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/folder _Foldermodule.c,1.1,1.1.6.1 foldersupport.py,1.1,1.1.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/folder In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/folder Modified Files: Tag: getargs_mask_mods _Foldermodule.c foldersupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Foldermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/folder/_Foldermodule.c,v retrieving revision 1.1 retrieving revision 1.1.6.1 diff -C2 -d -r1.1 -r1.1.6.1 *** _Foldermodule.c 22 Nov 2002 14:58:35 -0000 1.1 --- _Foldermodule.c 18 Apr 2003 08:58:42 -0000 1.1.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 39,43 **** short foundVRefNum; long foundDirID; ! if (!PyArg_ParseTuple(_args, "hO&b", &vRefNum, PyMac_GetOSType, &folderType, --- 39,43 ---- short foundVRefNum; long foundDirID; ! if (!PyArg_ParseTuple(_args, "HO&b", &vRefNum, PyMac_GetOSType, &folderType, *************** *** 50,54 **** &foundDirID); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("hl", foundVRefNum, foundDirID); --- 50,54 ---- &foundDirID); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("Hl", foundVRefNum, foundDirID); *************** *** 62,66 **** short vRefNum; OSType folderType; ! if (!PyArg_ParseTuple(_args, "hO&", &vRefNum, PyMac_GetOSType, &folderType)) --- 62,66 ---- short vRefNum; OSType folderType; ! if (!PyArg_ParseTuple(_args, "HO&", &vRefNum, PyMac_GetOSType, &folderType)) *************** *** 82,86 **** Boolean createFolder; FSRef foundRef; ! if (!PyArg_ParseTuple(_args, "hO&b", &vRefNum, PyMac_GetOSType, &folderType, --- 82,86 ---- Boolean createFolder; FSRef foundRef; ! if (!PyArg_ParseTuple(_args, "HO&b", &vRefNum, PyMac_GetOSType, &folderType, *************** *** 109,113 **** Str255 name; Boolean replaceFlag; ! if (!PyArg_ParseTuple(_args, "O&lO&O&O&O&O&b", PyMac_GetOSType, &foldType, &flags, --- 109,113 ---- Str255 name; Boolean replaceFlag; ! if (!PyArg_ParseTuple(_args, "O&kO&O&O&O&O&b", PyMac_GetOSType, &foldType, &flags, *************** *** 140,144 **** UInt32 totalTypeCount; FolderType theTypes; ! if (!PyArg_ParseTuple(_args, "l", &requestedTypeCount)) return NULL; --- 140,144 ---- UInt32 totalTypeCount; FolderType theTypes; ! if (!PyArg_ParseTuple(_args, "k", &requestedTypeCount)) return NULL; *************** *** 147,151 **** &theTypes); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("lO&", totalTypeCount, PyMac_BuildOSType, theTypes); --- 147,151 ---- &theTypes); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("kO&", totalTypeCount, PyMac_BuildOSType, theTypes); *************** *** 176,180 **** short foundVRefNum; Str255 name; ! if (!PyArg_ParseTuple(_args, "hO&O&", &vRefNum, PyMac_GetOSType, &foldType, --- 176,180 ---- short foundVRefNum; Str255 name; ! if (!PyArg_ParseTuple(_args, "HO&O&", &vRefNum, PyMac_GetOSType, &foldType, *************** *** 186,190 **** name); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", foundVRefNum); return _res; --- 186,190 ---- name); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", foundVRefNum); return _res; *************** *** 200,204 **** RoutingFlags flags; Boolean replaceFlag; ! if (!PyArg_ParseTuple(_args, "O&O&O&lb", PyMac_GetOSType, &fileType, PyMac_GetOSType, &routeFromFolder, --- 200,204 ---- RoutingFlags flags; Boolean replaceFlag; ! if (!PyArg_ParseTuple(_args, "O&O&O&kb", PyMac_GetOSType, &fileType, PyMac_GetOSType, &routeFromFolder, *************** *** 253,257 **** &flags); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&l", PyMac_BuildOSType, routeToFolder, flags); --- 253,257 ---- &flags); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&k", PyMac_BuildOSType, routeToFolder, flags); *************** *** 265,269 **** short vRefNum; long dirID; ! if (!PyArg_ParseTuple(_args, "hl", &vRefNum, &dirID)) --- 265,269 ---- short vRefNum; long dirID; ! if (!PyArg_ParseTuple(_args, "Hl", &vRefNum, &dirID)) *************** *** 284,288 **** long dirID; FolderType foldType; ! if (!PyArg_ParseTuple(_args, "hl", &vRefNum, &dirID)) --- 284,288 ---- long dirID; FolderType foldType; ! if (!PyArg_ParseTuple(_args, "Hl", &vRefNum, &dirID)) Index: foldersupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/folder/foldersupport.py,v retrieving revision 1.1 retrieving revision 1.1.6.1 diff -C2 -d -r1.1 -r1.1.6.1 *** foldersupport.py 22 Nov 2002 14:58:35 -0000 1.1 --- foldersupport.py 18 Apr 2003 08:58:42 -0000 1.1.6.1 *************** *** 22,30 **** FolderClass = OSTypeType("FolderClass") # FolderDesc ! FolderDescFlags = Type("FolderDescFlags", "l") FolderLocation = OSTypeType("FolderLocation") # FolderRouting FolderType = OSTypeType("FolderType") ! RoutingFlags = Type("RoutingFlags", "l") --- 22,30 ---- FolderClass = OSTypeType("FolderClass") # FolderDesc ! FolderDescFlags = Type("FolderDescFlags", "k") FolderLocation = OSTypeType("FolderLocation") # FolderRouting FolderType = OSTypeType("FolderType") ! RoutingFlags = Type("RoutingFlags", "k") From jackjansen@users.sourceforge.net Fri Apr 18 09:59:14 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:14 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/file _Filemodule.c,1.19,1.19.2.1 filesupport.py,1.17,1.17.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/file In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/file Modified Files: Tag: getargs_mask_mods _Filemodule.c filesupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Filemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/_Filemodule.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** _Filemodule.c 21 Mar 2003 12:54:24 -0000 1.19 --- _Filemodule.c 18 Apr 2003 08:58:40 -0000 1.19.2.1 *************** *** 60,64 **** UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr) { ! return PyArg_Parse(v, "(HlH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction); } --- 60,64 ---- UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr) { ! return PyArg_Parse(v, "(HkH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction); } *************** *** 174,178 **** static int FSCatalogInfo_set_parentDirID(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "l", &self->ob_itself.parentDirID)-1; return 0; } --- 174,178 ---- static int FSCatalogInfo_set_parentDirID(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "k", &self->ob_itself.parentDirID)-1; return 0; } *************** *** 185,189 **** static int FSCatalogInfo_set_nodeID(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "l", &self->ob_itself.nodeID)-1; return 0; } --- 185,189 ---- static int FSCatalogInfo_set_nodeID(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "k", &self->ob_itself.nodeID)-1; return 0; } *************** *** 251,255 **** static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "(llll)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1; return 0; } --- 251,255 ---- static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "(kkkk)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1; return 0; } *************** *** 317,321 **** static int FSCatalogInfo_set_sharingFlags(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "l", &self->ob_itself.sharingFlags)-1; return 0; } --- 317,321 ---- static int FSCatalogInfo_set_sharingFlags(FSCatalogInfoObject *self, PyObject *v, void *closure) { ! return PyArg_Parse(v, "k", &self->ob_itself.sharingFlags)-1; return 0; } *************** *** 719,723 **** AliasInfoType index; Str63 theString; ! if (!PyArg_ParseTuple(_args, "h", &index)) return NULL; --- 719,723 ---- AliasInfoType index; Str63 theString; ! if (!PyArg_ParseTuple(_args, "H", &index)) return NULL; *************** *** 740,744 **** Boolean wasChanged; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&l", myPyMac_GetOptFSSpecPtr, &fromFile, &mountFlags)) --- 740,744 ---- Boolean wasChanged; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&k", myPyMac_GetOptFSSpecPtr, &fromFile, &mountFlags)) *************** *** 790,794 **** Boolean wasChanged; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&l", myPyMac_GetOptFSRefPtr, &fromFile, &mountFlags)) --- 790,794 ---- Boolean wasChanged; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&k", myPyMac_GetOptFSRefPtr, &fromFile, &mountFlags)) *************** *** 1027,1031 **** SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "b", &permission)) return NULL; --- 1027,1031 ---- SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "B", &permission)) return NULL; *************** *** 1034,1038 **** &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", refNum); return _res; --- 1034,1038 ---- &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", refNum); return _res; *************** *** 1045,1049 **** SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "b", &permission)) return NULL; --- 1045,1049 ---- SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "B", &permission)) return NULL; *************** *** 1052,1056 **** &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", refNum); return _res; --- 1052,1056 ---- &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", refNum); return _res; *************** *** 1064,1068 **** OSType fileType; ScriptCode scriptTag; ! if (!PyArg_ParseTuple(_args, "O&O&h", PyMac_GetOSType, &creator, PyMac_GetOSType, &fileType, --- 1064,1068 ---- OSType fileType; ScriptCode scriptTag; ! if (!PyArg_ParseTuple(_args, "O&O&H", PyMac_GetOSType, &creator, PyMac_GetOSType, &fileType, *************** *** 1085,1089 **** ScriptCode scriptTag; long createdDirID; ! if (!PyArg_ParseTuple(_args, "h", &scriptTag)) return NULL; --- 1085,1089 ---- ScriptCode scriptTag; long createdDirID; ! if (!PyArg_ParseTuple(_args, "H", &scriptTag)) return NULL; *************** *** 1489,1493 **** TextEncoding textEncodingHint; FSRef newRef; ! if (!PyArg_ParseTuple(_args, "u#l", &nameLength__in__, &nameLength__in_len__, &textEncodingHint)) --- 1489,1493 ---- TextEncoding textEncodingHint; FSRef newRef; ! if (!PyArg_ParseTuple(_args, "u#k", &nameLength__in__, &nameLength__in_len__, &textEncodingHint)) *************** *** 1531,1535 **** FSRef newRef; FSSpec newSpec; ! if (!PyArg_ParseTuple(_args, "u#lO&", &nameLength__in__, &nameLength__in_len__, &whichInfo, --- 1531,1535 ---- FSRef newRef; FSSpec newSpec; ! if (!PyArg_ParseTuple(_args, "u#kO&", &nameLength__in__, &nameLength__in_len__, &whichInfo, *************** *** 1562,1566 **** FSSpec newSpec; UInt32 newDirID; ! if (!PyArg_ParseTuple(_args, "u#lO&", &nameLength__in__, &nameLength__in_len__, &whichInfo, --- 1562,1566 ---- FSSpec newSpec; UInt32 newDirID; ! if (!PyArg_ParseTuple(_args, "u#kO&", &nameLength__in__, &nameLength__in_len__, &whichInfo, *************** *** 1576,1580 **** &newDirID); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&O&l", FSRef_New, &newRef, FSSpec_New, &newSpec, --- 1576,1580 ---- &newDirID); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&O&k", FSRef_New, &newRef, FSSpec_New, &newSpec, *************** *** 1639,1643 **** TextEncoding textEncodingHint; FSRef newRef; ! if (!PyArg_ParseTuple(_args, "u#l", &nameLength__in__, &nameLength__in_len__, &textEncodingHint)) --- 1639,1643 ---- TextEncoding textEncodingHint; FSRef newRef; ! if (!PyArg_ParseTuple(_args, "u#k", &nameLength__in__, &nameLength__in_len__, &textEncodingHint)) *************** *** 1663,1667 **** FSSpec fsSpec; FSRef parentRef; ! if (!PyArg_ParseTuple(_args, "l", &whichInfo)) return NULL; --- 1663,1667 ---- FSSpec fsSpec; FSRef parentRef; ! if (!PyArg_ParseTuple(_args, "k", &whichInfo)) return NULL; *************** *** 1687,1691 **** FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; ! if (!PyArg_ParseTuple(_args, "lO&", &whichInfo, FSCatalogInfo_Convert, &catalogInfo)) --- 1687,1691 ---- FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; ! if (!PyArg_ParseTuple(_args, "kO&", &whichInfo, FSCatalogInfo_Convert, &catalogInfo)) *************** *** 1747,1751 **** SInt8 permissions; SInt16 forkRefNum; ! if (!PyArg_ParseTuple(_args, "u#b", &forkNameLength__in__, &forkNameLength__in_len__, &permissions)) --- 1747,1751 ---- SInt8 permissions; SInt16 forkRefNum; ! if (!PyArg_ParseTuple(_args, "u#B", &forkNameLength__in__, &forkNameLength__in_len__, &permissions)) *************** *** 1757,1761 **** &forkRefNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", forkRefNum); return _res; --- 1757,1761 ---- &forkRefNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", forkRefNum); return _res; *************** *** 1770,1774 **** FNMessage message; OptionBits flags; ! if (!PyArg_ParseTuple(_args, "ll", &message, &flags)) --- 1770,1774 ---- FNMessage message; OptionBits flags; ! if (!PyArg_ParseTuple(_args, "kk", &message, &flags)) *************** *** 2026,2030 **** Str63 volName; short vRefNum; ! if (!PyArg_ParseTuple(_args, "O&h", PyMac_GetStr255, volName, &vRefNum)) --- 2026,2030 ---- Str63 volName; short vRefNum; ! if (!PyArg_ParseTuple(_args, "O&H", PyMac_GetStr255, volName, &vRefNum)) *************** *** 2044,2048 **** Str63 volName; short vRefNum; ! if (!PyArg_ParseTuple(_args, "O&h", PyMac_GetStr255, volName, &vRefNum)) --- 2044,2048 ---- Str63 volName; short vRefNum; ! if (!PyArg_ParseTuple(_args, "O&H", PyMac_GetStr255, volName, &vRefNum)) *************** *** 2063,2067 **** short vRefNum; long dirID; ! if (!PyArg_ParseTuple(_args, "O&hl", PyMac_GetStr255, volName, &vRefNum, --- 2063,2067 ---- short vRefNum; long dirID; ! if (!PyArg_ParseTuple(_args, "O&Hl", PyMac_GetStr255, volName, &vRefNum, *************** *** 2082,2086 **** OSErr _err; short refNum; ! if (!PyArg_ParseTuple(_args, "h", &refNum)) return NULL; --- 2082,2086 ---- OSErr _err; short refNum; ! if (!PyArg_ParseTuple(_args, "H", &refNum)) return NULL; *************** *** 2098,2102 **** short refNum; long count; ! if (!PyArg_ParseTuple(_args, "h", &refNum)) return NULL; --- 2098,2102 ---- short refNum; long count; ! if (!PyArg_ParseTuple(_args, "H", &refNum)) return NULL; *************** *** 2115,2119 **** short refNum; long logEOF; ! if (!PyArg_ParseTuple(_args, "h", &refNum)) return NULL; --- 2115,2119 ---- short refNum; long logEOF; ! if (!PyArg_ParseTuple(_args, "H", &refNum)) return NULL; *************** *** 2132,2136 **** short refNum; long logEOF; ! if (!PyArg_ParseTuple(_args, "hl", &refNum, &logEOF)) --- 2132,2136 ---- short refNum; long logEOF; ! if (!PyArg_ParseTuple(_args, "Hl", &refNum, &logEOF)) *************** *** 2150,2154 **** short refNum; long filePos; ! if (!PyArg_ParseTuple(_args, "h", &refNum)) return NULL; --- 2150,2154 ---- short refNum; long filePos; ! if (!PyArg_ParseTuple(_args, "H", &refNum)) return NULL; *************** *** 2168,2172 **** short posMode; long posOff; ! if (!PyArg_ParseTuple(_args, "hhl", &refNum, &posMode, --- 2168,2172 ---- short posMode; long posOff; ! if (!PyArg_ParseTuple(_args, "HHl", &refNum, &posMode, *************** *** 2188,2192 **** short fileRefNum; short vRefNum; ! if (!PyArg_ParseTuple(_args, "h", &fileRefNum)) return NULL; --- 2188,2192 ---- short fileRefNum; short vRefNum; ! if (!PyArg_ParseTuple(_args, "H", &fileRefNum)) return NULL; *************** *** 2194,2198 **** &vRefNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", vRefNum); return _res; --- 2194,2198 ---- &vRefNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", vRefNum); return _res; *************** *** 2213,2217 **** &dirID); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("hl", vRefNum, dirID); --- 2213,2217 ---- &dirID); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("Hl", vRefNum, dirID); *************** *** 2228,2232 **** SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "hlO&b", &vRefNum, &dirID, --- 2228,2232 ---- SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "HlO&B", &vRefNum, &dirID, *************** *** 2240,2244 **** &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", refNum); return _res; --- 2240,2244 ---- &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", refNum); return _res; *************** *** 2254,2258 **** SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "hlO&b", &vRefNum, &dirID, --- 2254,2258 ---- SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "HlO&B", &vRefNum, &dirID, *************** *** 2266,2270 **** &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", refNum); return _res; --- 2266,2270 ---- &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", refNum); return _res; *************** *** 2280,2284 **** SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "hlO&b", &vRefNum, &dirID, --- 2280,2284 ---- SInt8 permission; short refNum; ! if (!PyArg_ParseTuple(_args, "HlO&B", &vRefNum, &dirID, *************** *** 2292,2296 **** &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", refNum); return _res; --- 2292,2296 ---- &refNum); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", refNum); return _res; *************** *** 2303,2307 **** short refNum; long count; ! if (!PyArg_ParseTuple(_args, "h", &refNum)) return NULL; --- 2303,2307 ---- short refNum; long count; ! if (!PyArg_ParseTuple(_args, "H", &refNum)) return NULL; *************** *** 2323,2327 **** OSType creator; OSType fileType; ! if (!PyArg_ParseTuple(_args, "hlO&O&O&", &vRefNum, &dirID, --- 2323,2327 ---- OSType creator; OSType fileType; ! if (!PyArg_ParseTuple(_args, "HlO&O&O&", &vRefNum, &dirID, *************** *** 2349,2353 **** Str255 directoryName; long createdDirID; ! if (!PyArg_ParseTuple(_args, "hlO&", &vRefNum, &parentDirID, --- 2349,2353 ---- Str255 directoryName; long createdDirID; ! if (!PyArg_ParseTuple(_args, "HlO&", &vRefNum, &parentDirID, *************** *** 2371,2375 **** long dirID; Str255 fileName; ! if (!PyArg_ParseTuple(_args, "hlO&", &vRefNum, &dirID, --- 2371,2375 ---- long dirID; Str255 fileName; ! if (!PyArg_ParseTuple(_args, "HlO&", &vRefNum, &dirID, *************** *** 2393,2397 **** Str255 fileName; FInfo fndrInfo; ! if (!PyArg_ParseTuple(_args, "hlO&", &vRefNum, &dirID, --- 2393,2397 ---- Str255 fileName; FInfo fndrInfo; ! if (!PyArg_ParseTuple(_args, "HlO&", &vRefNum, &dirID, *************** *** 2416,2420 **** Str255 fileName; FInfo fndrInfo; ! if (!PyArg_ParseTuple(_args, "hlO&O&", &vRefNum, &dirID, --- 2416,2420 ---- Str255 fileName; FInfo fndrInfo; ! if (!PyArg_ParseTuple(_args, "HlO&O&", &vRefNum, &dirID, *************** *** 2439,2443 **** long dirID; Str255 fileName; ! if (!PyArg_ParseTuple(_args, "hlO&", &vRefNum, &dirID, --- 2439,2443 ---- long dirID; Str255 fileName; ! if (!PyArg_ParseTuple(_args, "HlO&", &vRefNum, &dirID, *************** *** 2460,2464 **** long dirID; Str255 fileName; ! if (!PyArg_ParseTuple(_args, "hlO&", &vRefNum, &dirID, --- 2460,2464 ---- long dirID; Str255 fileName; ! if (!PyArg_ParseTuple(_args, "HlO&", &vRefNum, &dirID, *************** *** 2482,2486 **** Str255 oldName; Str255 newName; ! if (!PyArg_ParseTuple(_args, "hlO&O&", &vRefNum, &dirID, --- 2482,2486 ---- Str255 oldName; Str255 newName; ! if (!PyArg_ParseTuple(_args, "HlO&O&", &vRefNum, &dirID, *************** *** 2507,2511 **** long newDirID; Str255 newName; ! if (!PyArg_ParseTuple(_args, "hlO&lO&", &vRefNum, &dirID, --- 2507,2511 ---- long newDirID; Str255 newName; ! if (!PyArg_ParseTuple(_args, "HlO&lO&", &vRefNum, &dirID, *************** *** 2533,2537 **** Str255 fileName; FSSpec spec; ! if (!PyArg_ParseTuple(_args, "hlO&", &vRefNum, &dirID, --- 2533,2537 ---- Str255 fileName; FSSpec spec; ! if (!PyArg_ParseTuple(_args, "HlO&", &vRefNum, &dirID, *************** *** 2554,2558 **** SInt16 forkRefNum; SInt64 position; ! if (!PyArg_ParseTuple(_args, "h", &forkRefNum)) return NULL; --- 2554,2558 ---- SInt16 forkRefNum; SInt64 position; ! if (!PyArg_ParseTuple(_args, "H", &forkRefNum)) return NULL; *************** *** 2572,2576 **** UInt16 positionMode; SInt64 positionOffset; ! if (!PyArg_ParseTuple(_args, "hHL", &forkRefNum, &positionMode, --- 2572,2576 ---- UInt16 positionMode; SInt64 positionOffset; ! if (!PyArg_ParseTuple(_args, "HHL", &forkRefNum, &positionMode, *************** *** 2592,2596 **** SInt16 forkRefNum; SInt64 forkSize; ! if (!PyArg_ParseTuple(_args, "h", &forkRefNum)) return NULL; --- 2592,2596 ---- SInt16 forkRefNum; SInt64 forkSize; ! if (!PyArg_ParseTuple(_args, "H", &forkRefNum)) return NULL; *************** *** 2610,2614 **** UInt16 positionMode; SInt64 positionOffset; ! if (!PyArg_ParseTuple(_args, "hHL", &forkRefNum, &positionMode, --- 2610,2614 ---- UInt16 positionMode; SInt64 positionOffset; ! if (!PyArg_ParseTuple(_args, "HHL", &forkRefNum, &positionMode, *************** *** 2634,2638 **** UInt64 requestCount; UInt64 actualCount; ! if (!PyArg_ParseTuple(_args, "hHHLL", &forkRefNum, &flags, --- 2634,2638 ---- UInt64 requestCount; UInt64 actualCount; ! if (!PyArg_ParseTuple(_args, "HHHLK", &forkRefNum, &flags, *************** *** 2648,2652 **** &actualCount); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("L", actualCount); return _res; --- 2648,2652 ---- &actualCount); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("K", actualCount); return _res; *************** *** 2658,2662 **** OSErr _err; SInt16 forkRefNum; ! if (!PyArg_ParseTuple(_args, "h", &forkRefNum)) return NULL; --- 2658,2662 ---- OSErr _err; SInt16 forkRefNum; ! if (!PyArg_ParseTuple(_args, "H", &forkRefNum)) return NULL; *************** *** 2673,2677 **** OSErr _err; SInt16 forkRefNum; ! if (!PyArg_ParseTuple(_args, "h", &forkRefNum)) return NULL; --- 2673,2677 ---- OSErr _err; SInt16 forkRefNum; ! if (!PyArg_ParseTuple(_args, "H", &forkRefNum)) return NULL; *************** *** 2740,2744 **** FNMessage message; OptionBits flags; ! if (!PyArg_ParseTuple(_args, "sll", &path, &message, --- 2740,2744 ---- FNMessage message; OptionBits flags; ! if (!PyArg_ParseTuple(_args, "skk", &path, &message, *************** *** 2763,2767 **** FNMessage message; OptionBits flags; ! if (!PyArg_ParseTuple(_args, "ll", &message, &flags)) --- 2763,2767 ---- FNMessage message; OptionBits flags; ! if (!PyArg_ParseTuple(_args, "kk", &message, &flags)) *************** *** 2856,2860 **** Boolean wasAliased; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&bl", FSSpec_Convert, &theSpec, &resolveAliasChains, --- 2856,2860 ---- Boolean wasAliased; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&bk", FSSpec_Convert, &theSpec, &resolveAliasChains, *************** *** 2907,2911 **** Boolean wasAliased; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&bl", FSSpec_Convert, &theSpec, &resolveAliasChains, --- 2907,2911 ---- Boolean wasAliased; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&bk", FSSpec_Convert, &theSpec, &resolveAliasChains, *************** *** 2955,2959 **** Boolean wasAliased; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&bl", FSRef_Convert, &theRef, &resolveAliasChains, --- 2955,2959 ---- Boolean wasAliased; unsigned long mountFlags; ! if (!PyArg_ParseTuple(_args, "O&bk", FSRef_Convert, &theRef, &resolveAliasChains, *************** *** 3162,3166 **** } ! if (PyArg_Parse(v, "(hlO&)", &refnum, &parid, PyMac_GetStr255, &path)) { err = FSMakeFSSpec(refnum, parid, path, spec); --- 3162,3166 ---- } ! if (PyArg_Parse(v, "(hkO&)", &refnum, &parid, PyMac_GetStr255, &path)) { err = FSMakeFSSpec(refnum, parid, path, spec); Index: filesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filesupport.py,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** filesupport.py 21 Mar 2003 12:54:24 -0000 1.17 --- filesupport.py 18 Apr 2003 08:58:40 -0000 1.17.2.1 *************** *** 24,34 **** # Various integers: SInt64 = Type("SInt64", "L") ! UInt64 = Type("UInt64", "L") ! FNMessage = Type("FNMessage", "l") FSAllocationFlags = Type("FSAllocationFlags", "H") ! FSCatalogInfoBitmap = Type("FSCatalogInfoBitmap", "l") ! FSIteratorFlags = Type("FSIteratorFlags", "l") ! FSVolumeRefNum = Type("FSVolumeRefNum", "h") ! AliasInfoType = Type("AliasInfoType", "h") # Various types of strings: --- 24,34 ---- # Various integers: SInt64 = Type("SInt64", "L") ! UInt64 = Type("UInt64", "K") ! FNMessage = Type("FNMessage", "k") FSAllocationFlags = Type("FSAllocationFlags", "H") ! FSCatalogInfoBitmap = Type("FSCatalogInfoBitmap", "k") ! FSIteratorFlags = Type("FSIteratorFlags", "k") ! FSVolumeRefNum = Type("FSVolumeRefNum", "H") ! AliasInfoType = Type("AliasInfoType", "H") # Various types of strings: *************** *** 162,166 **** UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr) { ! return PyArg_Parse(v, "(HlH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction); } --- 162,166 ---- UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr) { ! return PyArg_Parse(v, "(HkH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction); } *************** *** 220,224 **** } ! if (PyArg_Parse(v, "(hlO&)", &refnum, &parid, PyMac_GetStr255, &path)) { err = FSMakeFSSpec(refnum, parid, path, spec); --- 220,224 ---- } ! if (PyArg_Parse(v, "(hkO&)", &refnum, &parid, PyMac_GetStr255, &path)) { err = FSMakeFSSpec(refnum, parid, path, spec); *************** *** 347,356 **** ("parentDirID", "return Py_BuildValue(\"l\", self->ob_itself.parentDirID);", ! "return PyArg_Parse(v, \"l\", &self->ob_itself.parentDirID)-1;", None ), ("nodeID", "return Py_BuildValue(\"l\", self->ob_itself.nodeID);", ! "return PyArg_Parse(v, \"l\", &self->ob_itself.nodeID)-1;", None ), --- 347,356 ---- ("parentDirID", "return Py_BuildValue(\"l\", self->ob_itself.parentDirID);", ! "return PyArg_Parse(v, \"k\", &self->ob_itself.parentDirID)-1;", None ), ("nodeID", "return Py_BuildValue(\"l\", self->ob_itself.nodeID);", ! "return PyArg_Parse(v, \"k\", &self->ob_itself.nodeID)-1;", None ), *************** *** 382,386 **** ("permissions", "return Py_BuildValue(\"(llll)\", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]);", ! "return PyArg_Parse(v, \"(llll)\", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1;", None ), --- 382,386 ---- ("permissions", "return Py_BuildValue(\"(llll)\", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]);", ! "return PyArg_Parse(v, \"(kkkk)\", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1;", None ), *************** *** 414,418 **** ("sharingFlags", "return Py_BuildValue(\"l\", self->ob_itself.sharingFlags);", ! "return PyArg_Parse(v, \"l\", &self->ob_itself.sharingFlags)-1;", None ), --- 414,418 ---- ("sharingFlags", "return Py_BuildValue(\"l\", self->ob_itself.sharingFlags);", ! "return PyArg_Parse(v, \"k\", &self->ob_itself.sharingFlags)-1;", None ), From jackjansen@users.sourceforge.net Fri Apr 18 09:59:17 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/icn _Icnmodule.c,1.7,1.7.6.1 icnsupport.py,1.9,1.9.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/icn Modified Files: Tag: getargs_mask_mods _Icnmodule.c icnsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Icnmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/_Icnmodule.c,v retrieving revision 1.7 retrieving revision 1.7.6.1 diff -C2 -d -r1.7 -r1.7.6.1 *** _Icnmodule.c 12 Dec 2002 10:31:51 -0000 1.7 --- _Icnmodule.c 18 Apr 2003 08:58:44 -0000 1.7.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 38,42 **** PyMac_PRECHECK(GetCIcon); #endif ! if (!PyArg_ParseTuple(_args, "h", &iconID)) return NULL; --- 38,42 ---- PyMac_PRECHECK(GetCIcon); #endif ! if (!PyArg_ParseTuple(_args, "H", &iconID)) return NULL; *************** *** 90,94 **** PyMac_PRECHECK(GetIcon); #endif ! if (!PyArg_ParseTuple(_args, "h", &iconID)) return NULL; --- 90,94 ---- PyMac_PRECHECK(GetIcon); #endif ! if (!PyArg_ParseTuple(_args, "H", &iconID)) return NULL; *************** *** 129,133 **** PyMac_PRECHECK(PlotIconID); #endif ! if (!PyArg_ParseTuple(_args, "O&hhh", PyMac_GetRect, &theRect, &align, --- 129,133 ---- PyMac_PRECHECK(PlotIconID); #endif ! if (!PyArg_ParseTuple(_args, "O&HHH", PyMac_GetRect, &theRect, &align, *************** *** 219,223 **** PyMac_PRECHECK(GetIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "hl", &theResID, &selector)) --- 219,223 ---- PyMac_PRECHECK(GetIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "Hk", &theResID, &selector)) *************** *** 264,268 **** PyMac_PRECHECK(PlotIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&hhO&", PyMac_GetRect, &theRect, &align, --- 264,268 ---- PyMac_PRECHECK(PlotIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&HHO&", PyMac_GetRect, &theRect, &align, *************** *** 291,295 **** PyMac_PRECHECK(LoadIconCache); #endif ! if (!PyArg_ParseTuple(_args, "O&hhO&", PyMac_GetRect, &theRect, &align, --- 291,295 ---- PyMac_PRECHECK(LoadIconCache); #endif ! if (!PyArg_ParseTuple(_args, "O&HHO&", PyMac_GetRect, &theRect, &align, *************** *** 317,321 **** PyMac_PRECHECK(GetLabel); #endif ! if (!PyArg_ParseTuple(_args, "hO&", &labelNumber, PyMac_GetStr255, labelString)) --- 317,321 ---- PyMac_PRECHECK(GetLabel); #endif ! if (!PyArg_ParseTuple(_args, "HO&", &labelNumber, PyMac_GetStr255, labelString)) *************** *** 341,345 **** PyMac_PRECHECK(PtInIconID); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hh", PyMac_GetPoint, &testPt, PyMac_GetRect, &iconRect, --- 341,345 ---- PyMac_PRECHECK(PtInIconID); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HH", PyMac_GetPoint, &testPt, PyMac_GetRect, &iconRect, *************** *** 367,371 **** PyMac_PRECHECK(PtInIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hO&", PyMac_GetPoint, &testPt, PyMac_GetRect, &iconRect, --- 367,371 ---- PyMac_PRECHECK(PtInIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HO&", PyMac_GetPoint, &testPt, PyMac_GetRect, &iconRect, *************** *** 393,397 **** PyMac_PRECHECK(RectInIconID); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hh", PyMac_GetRect, &testRect, PyMac_GetRect, &iconRect, --- 393,397 ---- PyMac_PRECHECK(RectInIconID); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HH", PyMac_GetRect, &testRect, PyMac_GetRect, &iconRect, *************** *** 419,423 **** PyMac_PRECHECK(RectInIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hO&", PyMac_GetRect, &testRect, PyMac_GetRect, &iconRect, --- 419,423 ---- PyMac_PRECHECK(RectInIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HO&", PyMac_GetRect, &testRect, PyMac_GetRect, &iconRect, *************** *** 445,449 **** PyMac_PRECHECK(IconIDToRgn); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hh", ResObj_Convert, &theRgn, PyMac_GetRect, &iconRect, --- 445,449 ---- PyMac_PRECHECK(IconIDToRgn); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HH", ResObj_Convert, &theRgn, PyMac_GetRect, &iconRect, *************** *** 472,476 **** PyMac_PRECHECK(IconSuiteToRgn); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hO&", ResObj_Convert, &theRgn, PyMac_GetRect, &iconRect, --- 472,476 ---- PyMac_PRECHECK(IconSuiteToRgn); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HO&", ResObj_Convert, &theRgn, PyMac_GetRect, &iconRect, *************** *** 497,501 **** PyMac_PRECHECK(SetSuiteLabel); #endif ! if (!PyArg_ParseTuple(_args, "O&h", ResObj_Convert, &theSuite, &theLabel)) --- 497,501 ---- PyMac_PRECHECK(SetSuiteLabel); #endif ! if (!PyArg_ParseTuple(_args, "O&H", ResObj_Convert, &theSuite, &theLabel)) *************** *** 521,525 **** return NULL; _rv = GetSuiteLabel(theSuite); ! _res = Py_BuildValue("h", _rv); return _res; --- 521,525 ---- return NULL; _rv = GetSuiteLabel(theSuite); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 537,541 **** PyMac_PRECHECK(PlotIconHandle); #endif ! if (!PyArg_ParseTuple(_args, "O&hhO&", PyMac_GetRect, &theRect, &align, --- 537,541 ---- PyMac_PRECHECK(PlotIconHandle); #endif ! if (!PyArg_ParseTuple(_args, "O&HHO&", PyMac_GetRect, &theRect, &align, *************** *** 564,568 **** PyMac_PRECHECK(PlotSICNHandle); #endif ! if (!PyArg_ParseTuple(_args, "O&hhO&", PyMac_GetRect, &theRect, &align, --- 564,568 ---- PyMac_PRECHECK(PlotSICNHandle); #endif ! if (!PyArg_ParseTuple(_args, "O&HHO&", PyMac_GetRect, &theRect, &align, *************** *** 591,595 **** PyMac_PRECHECK(PlotCIconHandle); #endif ! if (!PyArg_ParseTuple(_args, "O&hhO&", PyMac_GetRect, &theRect, &align, --- 591,595 ---- PyMac_PRECHECK(PlotCIconHandle); #endif ! if (!PyArg_ParseTuple(_args, "O&HHO&", PyMac_GetRect, &theRect, &align, *************** *** 617,621 **** PyMac_PRECHECK(IconRefToIconFamily); #endif ! if (!PyArg_ParseTuple(_args, "O&l", ResObj_Convert, &theIconRef, &whichIcons)) --- 617,621 ---- PyMac_PRECHECK(IconRefToIconFamily); #endif ! if (!PyArg_ParseTuple(_args, "O&k", ResObj_Convert, &theIconRef, &whichIcons)) *************** *** 640,644 **** PyMac_PRECHECK(IconFamilyToIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&l", ResObj_Convert, &iconFamily, &whichIcons)) --- 640,644 ---- PyMac_PRECHECK(IconFamilyToIconSuite); #endif ! if (!PyArg_ParseTuple(_args, "O&k", ResObj_Convert, &iconFamily, &whichIcons)) *************** *** 663,667 **** PyMac_PRECHECK(IconSuiteToIconFamily); #endif ! if (!PyArg_ParseTuple(_args, "O&l", ResObj_Convert, &iconSuite, &whichIcons)) --- 663,667 ---- PyMac_PRECHECK(IconSuiteToIconFamily); #endif ! if (!PyArg_ParseTuple(_args, "O&k", ResObj_Convert, &iconSuite, &whichIcons)) *************** *** 797,801 **** &theLabel); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&h", ResObj_New, theIconRef, theLabel); --- 797,801 ---- &theLabel); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&H", ResObj_New, theIconRef, theLabel); *************** *** 814,818 **** PyMac_PRECHECK(GetIconRef); #endif ! if (!PyArg_ParseTuple(_args, "hO&O&", &vRefNum, PyMac_GetOSType, &creator, --- 814,818 ---- PyMac_PRECHECK(GetIconRef); #endif ! if (!PyArg_ParseTuple(_args, "HO&O&", &vRefNum, PyMac_GetOSType, &creator, *************** *** 842,846 **** PyMac_PRECHECK(GetIconRefFromFolder); #endif ! if (!PyArg_ParseTuple(_args, "hllbb", &vRefNum, &parentFolderID, --- 842,846 ---- PyMac_PRECHECK(GetIconRefFromFolder); #endif ! if (!PyArg_ParseTuple(_args, "HllBB", &vRefNum, &parentFolderID, *************** *** 899,903 **** PyMac_PRECHECK(RegisterIconRefFromResource); #endif ! if (!PyArg_ParseTuple(_args, "O&O&O&h", PyMac_GetOSType, &creator, PyMac_GetOSType, &iconType, --- 899,903 ---- PyMac_PRECHECK(RegisterIconRefFromResource); #endif ! if (!PyArg_ParseTuple(_args, "O&O&O&H", PyMac_GetOSType, &creator, PyMac_GetOSType, &iconType, *************** *** 965,969 **** PyMac_PRECHECK(OverrideIconRefFromResource); #endif ! if (!PyArg_ParseTuple(_args, "O&O&h", ResObj_Convert, &theIconRef, PyMac_GetFSSpec, &resourceFile, --- 965,969 ---- PyMac_PRECHECK(OverrideIconRefFromResource); #endif ! if (!PyArg_ParseTuple(_args, "O&O&H", ResObj_Convert, &theIconRef, PyMac_GetFSSpec, &resourceFile, *************** *** 1093,1097 **** PyMac_PRECHECK(PlotIconRef); #endif ! if (!PyArg_ParseTuple(_args, "O&hhlO&", PyMac_GetRect, &theRect, &align, --- 1093,1097 ---- PyMac_PRECHECK(PlotIconRef); #endif ! if (!PyArg_ParseTuple(_args, "O&HHkO&", PyMac_GetRect, &theRect, &align, *************** *** 1123,1127 **** PyMac_PRECHECK(PtInIconRef); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hlO&", PyMac_GetPoint, &testPt, PyMac_GetRect, &iconRect, --- 1123,1127 ---- PyMac_PRECHECK(PtInIconRef); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HkO&", PyMac_GetPoint, &testPt, PyMac_GetRect, &iconRect, *************** *** 1152,1156 **** PyMac_PRECHECK(RectInIconRef); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hlO&", PyMac_GetRect, &testRect, PyMac_GetRect, &iconRect, --- 1152,1156 ---- PyMac_PRECHECK(RectInIconRef); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HkO&", PyMac_GetRect, &testRect, PyMac_GetRect, &iconRect, *************** *** 1181,1185 **** PyMac_PRECHECK(IconRefToRgn); #endif ! if (!PyArg_ParseTuple(_args, "O&O&hlO&", ResObj_Convert, &theRgn, PyMac_GetRect, &iconRect, --- 1181,1185 ---- PyMac_PRECHECK(IconRefToRgn); #endif ! if (!PyArg_ParseTuple(_args, "O&O&HkO&", ResObj_Convert, &theRgn, PyMac_GetRect, &iconRect, *************** *** 1210,1214 **** PyMac_PRECHECK(GetIconSizesFromIconRef); #endif ! if (!PyArg_ParseTuple(_args, "llO&", &iconSelectorInput, &iconServicesUsageFlags, --- 1210,1214 ---- PyMac_PRECHECK(GetIconSizesFromIconRef); #endif ! if (!PyArg_ParseTuple(_args, "kkO&", &iconSelectorInput, &iconServicesUsageFlags, *************** *** 1220,1224 **** theIconRef); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("l", iconSelectorOutputPtr); return _res; --- 1220,1224 ---- theIconRef); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("k", iconSelectorOutputPtr); return _res; *************** *** 1254,1258 **** PyMac_PRECHECK(FlushIconRefsByVolume); #endif ! if (!PyArg_ParseTuple(_args, "h", &vRefNum)) return NULL; --- 1254,1258 ---- PyMac_PRECHECK(FlushIconRefsByVolume); #endif ! if (!PyArg_ParseTuple(_args, "H", &vRefNum)) return NULL; *************** *** 1273,1277 **** PyMac_PRECHECK(SetCustomIconsEnabled); #endif ! if (!PyArg_ParseTuple(_args, "hb", &vRefNum, &enableCustomIcons)) --- 1273,1277 ---- PyMac_PRECHECK(SetCustomIconsEnabled); #endif ! if (!PyArg_ParseTuple(_args, "Hb", &vRefNum, &enableCustomIcons)) *************** *** 1294,1298 **** PyMac_PRECHECK(GetCustomIconsEnabled); #endif ! if (!PyArg_ParseTuple(_args, "h", &vRefNum)) return NULL; --- 1294,1298 ---- PyMac_PRECHECK(GetCustomIconsEnabled); #endif ! if (!PyArg_ParseTuple(_args, "H", &vRefNum)) return NULL; *************** *** 1339,1343 **** inVariant, &outTransform); ! _res = Py_BuildValue("O&h", ResObj_New, _rv, outTransform); --- 1339,1343 ---- inVariant, &outTransform); ! _res = Py_BuildValue("O&H", ResObj_New, _rv, outTransform); Index: icnsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnsupport.py,v retrieving revision 1.9 retrieving revision 1.9.6.1 diff -C2 -d -r1.9 -r1.9.6.1 *** icnsupport.py 3 Dec 2002 23:40:20 -0000 1.9 --- icnsupport.py 18 Apr 2003 08:58:44 -0000 1.9.6.1 *************** *** 28,35 **** IconFamilyHandle = OpaqueByValueType("IconFamilyHandle", "ResObj") RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") ! IconAlignmentType = Type("IconAlignmentType", "h") ! IconTransformType = Type("IconTransformType", "h") ! IconSelectorValue = Type("IconSelectorValue", "l") ! IconServicesUsageFlags = Type("IconServicesUsageFlags", "l") RGBColor = OpaqueType("RGBColor", "QdRGB") --- 28,35 ---- IconFamilyHandle = OpaqueByValueType("IconFamilyHandle", "ResObj") RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") ! IconAlignmentType = Type("IconAlignmentType", "H") ! IconTransformType = Type("IconTransformType", "H") ! IconSelectorValue = Type("IconSelectorValue", "k") ! IconServicesUsageFlags = Type("IconServicesUsageFlags", "k") RGBColor = OpaqueType("RGBColor", "QdRGB") From jackjansen@users.sourceforge.net Fri Apr 18 09:59:16 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c,1.8,1.8.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/help Modified Files: Tag: getargs_mask_mods _Helpmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Helpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/_Helpmodule.c,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -C2 -d -r1.8 -r1.8.6.1 *** _Helpmodule.c 18 Nov 2002 15:26:38 -0000 1.8 --- _Helpmodule.c 18 Apr 2003 08:58:43 -0000 1.8.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 81,85 **** OSStatus _err; Duration inDelay; ! if (!PyArg_ParseTuple(_args, "l", &inDelay)) return NULL; --- 81,85 ---- OSStatus _err; Duration inDelay; ! if (!PyArg_ParseTuple(_args, "k", &inDelay)) return NULL; *************** *** 100,104 **** _err = HMGetTagDelay(&outDelay); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("l", outDelay); return _res; --- 100,104 ---- _err = HMGetTagDelay(&outDelay); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("k", outDelay); return _res; *************** *** 111,115 **** MenuRef inMenu; SInt16 inHmnuRsrcID; ! if (!PyArg_ParseTuple(_args, "O&h", MenuObj_Convert, &inMenu, &inHmnuRsrcID)) --- 111,115 ---- MenuRef inMenu; SInt16 inHmnuRsrcID; ! if (!PyArg_ParseTuple(_args, "O&H", MenuObj_Convert, &inMenu, &inHmnuRsrcID)) *************** *** 130,134 **** SInt16 inHdlgRsrcID; SInt16 inItemStart; ! if (!PyArg_ParseTuple(_args, "O&hh", DlgObj_Convert, &inDialog, &inHdlgRsrcID, --- 130,134 ---- SInt16 inHdlgRsrcID; SInt16 inItemStart; ! if (!PyArg_ParseTuple(_args, "O&HH", DlgObj_Convert, &inDialog, &inHdlgRsrcID, From jackjansen@users.sourceforge.net Fri Apr 18 09:59:18 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/list _Listmodule.c,1.16,1.16.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/list Modified Files: Tag: getargs_mask_mods _Listmodule.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Listmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/_Listmodule.c,v retrieving revision 1.16 retrieving revision 1.16.6.1 diff -C2 -d -r1.16 -r1.16.6.1 *** _Listmodule.c 23 Dec 2002 23:16:23 -0000 1.16 --- _Listmodule.c 18 Apr 2003 08:58:45 -0000 1.16.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 122,126 **** short count; short colNum; ! if (!PyArg_ParseTuple(_args, "hh", &count, &colNum)) --- 122,126 ---- short count; short colNum; ! if (!PyArg_ParseTuple(_args, "HH", &count, &colNum)) *************** *** 129,133 **** colNum, _self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 129,133 ---- colNum, _self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 140,144 **** short count; short rowNum; ! if (!PyArg_ParseTuple(_args, "hh", &count, &rowNum)) --- 140,144 ---- short count; short rowNum; ! if (!PyArg_ParseTuple(_args, "HH", &count, &rowNum)) *************** *** 147,151 **** rowNum, _self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 147,151 ---- rowNum, _self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 157,161 **** short count; short colNum; ! if (!PyArg_ParseTuple(_args, "hh", &count, &colNum)) --- 157,161 ---- short count; short colNum; ! if (!PyArg_ParseTuple(_args, "HH", &count, &colNum)) *************** *** 174,178 **** short count; short rowNum; ! if (!PyArg_ParseTuple(_args, "hh", &count, &rowNum)) --- 174,178 ---- short count; short rowNum; ! if (!PyArg_ParseTuple(_args, "HH", &count, &rowNum)) *************** *** 244,248 **** short listWidth; short listHeight; ! if (!PyArg_ParseTuple(_args, "hh", &listWidth, &listHeight)) --- 244,248 ---- short listWidth; short listHeight; ! if (!PyArg_ParseTuple(_args, "HH", &listWidth, &listHeight)) *************** *** 275,279 **** short dCols; short dRows; ! if (!PyArg_ParseTuple(_args, "hh", &dCols, &dRows)) --- 275,279 ---- short dCols; short dRows; ! if (!PyArg_ParseTuple(_args, "HH", &dCols, &dRows)) *************** *** 499,503 **** theCell, _self->ob_itself); ! _res = Py_BuildValue("hh", offset, len); --- 499,503 ---- theCell, _self->ob_itself); ! _res = Py_BuildValue("HH", offset, len); *************** *** 620,624 **** return NULL; _rv = GetListFlags(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 620,624 ---- return NULL; _rv = GetListFlags(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 632,636 **** return NULL; _rv = GetListSelectionFlags(_self->ob_itself); ! _res = Py_BuildValue("l", _rv); return _res; --- 632,636 ---- return NULL; _rv = GetListSelectionFlags(_self->ob_itself); ! _res = Py_BuildValue("k", _rv); return _res; *************** *** 899,903 **** Boolean scrollHoriz; Boolean scrollVert; ! if (!PyArg_ParseTuple(_args, "O&O&O&hO&bbbb", PyMac_GetRect, &rView, PyMac_GetRect, &dataBounds, --- 899,903 ---- Boolean scrollHoriz; Boolean scrollVert; ! if (!PyArg_ParseTuple(_args, "O&O&O&HO&bbbb", PyMac_GetRect, &rView, PyMac_GetRect, &dataBounds, *************** *** 1025,1029 **** ListHandle list; OptionBits listFlags; ! if (!PyArg_ParseTuple(_args, "O&l", ListObj_Convert, &list, &listFlags)) --- 1025,1029 ---- ListHandle list; OptionBits listFlags; ! if (!PyArg_ParseTuple(_args, "O&k", ListObj_Convert, &list, &listFlags)) *************** *** 1041,1045 **** ListHandle list; OptionBits selectionFlags; ! if (!PyArg_ParseTuple(_args, "O&l", ListObj_Convert, &list, &selectionFlags)) --- 1041,1045 ---- ListHandle list; OptionBits selectionFlags; ! if (!PyArg_ParseTuple(_args, "O&k", ListObj_Convert, &list, &selectionFlags)) From jackjansen@users.sourceforge.net Fri Apr 18 09:59:19 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:19 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu _Menumodule.c,1.17,1.17.6.1 menusupport.py,1.20,1.20.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/menu Modified Files: Tag: getargs_mask_mods _Menumodule.c menusupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -C2 -d -r1.17 -r1.17.6.1 *** _Menumodule.c 23 Dec 2002 23:16:23 -0000 1.17 --- _Menumodule.c 18 Apr 2003 08:58:46 -0000 1.17.6.1 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ [...1737 lines suppressed...] return _res; --- 3336,3340 ---- &outSize); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("k", outSize); return _res; *************** *** 3352,3356 **** PyMac_PRECHECK(RemoveMenuCommandProperty); #endif ! if (!PyArg_ParseTuple(_args, "O&lO&O&", OptMenuObj_Convert, &inMenu, &inCommandID, --- 3352,3356 ---- PyMac_PRECHECK(RemoveMenuCommandProperty); #endif ! if (!PyArg_ParseTuple(_args, "O&kO&O&", OptMenuObj_Convert, &inMenu, &inCommandID, Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.20 retrieving revision 1.20.6.1 diff -C2 -d -r1.20 -r1.20.6.1 *** menusupport.py 23 Dec 2002 23:16:23 -0000 1.20 --- menusupport.py 18 Apr 2003 08:58:46 -0000 1.20.6.1 *************** *** 28,41 **** Handle = OpaqueByValueType("Handle", "ResObj") MenuBarHandle = OpaqueByValueType("MenuBarHandle", "ResObj") ! MenuID = Type("MenuID", "h") ! MenuItemIndex = Type("MenuItemIndex", "h") ! MenuItemID = Type("MenuItemID", "l") ! MenuCommand = Type("MenuCommand", "l") ! MenuAttributes = Type("MenuAttributes", "l") ! MenuItemAttributes = Type("MenuItemAttributes", "l") unsigned_char = Type('unsigned char', 'b') ! FMFontFamily = Type("FMFontFamily", "h") ! FMFontStyle = Type("FMFontStyle", "h") ! UniChar = Type("UniChar", "h") includestuff = includestuff + """ --- 28,41 ---- Handle = OpaqueByValueType("Handle", "ResObj") MenuBarHandle = OpaqueByValueType("MenuBarHandle", "ResObj") ! MenuID = Type("MenuID", "H") ! MenuItemIndex = Type("MenuItemIndex", "H") ! MenuItemID = Type("MenuItemID", "k") ! MenuCommand = Type("MenuCommand", "k") ! MenuAttributes = Type("MenuAttributes", "k") ! MenuItemAttributes = Type("MenuItemAttributes", "k") unsigned_char = Type('unsigned char', 'b') ! FMFontFamily = Type("FMFontFamily", "H") ! FMFontStyle = Type("FMFontStyle", "H") ! UniChar = Type("UniChar", "H") includestuff = includestuff + """ From jackjansen@users.sourceforge.net Fri Apr 18 10:12:54 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 02:12:54 -0700 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.19,1.19.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv9035/Python Modified Files: Tag: getargs_mask_mods mactoolboxglue.c Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** mactoolboxglue.c 17 Apr 2003 20:44:18 -0000 1.19 --- mactoolboxglue.c 18 Apr 2003 09:12:51 -0000 1.19.2.1 *************** *** 382,386 **** PyMac_GetRect(PyObject *v, Rect *r) { ! return PyArg_Parse(v, "(hhhh)", &r->left, &r->top, &r->right, &r->bottom); } --- 382,386 ---- PyMac_GetRect(PyObject *v, Rect *r) { ! return PyArg_Parse(v, "(HHHH)", &r->left, &r->top, &r->right, &r->bottom); } *************** *** 400,404 **** PyMac_GetPoint(PyObject *v, Point *p) { ! return PyArg_Parse(v, "(hh)", &p->h, &p->v); } --- 400,404 ---- PyMac_GetPoint(PyObject *v, Point *p) { ! return PyArg_Parse(v, "(HH)", &p->h, &p->v); } *************** *** 416,420 **** PyMac_GetEventRecord(PyObject *v, EventRecord *e) { ! return PyArg_Parse(v, "(Hkk(hh)H)", &e->what, &e->message, --- 416,420 ---- PyMac_GetEventRecord(PyObject *v, EventRecord *e) { ! return PyArg_Parse(v, "(Hkk(HH)H)", &e->what, &e->message, From jackjansen@users.sourceforge.net Fri Apr 18 09:59:16 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 18 Apr 2003 01:59:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/htmlrender htmlsupport.py,1.3,1.3.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/htmlrender In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/htmlrender Modified Files: Tag: getargs_mask_mods htmlsupport.py Log Message: Fixes for the new PyArg_ParseTuple k and K format chars, and the changed semantics of h. Only lightly tested, but the IDE works again. These changes may not be needed anymore now that the semantic change to h has been reverted, so I'm checking it in on a branch. Index: htmlsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/htmlrender/htmlsupport.py,v retrieving revision 1.3 retrieving revision 1.3.30.1 diff -C2 -d -r1.3 -r1.3.30.1 *** htmlsupport.py 7 Jul 2000 13:09:33 -0000 1.3 --- htmlsupport.py 18 Apr 2003 08:58:44 -0000 1.3.30.1 *************** *** 10,14 **** HRReference = OpaqueByValueType("HRReference", "HtmlObj") ! HRScrollbarState = Type("HRScrollbarState", "h") URLSourceType = Type("URLSourceType", "H") GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") --- 10,14 ---- HRReference = OpaqueByValueType("HRReference", "HtmlObj") ! HRScrollbarState = Type("HRScrollbarState", "H") URLSourceType = Type("URLSourceType", "H") GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") From loewis@users.sourceforge.net Fri Apr 18 11:39:54 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:39:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings idna.py,NONE,1.1 punycode.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Lib/encodings Added Files: idna.py punycode.py Log Message: Implement IDNA (Internationalized Domain Names in Applications). --- NEW FILE: idna.py --- # This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep) import stringprep, unicodedata, re, codecs # IDNA section 3.1 dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]") # IDNA section 5 ace_prefix = "xn--" uace_prefix = unicode(ace_prefix, "ascii") # This assumes query strings, so AllowUnassigned is true def nameprep(label): # Map newlabel = [] for c in label: if stringprep.in_table_b1(c): # Map to nothing continue newlabel.append(stringprep.map_table_b2(c)) label = u"".join(newlabel) # Normalize label = unicodedata.normalize("NFKC", label) # Prohibit for c in label: if stringprep.in_table_c12(c) or \ stringprep.in_table_c22(c) or \ stringprep.in_table_c3(c) or \ stringprep.in_table_c4(c) or \ stringprep.in_table_c5(c) or \ stringprep.in_table_c6(c) or \ stringprep.in_table_c7(c) or \ stringprep.in_table_c8(c) or \ stringprep.in_table_c9(c): raise UnicodeError, "Invalid character %s" % repr(c) # Check bidi RandAL = map(stringprep.in_table_d1, label) for c in RandAL: if c: # There is a RandAL char in the string. Must perform further # tests: # 1) The characters in section 5.8 MUST be prohibited. # This is table C.8, which was already checked # 2) If a string contains any RandALCat character, the string # MUST NOT contain any LCat character. if filter(stringprep.in_table_d2, label): raise UnicodeError, "Violation of BIDI requirement 2" # 3) If a string contains any RandALCat character, a # RandALCat character MUST be the first character of the # string, and a RandALCat character MUST be the last # character of the string. if not RandAL[0] or not RandAL[-1]: raise UnicodeError, "Violation of BIDI requirement 3" return label def ToASCII(label): try: # Step 1: try ASCII label = label.encode("ascii") except UnicodeError: pass else: # Skip to step 3: UseSTD3ASCIIRules is false, so # Skip to step 8. if 0 < len(label) < 64: return label raise UnicodeError, "label too long" # Step 2: nameprep label = nameprep(label) # Step 3: UseSTD3ASCIIRules is false # Step 4: try ASCII try: label = label.encode("ascii") except UnicodeError: pass else: # Skip to step 8. if 0 < len(label) < 64: return label raise UnicodeError, "label too long" # Step 5: Check ACE prefix if label.startswith(uace_prefix): raise UnicodeError, "Label starts with ACE prefix" # Step 6: Encode with PUNYCODE label = label.encode("punycode") # Step 7: Prepend ACE prefix label = ace_prefix + label # Step 8: Check size if 0 < len(label) < 64: return label raise UnicodeError, "label too long" def ToUnicode(label): # Step 1: Check for ASCII if isinstance(label, str): pure_ascii = True else: try: label = label.encode("ascii") pure_ascii = True except UnicodeError: pure_ascii = False if not pure_ascii: # Step 2: Perform nameprep label = nameprep(label) # It doesn't say this, but apparently, it should be ASCII now try: label = label.encode("ascii") except UnicodeError: raise UnicodeError, "Invalid character in IDN label" # Step 3: Check for ACE prefix if not label.startswith(ace_prefix): return unicode(label, "ascii") # Step 4: Remove ACE prefix label1 = label[len(ace_prefix):] # Step 5: Decode using PUNYCODE result = label1.decode("punycode") # Step 6: Apply ToASCII label2 = ToASCII(result) # Step 7: Compare the result of step 6 with the one of step 3 # label2 will already be in lower case. if label.lower() != label2: raise UnicodeError, ("IDNA does not round-trip", label, label2) # Step 8: return the result of step 5 return result ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): if errors != 'strict': # IDNA is quite clear that implementations must be strict raise UnicodeError, "unsupported error handling "+errors result = [] for label in dots.split(input): result.append(ToASCII(label)) # Join with U+002E return ".".join(result), len(input) def decode(self,input,errors='strict'): if errors != 'strict': raise UnicodeError, "Unsupported error handling "+errors # IDNA allows decoding to operate on Unicode strings, too. if isinstance(input, unicode): labels = dots.split(input) else: # Must be ASCII string unicode(input, "ascii") labels = input.split(".") result = [] for label in labels: result.append(ToUnicode(label)) return u".".join(result), len(input) class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter) --- NEW FILE: punycode.py --- (This appears to be a binary file; contents omitted.) From loewis@users.sourceforge.net Fri Apr 18 11:39:55 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:39:55 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.732,1.733 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Misc Modified Files: NEWS Log Message: Implement IDNA (Internationalized Domain Names in Applications). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.732 retrieving revision 1.733 diff -C2 -d -r1.732 -r1.733 *** NEWS 18 Apr 2003 00:45:58 -0000 1.732 --- NEWS 18 Apr 2003 10:39:52 -0000 1.733 *************** *** 119,122 **** --- 119,127 ---- ------- + - Support for internationalized domain names has been added through + the 'idna' and 'punycode' encodings, the 'stringprep' module, the + 'mkstringprep' tool, and enhancements to the socket and httplib + modules. + - htmlentitydefs has two new dictionaries: name2codepoint maps HTML entity names to Unicode codepoints (as integers). From loewis@users.sourceforge.net Fri Apr 18 11:39:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:39:56 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.258,1.259 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Modules Modified Files: socketmodule.c Log Message: Implement IDNA (Internationalized Domain Names in Applications). Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -d -r1.258 -r1.259 *** socketmodule.c 29 Mar 2003 10:04:54 -0000 1.258 --- socketmodule.c 18 Apr 2003 10:39:53 -0000 1.259 *************** *** 875,879 **** return 0; } ! if (!PyArg_ParseTuple(args, "si:getsockaddrarg", &host, &port)) return 0; if (setipaddr(host, (struct sockaddr *)addr, sizeof(*addr), AF_INET) < 0) --- 875,880 ---- return 0; } ! if (!PyArg_ParseTuple(args, "eti:getsockaddrarg", ! "idna", &host, &port)) return 0; if (setipaddr(host, (struct sockaddr *)addr, sizeof(*addr), AF_INET) < 0) *************** *** 894,898 **** addr = (struct sockaddr_in6*)&(s->sock_addr).in6; flowinfo = scope_id = 0; ! if (!PyArg_ParseTuple(args, "si|ii", &host, &port, &flowinfo, &scope_id)) { return 0; --- 895,900 ---- addr = (struct sockaddr_in6*)&(s->sock_addr).in6; flowinfo = scope_id = 0; ! if (!PyArg_ParseTuple(args, "eti|ii", ! "idna", &host, &port, &flowinfo, &scope_id)) { return 0; *************** *** 2783,2786 **** --- 2785,2789 ---- struct addrinfo hints, *res; struct addrinfo *res0 = NULL; + PyObject *hobj = NULL; PyObject *pobj = (PyObject *)NULL; char pbuf[30]; *************** *** 2790,2799 **** PyObject *all = (PyObject *)NULL; PyObject *single = (PyObject *)NULL; family = socktype = protocol = flags = 0; family = AF_UNSPEC; ! if (!PyArg_ParseTuple(args, "zO|iiii:getaddrinfo", ! &hptr, &pobj, &family, &socktype, ! &protocol, &flags)) { return NULL; } --- 2793,2817 ---- PyObject *all = (PyObject *)NULL; PyObject *single = (PyObject *)NULL; + PyObject *idna = NULL; family = socktype = protocol = flags = 0; family = AF_UNSPEC; ! if (!PyArg_ParseTuple(args, "OO|iiii:getaddrinfo", ! &hobj, &pobj, &family, &socktype, ! &protocol, &flags)) { ! return NULL; ! } ! if (hobj == Py_None) { ! hptr = NULL; ! } else if (PyUnicode_Check(hobj)) { ! idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); ! if (!idna) ! return NULL; ! hptr = PyString_AsString(idna); ! } else if (PyString_Check(hobj)) { ! hptr = PyString_AsString(hobj); ! } else { ! PyErr_SetString(PyExc_TypeError, ! "getaddrinfo() argument 1 must be string or None"); return NULL; } *************** *** 2839,2842 **** --- 2857,2861 ---- Py_XDECREF(single); } + Py_XDECREF(idna); if (res0) freeaddrinfo(res0); *************** *** 2845,2848 **** --- 2864,2868 ---- Py_XDECREF(single); Py_XDECREF(all); + Py_XDECREF(idna); if (res0) freeaddrinfo(res0); From loewis@users.sourceforge.net Fri Apr 18 11:40:23 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:40:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.137,1.138 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Implement IDNA (Internationalized Domain Names in Applications). Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** whatsnew23.tex 14 Apr 2003 18:47:28 -0000 1.137 --- whatsnew23.tex 18 Apr 2003 10:39:51 -0000 1.138 *************** *** 1792,1795 **** --- 1792,1816 ---- Any breakage caused by this change should be reported as a bug. + \item Support for internationalized domain names (RFCs 3454, 3490, + 3491, and 3492) has been added. The ``idna'' encoding can be used + to convert between a Unicode domain name and the ASCII-compatible + encoding (ACE). + + \begin{verbatim} + >>> u"www.Alliancefran\,caise.nu".encode("idna") + 'www.xn--alliancefranaise-npb.nu' + \end{verbatim} + + In addition, the \module{socket} has been extended to transparently + convert Unicode hostnames to the ACE before passing them to the C + library. In turn, modules that pass hostnames ``through'' (such as + \module{httplib}, \module{ftplib}) also support Unicode host names + (httplib also sends ACE Host: headers). \module{urllib} supports + Unicode URLs with non-ASCII host names as long as the \code{path} part + of the URL is ASCII only. + + To implement this change, the module \module{stringprep}, the tool + \code{mkstringprep} and the \code{punycode} encoding have been added. + \end{itemize} From loewis@users.sourceforge.net Fri Apr 18 11:40:23 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:40:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstringprep.tex,NONE,1.1 lib.tex,1.218,1.219 libcodecs.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Doc/lib Modified Files: lib.tex libcodecs.tex Added Files: libstringprep.tex Log Message: Implement IDNA (Internationalized Domain Names in Applications). --- NEW FILE: libstringprep.tex --- \section{\module{stringprep} --- Internet String Preparation} \declaremodule{standard}{stringprep} \modulesynopsis{String preparation, as per RFC 3453} \moduleauthor{Martin v. L\"owis}{martin@v.loewis.de} \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for ``equality''. Exactly how this comparison is executed may depend on the application domain, e.g. whether it should be case-insensitive or not. It may be also necessary to restrict the possible identifications, to allow only identifications consisting of ``printable'' characters. \rfc{3454} defines a procedure for ``preparing'' Unicode strings in internet protocols. Before passing strings onto the wire, they are processed with the preparation procedure, after which they have a certain normalized form. The RFC defines a set of tables, which can be combined into profiles. Each profile must define which tables it uses, and what other optional parts of the \code{stringprep} procedure are part of the profile. One example of a \code{stringprep} profile is \code{nameprep}, which is used for internationalized domain names. The module \module{stringprep} only exposes the tables from RFC 3454. As these tables would be very large to represent them as dictionaries or lists, the module uses the Unicode character database internally. The module source code itself was generated using the \code{mkstringprep.py} utility. As a result, these tables are exposed as functions, not as data structures. There are two kinds of tables in the RFC: sets and mappings. For a set, \module{stringprep} provides the ``characteristic function'', i.e. a function that returns true if the parameter is part of the set. For mappings, it provides the mapping function: given the key, it returns the associated value. Below is a list of all functions available in the module. \begin{funcdesc}{in_table_a1}{code} Determine whether \var{code} is in table{A.1} (Unassigned code points in Unicode 3.2). \end{funcdesc} \begin{funcdesc}{in_table_b1}{code} Determine whether \var{code} is in table{B.1} (Commonly mapped to nothing). \end{funcdesc} \begin{funcdesc}{map_table_b2}{code} Return the mapped value for \var{code} according to table{B.2} (Mapping for case-folding used with NFKC). \end{funcdesc} \begin{funcdesc}{map_table_b3}{code} Return the mapped value for \var{code} according to table{B.3} (Mapping for case-folding used with no normalization). \end{funcdesc} \begin{funcdesc}{in_table_c11}{code} Determine whether \var{code} is in table{C.1.1} (ASCII space characters). \end{funcdesc} \begin{funcdesc}{in_table_c12}{code} Determine whether \var{code} is in table{C.1.2} (Non-ASCII space characters). \end{funcdesc} \begin{funcdesc}{in_table_c11_c12}{code} Determine whether \var{code} is in table{C.1} (Space characters, union of C.1.1 and C.1.2). \end{funcdesc} \begin{funcdesc}{in_table_c21}{code} Determine whether \var{code} is in table{C.2.1} (ASCII control characters). \end{funcdesc} \begin{funcdesc}{in_table_c22}{code} Determine whether \var{code} is in table{C.2.2} (Non-ASCII control characters). \end{funcdesc} \begin{funcdesc}{in_table_c21_c22}{code} Determine whether \var{code} is in table{C.2} (Control characters, union of C.2.1 and C.2.2). \end{funcdesc} \begin{funcdesc}{in_table_c3}{code} Determine whether \var{code} is in table{C.3} (Private use). \end{funcdesc} \begin{funcdesc}{in_table_c4}{code} Determine whether \var{code} is in table{C.4} (Non-character code points). \end{funcdesc} \begin{funcdesc}{in_table_c5}{code} Determine whether \var{code} is in table{C.5} (Surrogate codes). \end{funcdesc} \begin{funcdesc}{in_table_c6}{code} Determine whether \var{code} is in table{C.6} (Inappropriate for plain text). \end{funcdesc} \begin{funcdesc}{in_table_c7}{code} Determine whether \var{code} is in table{C.7} (Inappropriate for canonical representation). \end{funcdesc} \begin{funcdesc}{in_table_c8}{code} Determine whether \var{code} is in table{C.8} (Change display properties or are deprecated). \end{funcdesc} \begin{funcdesc}{in_table_c9}{code} Determine whether \var{code} is in table{C.9} (Tagging characters). \end{funcdesc} \begin{funcdesc}{in_table_d1}{code} Determine whether \var{code} is in table{D.1} (Characters with bidirectional property ``R'' or ``AL''). \end{funcdesc} \begin{funcdesc}{in_table_d2}{code} Determine whether \var{code} is in table{D.2} (Characters with bidirectional property ``L''). \end{funcdesc} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -d -r1.218 -r1.219 *** lib.tex 9 Apr 2003 01:39:06 -0000 1.218 --- lib.tex 18 Apr 2003 10:39:50 -0000 1.219 *************** *** 113,116 **** --- 113,117 ---- \input{libcodecs} \input{libunicodedata} + \input{libstringprep} \input{libmisc} % Miscellaneous Services Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libcodecs.tex 31 Jan 2003 17:19:04 -0000 1.17 --- libcodecs.tex 18 Apr 2003 10:39:50 -0000 1.18 *************** *** 6,10 **** \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \index{Unicode} --- 6,10 ---- \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \index{Unicode} *************** *** 810,813 **** --- 810,818 ---- {Convert operand to hexadecimal representation, with two digits per byte} + \lineiv{idna} + {} + {Unicode string} + {Implements \rfc{3490}. \versionadded{2.3}. See also \module{encodings.idna}} + \lineiv{mbcs} {dbcs} *************** *** 820,823 **** --- 825,833 ---- {Encoding of PalmOS 3.5} + \lineiv{punycode} + {} + {Unicode string} + {Implements \rfc{3492}. \versionadded{2.3}} + \lineiv{quopri_codec} {quopri, quoted-printable, quotedprintable} *************** *** 866,867 **** --- 876,937 ---- \end{tableiv} + + \subsection{\module{encodings.idna} --- + Internationalized Domain Names in Applications} + + \declaremodule{standard}{encodings.idna} + \modulesynopsis{Internationalized Domain Names implementation} + \moduleauthor{Martin v. L\"owis} + + This module implements \rfc{3490} (Internationalized Domain Names in + Applications) and \rfc{3492} (Nameprep: A Stringprep Profile for + Internationalized Domain Names (IDN)). It builds upon the + \code{punycode} encoding and \module{stringprep}. \versionadded{2.3} + + These RFCs together define a protocol to support non-ASCII characters + in domain names. A domain name containing non-ASCII characters (such + as ``www.Alliancefran\,caise.nu'') is converted into an + ASCII-compatible encoding (ACE, such as + ``www.xn--alliancefranaise-npb.nu''). The ACE form of the domain name + is then used in all places where arbitrary characters are not allowed + by the protocol, such as DNS queries, HTTP \code{Host:} fields, and so + on. This conversion is carried out in the application; if possible + invisible to the user: The application should transparently convert + Unicode domain labels to IDNA on the wire, and convert back ACE labels + to Unicode before presenting them to the user. + + Python supports this conversion in several ways: The \code{idna} codec + allows to convert between Unicode and the ACE. Furthermore, the + \module{socket} module transparently converts Unicode host names to + ACE, so that applications need not be concerned about converting host + names themselves when they pass them to the socket module. On top of + that, modules that have host names as function parameters, such as + \module{httplib} and \module{ftplib}, accept Unicode host names + (\module{httplib} then also transparently sends an IDNA hostname in + the \code{Host:} field if it sends that field at all). + + When receiving host names from the wire (such as in reverse name + lookup), no automatic conversion to Unicode is performed: Applications + wishing to present such host names to the user should decode them to + Unicode. + + The module \module{encodings.idna} also implements the nameprep + procedure, which performs certain normalizations on host names, to + achieve case-insensitivity of international domain names, and to unify + similar characters. The nameprep functions can be used directly if + desired. + + \begin{funcdesc}{nameprep}{label} + Return the nameprepped version of \var{label}. The implementation + currently assumes query strings, so \code{AllowUnassigned} is + true. + \end{funcdesc} + + \begin{funcdesc}{ToASCCII}{label} + Convert a label to ASCII, as specified in \rfc{3490}. + \code{UseSTD3ASCIIRules} is assumed to be false. + \end{funcdesc} + + \begin{funcdesc}{ToUnicode}{label} + Convert a label to Unicode, as specified in \rfc{3490}. + \end{funcdesc} From loewis@users.sourceforge.net Fri Apr 18 11:39:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:39:56 -0700 Subject: [Python-checkins] python/dist/src/Tools/unicode mkstringprep.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/unicode In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Tools/unicode Added Files: mkstringprep.py Log Message: Implement IDNA (Internationalized Domain Names in Applications). --- NEW FILE: mkstringprep.py --- import re, unicodedata, sys, sets from sets import Set if sys.maxunicode == 65535: raise RuntimeError, "need UCS-4 Python" def gen_category(cats): for i in range(0, 0x110000): if unicodedata.category(unichr(i)) in cats: yield(i) def gen_bidirectional(cats): for i in range(0, 0x110000): if unicodedata.bidirectional(unichr(i)) in cats: yield(i) def compact_set(l): single = [] tuple = [] prev = None span = 0 for e in l: if prev is None: prev = e span = 0 continue if prev+span+1 != e: if span > 2: tuple.append((prev,prev+span+1)) else: for i in range(prev, prev+span+1): single.append(i) prev = e span = 0 else: span += 1 if span: tuple.append((prev,prev+span+1)) else: single.append(prev) tuple = " + ".join(["range(%d,%d)" % t for t in tuple]) if not single: return "sets.Set(%s)" % tuple if not tuple: return "sets.Set(%s)" % repr(single) return "sets.Set(%s + %s)" % (repr(single),tuple) ############## Read the tables in the RFC ####################### data = open("rfc3454.txt").readlines() tables = [] curname = None for l in data: l = l.strip() if not l: continue # Skip RFC page breaks if l.startswith("Hoffman & Blanchet") or\ l.startswith("RFC 3454"): continue # Find start/end lines m = re.match("----- (Start|End) Table ([A-Z](.[0-9])+) -----", l) if m: if m.group(1) == "Start": if curname: raise "Double Start",(curname, l) curname = m.group(2) table = {} tables.append((curname, table)) continue else: if not curname: raise "End without start", l curname = None continue if not curname: continue # Now we are in a table fields = l.split(";") if len(fields) > 1: # Drop comment field fields = fields[:-1] if len(fields) == 1: fields = fields[0].split("-") if len(fields) > 1: # range try: start, end = fields except ValueError: raise "Unpacking problem", l else: start = end = fields[0] start = int(start, 16) end = int(end, 16) for i in range(start, end+1): table[i] = i else: code, value = fields value = value.strip() if value: value = [int(v, 16) for v in value.split(" ")] else: # table B.1 value = None table[int(code, 16)] = value ########### Generate compact Python versions of the tables ############# print """# This file is generated by mkstringprep.py. DO NOT EDIT. \"\"\"Library that exposes various tables found in the StringPrep RFC 3454. There are two kinds of tables: sets, for which a member test is provided, and mappings, for which a mapping function is provided. \"\"\" import unicodedata, sets """ print "assert unicodedata.unidata_version == %s" % repr(unicodedata.unidata_version) # A.1 is the table of unassigned characters # XXX Plane 15 PUA is listed as unassigned in Python. name, table = tables[0] del tables[0] assert name == "A.1" table = Set(table.keys()) Cn = Set(gen_category(["Cn"])) # FDD0..FDEF are process internal codes Cn -= Set(range(0xFDD0, 0xFDF0)) # not a character Cn -= Set(range(0xFFFE, 0x110000, 0x10000)) Cn -= Set(range(0xFFFF, 0x110000, 0x10000)) # assert table == Cn print """ def in_table_a1(code): if unicodedata.category(code) != 'Cn': return False c = ord(code) if 0xFDD0 <= c < 0xFDF0: return False return (c & 0xFFFF) not in (0xFFFE, 0xFFFF) """ # B.1 cannot easily be derived name, table = tables[0] del tables[0] assert name == "B.1" table = table.keys() table.sort() print """ b1_set = """ + compact_set(table) + """ def in_table_b1(code): return ord(code) in b1_set """ # B.2 and B.3 is case folding. # It takes CaseFolding.txt into account, which is # not available in the Python database. Since # B.2 is derived from B.3, we process B.3 first. # B.3 supposedly *is* CaseFolding-3.2.0.txt. name, table_b2 = tables[0] del tables[0] assert name == "B.2" name, table_b3 = tables[0] del tables[0] assert name == "B.3" # B.3 is mostly Python's .lower, except for a number # of special cases, e.g. considering canonical forms. b3_exceptions = {} for k,v in table_b2.items(): if map(ord, unichr(k).lower()) != v: b3_exceptions[k] = u"".join(map(unichr,v)) b3 = b3_exceptions.items() b3.sort() print """ b3_exceptions = {""" for i,(k,v) in enumerate(b3): print "0x%x:%s," % (k, repr(v)), if i % 4 == 3: print print "}" print """ def map_table_b3(code): r = b3_exceptions.get(ord(code)) if r is not None: return r return code.lower() """ def map_table_b3(code): r = b3_exceptions.get(ord(code)) if r is not None: return r return code.lower() # B.2 is case folding for NFKC. This is the same as B.3, # except where NormalizeWithKC(Fold(a)) != # NormalizeWithKC(Fold(NormalizeWithKC(Fold(a)))) def map_table_b2(a): al = map_table_b3(a) b = unicodedata.normalize("NFKC", al) bl = u"".join([map_table_b3(ch) for ch in b]) c = unicodedata.normalize("NFKC", bl) if b != c: return c else: return al specials = {} for k,v in table_b2.items(): if map(ord, map_table_b2(unichr(k))) != v: specials[k] = v # B.3 should not add any additional special cases assert specials == {} print """ def map_table_b2(a): al = map_table_b3(a) b = unicodedata.normalize("NFKC", al) bl = u"".join([map_table_b3(ch) for ch in b]) c = unicodedata.normalize("NFKC", bl) if b != c: return c else: return al """ # C.1.1 is a table with a single character name, table = tables[0] del tables[0] assert name == "C.1.1" assert table == {0x20:0x20} print """ def in_table_c11(code): return code == u" " """ # C.1.2 is the rest of all space characters name, table = tables[0] del tables[0] assert name == "C.1.2" # table = Set(table.keys()) # Zs = Set(gen_category(["Zs"])) - Set([0x20]) # assert Zs == table print """ def in_table_c12(code): return unicodedata.category(code) == "Zs" and code != u" " def in_table_c11_c12(code): return unicodedata.category(code) == "Zs" """ # C.2.1 ASCII control characters name, table_c21 = tables[0] del tables[0] assert name == "C.2.1" Cc = Set(gen_category(["Cc"])) Cc_ascii = Cc & Set(range(128)) table_c21 = Set(table_c21.keys()) assert Cc_ascii == table_c21 print """ def in_table_c21(code): return ord(code) < 128 and unicodedata.category(code) == "Cc" """ # C.2.2 Non-ASCII control characters. It also includes # a number of characters in category Cf. name, table_c22 = tables[0] del tables[0] assert name == "C.2.2" Cc_nonascii = Cc - Cc_ascii table_c22 = Set(table_c22.keys()) assert len(Cc_nonascii - table_c22) == 0 specials = list(table_c22 - Cc_nonascii) specials.sort() print """c22_specials = """ + compact_set(specials) + """ def in_table_c22(code): c = ord(code) if c < 128: return False if unicodedata.category(code) == "Cc": return True return c in c22_specials def in_table_c21_c22(code): return unicodedata.category(code) == "Cc" or \\ ord(code) in c22_specials """ # C.3 Private use name, table = tables[0] del tables[0] assert name == "C.3" Co = Set(gen_category(["Co"])) assert Set(table.keys()) == Co print """ def in_table_c3(code): return unicodedata.category(code) == "Co" """ # C.4 Non-character code points, xFFFE, xFFFF # plus process internal codes name, table = tables[0] del tables[0] assert name == "C.4" nonchar = Set(range(0xFDD0,0xFDF0) + range(0xFFFE,0x110000,0x10000) + range(0xFFFF,0x110000,0x10000)) table = Set(table.keys()) assert table == nonchar print """ def in_table_c4(code): c = ord(code) if c < 0xFDD0: return False if c < 0xFDF0: return True return (ord(code) & 0xFFFF) in (0xFFFE, 0xFFFF) """ # C.5 Surrogate codes name, table = tables[0] del tables[0] assert name == "C.5" Cs = Set(gen_category(["Cs"])) assert Set(table.keys()) == Cs print """ def in_table_c5(code): return unicodedata.category(code) == "Cs" """ # C.6 Inappropriate for plain text name, table = tables[0] del tables[0] assert name == "C.6" table = table.keys() table.sort() print """ c6_set = """ + compact_set(table) + """ def in_table_c6(code): return ord(code) in c6_set """ # C.7 Inappropriate for canonical representation name, table = tables[0] del tables[0] assert name == "C.7" table = table.keys() table.sort() print """ c7_set = """ + compact_set(table) + """ def in_table_c7(code): return ord(code) in c7_set """ # C.8 Change display properties or are deprecated name, table = tables[0] del tables[0] assert name == "C.8" table = table.keys() table.sort() print """ c8_set = """ + compact_set(table) + """ def in_table_c8(code): return ord(code) in c8_set """ # C.9 Tagging characters name, table = tables[0] del tables[0] assert name == "C.9" table = table.keys() table.sort() print """ c9_set = """ + compact_set(table) + """ def in_table_c9(code): return ord(code) in c9_set """ # D.1 Characters with bidirectional property "R" or "AL" name, table = tables[0] del tables[0] assert name == "D.1" RandAL = Set(gen_bidirectional(["R","AL"])) assert Set(table.keys()) == RandAL print """ def in_table_d1(code): return unicodedata.bidirectional(code) in ("R","AL") """ # D.2 Characters with bidirectional property "L" name, table = tables[0] del tables[0] assert name == "D.2" L = Set(gen_bidirectional(["L"])) assert Set(table.keys()) == L print """ def in_table_d2(code): return unicodedata.bidirectional(code) == "L" """ From loewis@users.sourceforge.net Fri Apr 18 11:40:24 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:40:24 -0700 Subject: [Python-checkins] python/dist/src/Lib stringprep.py,NONE,1.1 httplib.py,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Lib Modified Files: httplib.py Added Files: stringprep.py Log Message: Implement IDNA (Internationalized Domain Names in Applications). --- NEW FILE: stringprep.py --- # This file is generated by mkstringprep.py. DO NOT EDIT. """Library that exposes various tables found in the StringPrep RFC 3454. There are two kinds of tables: sets, for which a member test is provided, and mappings, for which a mapping function is provided. """ import unicodedata, sets assert unicodedata.unidata_version == '3.2.0' def in_table_a1(code): if unicodedata.category(code) != 'Cn': return False c = ord(code) if 0xFDD0 <= c < 0xFDF0: return False return (c & 0xFFFF) not in (0xFFFE, 0xFFFF) b1_set = sets.Set([173, 847, 6150, 6155, 6156, 6157, 8203, 8204, 8205, 8288, 65279] + range(65024,65040)) def in_table_b1(code): return ord(code) in b1_set b3_exceptions = { 0xb5:u'\u03bc', 0xdf:u'ss', 0x130:u'i\u0307', 0x149:u'\u02bcn', 0x17f:u's', 0x1f0:u'j\u030c', 0x345:u'\u03b9', 0x37a:u' \u03b9', 0x390:u'\u03b9\u0308\u0301', 0x3b0:u'\u03c5\u0308\u0301', 0x3c2:u'\u03c3', 0x3d0:u'\u03b2', 0x3d1:u'\u03b8', 0x3d2:u'\u03c5', 0x3d3:u'\u03cd', 0x3d4:u'\u03cb', 0x3d5:u'\u03c6', 0x3d6:u'\u03c0', 0x3f0:u'\u03ba', 0x3f1:u'\u03c1', 0x3f2:u'\u03c3', 0x3f5:u'\u03b5', 0x587:u'\u0565\u0582', 0x1e96:u'h\u0331', 0x1e97:u't\u0308', 0x1e98:u'w\u030a', 0x1e99:u'y\u030a', 0x1e9a:u'a\u02be', 0x1e9b:u'\u1e61', 0x1f50:u'\u03c5\u0313', 0x1f52:u'\u03c5\u0313\u0300', 0x1f54:u'\u03c5\u0313\u0301', 0x1f56:u'\u03c5\u0313\u0342', 0x1f80:u'\u1f00\u03b9', 0x1f81:u'\u1f01\u03b9', 0x1f82:u'\u1f02\u03b9', 0x1f83:u'\u1f03\u03b9', 0x1f84:u'\u1f04\u03b9', 0x1f85:u'\u1f05\u03b9', 0x1f86:u'\u1f06\u03b9', 0x1f87:u'\u1f07\u03b9', 0x1f88:u'\u1f00\u03b9', 0x1f89:u'\u1f01\u03b9', 0x1f8a:u'\u1f02\u03b9', 0x1f8b:u'\u1f03\u03b9', 0x1f8c:u'\u1f04\u03b9', 0x1f8d:u'\u1f05\u03b9', 0x1f8e:u'\u1f06\u03b9', 0x1f8f:u'\u1f07\u03b9', 0x1f90:u'\u1f20\u03b9', 0x1f91:u'\u1f21\u03b9', 0x1f92:u'\u1f22\u03b9', 0x1f93:u'\u1f23\u03b9', 0x1f94:u'\u1f24\u03b9', 0x1f95:u'\u1f25\u03b9', 0x1f96:u'\u1f26\u03b9', 0x1f97:u'\u1f27\u03b9', 0x1f98:u'\u1f20\u03b9', 0x1f99:u'\u1f21\u03b9', 0x1f9a:u'\u1f22\u03b9', 0x1f9b:u'\u1f23\u03b9', 0x1f9c:u'\u1f24\u03b9', 0x1f9d:u'\u1f25\u03b9', 0x1f9e:u'\u1f26\u03b9', 0x1f9f:u'\u1f27\u03b9', 0x1fa0:u'\u1f60\u03b9', 0x1fa1:u'\u1f61\u03b9', 0x1fa2:u'\u1f62\u03b9', 0x1fa3:u'\u1f63\u03b9', 0x1fa4:u'\u1f64\u03b9', 0x1fa5:u'\u1f65\u03b9', 0x1fa6:u'\u1f66\u03b9', 0x1fa7:u'\u1f67\u03b9', 0x1fa8:u'\u1f60\u03b9', 0x1fa9:u'\u1f61\u03b9', 0x1faa:u'\u1f62\u03b9', 0x1fab:u'\u1f63\u03b9', 0x1fac:u'\u1f64\u03b9', 0x1fad:u'\u1f65\u03b9', 0x1fae:u'\u1f66\u03b9', 0x1faf:u'\u1f67\u03b9', 0x1fb2:u'\u1f70\u03b9', 0x1fb3:u'\u03b1\u03b9', 0x1fb4:u'\u03ac\u03b9', 0x1fb6:u'\u03b1\u0342', 0x1fb7:u'\u03b1\u0342\u03b9', 0x1fbc:u'\u03b1\u03b9', 0x1fbe:u'\u03b9', 0x1fc2:u'\u1f74\u03b9', 0x1fc3:u'\u03b7\u03b9', 0x1fc4:u'\u03ae\u03b9', 0x1fc6:u'\u03b7\u0342', 0x1fc7:u'\u03b7\u0342\u03b9', 0x1fcc:u'\u03b7\u03b9', 0x1fd2:u'\u03b9\u0308\u0300', 0x1fd3:u'\u03b9\u0308\u0301', 0x1fd6:u'\u03b9\u0342', 0x1fd7:u'\u03b9\u0308\u0342', 0x1fe2:u'\u03c5\u0308\u0300', 0x1fe3:u'\u03c5\u0308\u0301', 0x1fe4:u'\u03c1\u0313', 0x1fe6:u'\u03c5\u0342', 0x1fe7:u'\u03c5\u0308\u0342', 0x1ff2:u'\u1f7c\u03b9', 0x1ff3:u'\u03c9\u03b9', 0x1ff4:u'\u03ce\u03b9', 0x1ff6:u'\u03c9\u0342', 0x1ff7:u'\u03c9\u0342\u03b9', 0x1ffc:u'\u03c9\u03b9', 0x20a8:u'rs', 0x2102:u'c', 0x2103:u'\xb0c', 0x2107:u'\u025b', 0x2109:u'\xb0f', 0x210b:u'h', 0x210c:u'h', 0x210d:u'h', 0x2110:u'i', 0x2111:u'i', 0x2112:u'l', 0x2115:u'n', 0x2116:u'no', 0x2119:u'p', 0x211a:u'q', 0x211b:u'r', 0x211c:u'r', 0x211d:u'r', 0x2120:u'sm', 0x2121:u'tel', 0x2122:u'tm', 0x2124:u'z', 0x2128:u'z', 0x212c:u'b', 0x212d:u'c', 0x2130:u'e', 0x2131:u'f', 0x2133:u'm', 0x213e:u'\u03b3', 0x213f:u'\u03c0', 0x2145:u'd', 0x3371:u'hpa', 0x3373:u'au', 0x3375:u'ov', 0x3380:u'pa', 0x3381:u'na', 0x3382:u'\u03bca', 0x3383:u'ma', 0x3384:u'ka', 0x3385:u'kb', 0x3386:u'mb', 0x3387:u'gb', 0x338a:u'pf', 0x338b:u'nf', 0x338c:u'\u03bcf', 0x3390:u'hz', 0x3391:u'khz', 0x3392:u'mhz', 0x3393:u'ghz', 0x3394:u'thz', 0x33a9:u'pa', 0x33aa:u'kpa', 0x33ab:u'mpa', 0x33ac:u'gpa', 0x33b4:u'pv', 0x33b5:u'nv', 0x33b6:u'\u03bcv', 0x33b7:u'mv', 0x33b8:u'kv', 0x33b9:u'mv', 0x33ba:u'pw', 0x33bb:u'nw', 0x33bc:u'\u03bcw', 0x33bd:u'mw', 0x33be:u'kw', 0x33bf:u'mw', 0x33c0:u'k\u03c9', 0x33c1:u'm\u03c9', 0x33c3:u'bq', 0x33c6:u'c\u2215kg', 0x33c7:u'co.', 0x33c8:u'db', 0x33c9:u'gy', 0x33cb:u'hp', 0x33cd:u'kk', 0x33ce:u'km', 0x33d7:u'ph', 0x33d9:u'ppm', 0x33da:u'pr', 0x33dc:u'sv', 0x33dd:u'wb', 0xfb00:u'ff', 0xfb01:u'fi', 0xfb02:u'fl', 0xfb03:u'ffi', 0xfb04:u'ffl', 0xfb05:u'st', 0xfb06:u'st', 0xfb13:u'\u0574\u0576', 0xfb14:u'\u0574\u0565', 0xfb15:u'\u0574\u056b', 0xfb16:u'\u057e\u0576', 0xfb17:u'\u0574\u056d', 0x1d400:u'a', 0x1d401:u'b', 0x1d402:u'c', 0x1d403:u'd', 0x1d404:u'e', 0x1d405:u'f', 0x1d406:u'g', 0x1d407:u'h', 0x1d408:u'i', 0x1d409:u'j', 0x1d40a:u'k', 0x1d40b:u'l', 0x1d40c:u'm', 0x1d40d:u'n', 0x1d40e:u'o', 0x1d40f:u'p', 0x1d410:u'q', 0x1d411:u'r', 0x1d412:u's', 0x1d413:u't', 0x1d414:u'u', 0x1d415:u'v', 0x1d416:u'w', 0x1d417:u'x', 0x1d418:u'y', 0x1d419:u'z', 0x1d434:u'a', 0x1d435:u'b', 0x1d436:u'c', 0x1d437:u'd', 0x1d438:u'e', 0x1d439:u'f', 0x1d43a:u'g', 0x1d43b:u'h', 0x1d43c:u'i', 0x1d43d:u'j', 0x1d43e:u'k', 0x1d43f:u'l', 0x1d440:u'm', 0x1d441:u'n', 0x1d442:u'o', 0x1d443:u'p', 0x1d444:u'q', 0x1d445:u'r', 0x1d446:u's', 0x1d447:u't', 0x1d448:u'u', 0x1d449:u'v', 0x1d44a:u'w', 0x1d44b:u'x', 0x1d44c:u'y', 0x1d44d:u'z', 0x1d468:u'a', 0x1d469:u'b', 0x1d46a:u'c', 0x1d46b:u'd', 0x1d46c:u'e', 0x1d46d:u'f', 0x1d46e:u'g', 0x1d46f:u'h', 0x1d470:u'i', 0x1d471:u'j', 0x1d472:u'k', 0x1d473:u'l', 0x1d474:u'm', 0x1d475:u'n', 0x1d476:u'o', 0x1d477:u'p', 0x1d478:u'q', 0x1d479:u'r', 0x1d47a:u's', 0x1d47b:u't', 0x1d47c:u'u', 0x1d47d:u'v', 0x1d47e:u'w', 0x1d47f:u'x', 0x1d480:u'y', 0x1d481:u'z', 0x1d49c:u'a', 0x1d49e:u'c', 0x1d49f:u'd', 0x1d4a2:u'g', 0x1d4a5:u'j', 0x1d4a6:u'k', 0x1d4a9:u'n', 0x1d4aa:u'o', 0x1d4ab:u'p', 0x1d4ac:u'q', 0x1d4ae:u's', 0x1d4af:u't', 0x1d4b0:u'u', 0x1d4b1:u'v', 0x1d4b2:u'w', 0x1d4b3:u'x', 0x1d4b4:u'y', 0x1d4b5:u'z', 0x1d4d0:u'a', 0x1d4d1:u'b', 0x1d4d2:u'c', 0x1d4d3:u'd', 0x1d4d4:u'e', 0x1d4d5:u'f', 0x1d4d6:u'g', 0x1d4d7:u'h', 0x1d4d8:u'i', 0x1d4d9:u'j', 0x1d4da:u'k', 0x1d4db:u'l', 0x1d4dc:u'm', 0x1d4dd:u'n', 0x1d4de:u'o', 0x1d4df:u'p', 0x1d4e0:u'q', 0x1d4e1:u'r', 0x1d4e2:u's', 0x1d4e3:u't', 0x1d4e4:u'u', 0x1d4e5:u'v', 0x1d4e6:u'w', 0x1d4e7:u'x', 0x1d4e8:u'y', 0x1d4e9:u'z', 0x1d504:u'a', 0x1d505:u'b', 0x1d507:u'd', 0x1d508:u'e', 0x1d509:u'f', 0x1d50a:u'g', 0x1d50d:u'j', 0x1d50e:u'k', 0x1d50f:u'l', 0x1d510:u'm', 0x1d511:u'n', 0x1d512:u'o', 0x1d513:u'p', 0x1d514:u'q', 0x1d516:u's', 0x1d517:u't', 0x1d518:u'u', 0x1d519:u'v', 0x1d51a:u'w', 0x1d51b:u'x', 0x1d51c:u'y', 0x1d538:u'a', 0x1d539:u'b', 0x1d53b:u'd', 0x1d53c:u'e', 0x1d53d:u'f', 0x1d53e:u'g', 0x1d540:u'i', 0x1d541:u'j', 0x1d542:u'k', 0x1d543:u'l', 0x1d544:u'm', 0x1d546:u'o', 0x1d54a:u's', 0x1d54b:u't', 0x1d54c:u'u', 0x1d54d:u'v', 0x1d54e:u'w', 0x1d54f:u'x', 0x1d550:u'y', 0x1d56c:u'a', 0x1d56d:u'b', 0x1d56e:u'c', 0x1d56f:u'd', 0x1d570:u'e', 0x1d571:u'f', 0x1d572:u'g', 0x1d573:u'h', 0x1d574:u'i', 0x1d575:u'j', 0x1d576:u'k', 0x1d577:u'l', 0x1d578:u'm', 0x1d579:u'n', 0x1d57a:u'o', 0x1d57b:u'p', 0x1d57c:u'q', 0x1d57d:u'r', 0x1d57e:u's', 0x1d57f:u't', 0x1d580:u'u', 0x1d581:u'v', 0x1d582:u'w', 0x1d583:u'x', 0x1d584:u'y', 0x1d585:u'z', 0x1d5a0:u'a', 0x1d5a1:u'b', 0x1d5a2:u'c', 0x1d5a3:u'd', 0x1d5a4:u'e', 0x1d5a5:u'f', 0x1d5a6:u'g', 0x1d5a7:u'h', 0x1d5a8:u'i', 0x1d5a9:u'j', 0x1d5aa:u'k', 0x1d5ab:u'l', 0x1d5ac:u'm', 0x1d5ad:u'n', 0x1d5ae:u'o', 0x1d5af:u'p', 0x1d5b0:u'q', 0x1d5b1:u'r', 0x1d5b2:u's', 0x1d5b3:u't', 0x1d5b4:u'u', 0x1d5b5:u'v', 0x1d5b6:u'w', 0x1d5b7:u'x', 0x1d5b8:u'y', 0x1d5b9:u'z', 0x1d5d4:u'a', 0x1d5d5:u'b', 0x1d5d6:u'c', 0x1d5d7:u'd', 0x1d5d8:u'e', 0x1d5d9:u'f', 0x1d5da:u'g', 0x1d5db:u'h', 0x1d5dc:u'i', 0x1d5dd:u'j', 0x1d5de:u'k', 0x1d5df:u'l', 0x1d5e0:u'm', 0x1d5e1:u'n', 0x1d5e2:u'o', 0x1d5e3:u'p', 0x1d5e4:u'q', 0x1d5e5:u'r', 0x1d5e6:u's', 0x1d5e7:u't', 0x1d5e8:u'u', 0x1d5e9:u'v', 0x1d5ea:u'w', 0x1d5eb:u'x', 0x1d5ec:u'y', 0x1d5ed:u'z', 0x1d608:u'a', 0x1d609:u'b', 0x1d60a:u'c', 0x1d60b:u'd', 0x1d60c:u'e', 0x1d60d:u'f', 0x1d60e:u'g', 0x1d60f:u'h', 0x1d610:u'i', 0x1d611:u'j', 0x1d612:u'k', 0x1d613:u'l', 0x1d614:u'm', 0x1d615:u'n', 0x1d616:u'o', 0x1d617:u'p', 0x1d618:u'q', 0x1d619:u'r', 0x1d61a:u's', 0x1d61b:u't', 0x1d61c:u'u', 0x1d61d:u'v', 0x1d61e:u'w', 0x1d61f:u'x', 0x1d620:u'y', 0x1d621:u'z', 0x1d63c:u'a', 0x1d63d:u'b', 0x1d63e:u'c', 0x1d63f:u'd', 0x1d640:u'e', 0x1d641:u'f', 0x1d642:u'g', 0x1d643:u'h', 0x1d644:u'i', 0x1d645:u'j', 0x1d646:u'k', 0x1d647:u'l', 0x1d648:u'm', 0x1d649:u'n', 0x1d64a:u'o', 0x1d64b:u'p', 0x1d64c:u'q', 0x1d64d:u'r', 0x1d64e:u's', 0x1d64f:u't', 0x1d650:u'u', 0x1d651:u'v', 0x1d652:u'w', 0x1d653:u'x', 0x1d654:u'y', 0x1d655:u'z', 0x1d670:u'a', 0x1d671:u'b', 0x1d672:u'c', 0x1d673:u'd', 0x1d674:u'e', 0x1d675:u'f', 0x1d676:u'g', 0x1d677:u'h', 0x1d678:u'i', 0x1d679:u'j', 0x1d67a:u'k', 0x1d67b:u'l', 0x1d67c:u'm', 0x1d67d:u'n', 0x1d67e:u'o', 0x1d67f:u'p', 0x1d680:u'q', 0x1d681:u'r', 0x1d682:u's', 0x1d683:u't', 0x1d684:u'u', 0x1d685:u'v', 0x1d686:u'w', 0x1d687:u'x', 0x1d688:u'y', 0x1d689:u'z', 0x1d6a8:u'\u03b1', 0x1d6a9:u'\u03b2', 0x1d6aa:u'\u03b3', 0x1d6ab:u'\u03b4', 0x1d6ac:u'\u03b5', 0x1d6ad:u'\u03b6', 0x1d6ae:u'\u03b7', 0x1d6af:u'\u03b8', 0x1d6b0:u'\u03b9', 0x1d6b1:u'\u03ba', 0x1d6b2:u'\u03bb', 0x1d6b3:u'\u03bc', 0x1d6b4:u'\u03bd', 0x1d6b5:u'\u03be', 0x1d6b6:u'\u03bf', 0x1d6b7:u'\u03c0', 0x1d6b8:u'\u03c1', 0x1d6b9:u'\u03b8', 0x1d6ba:u'\u03c3', 0x1d6bb:u'\u03c4', 0x1d6bc:u'\u03c5', 0x1d6bd:u'\u03c6', 0x1d6be:u'\u03c7', 0x1d6bf:u'\u03c8', 0x1d6c0:u'\u03c9', 0x1d6d3:u'\u03c3', 0x1d6e2:u'\u03b1', 0x1d6e3:u'\u03b2', 0x1d6e4:u'\u03b3', 0x1d6e5:u'\u03b4', 0x1d6e6:u'\u03b5', 0x1d6e7:u'\u03b6', 0x1d6e8:u'\u03b7', 0x1d6e9:u'\u03b8', 0x1d6ea:u'\u03b9', 0x1d6eb:u'\u03ba', 0x1d6ec:u'\u03bb', 0x1d6ed:u'\u03bc', 0x1d6ee:u'\u03bd', 0x1d6ef:u'\u03be', 0x1d6f0:u'\u03bf', 0x1d6f1:u'\u03c0', 0x1d6f2:u'\u03c1', 0x1d6f3:u'\u03b8', 0x1d6f4:u'\u03c3', 0x1d6f5:u'\u03c4', 0x1d6f6:u'\u03c5', 0x1d6f7:u'\u03c6', 0x1d6f8:u'\u03c7', 0x1d6f9:u'\u03c8', 0x1d6fa:u'\u03c9', 0x1d70d:u'\u03c3', 0x1d71c:u'\u03b1', 0x1d71d:u'\u03b2', 0x1d71e:u'\u03b3', 0x1d71f:u'\u03b4', 0x1d720:u'\u03b5', 0x1d721:u'\u03b6', 0x1d722:u'\u03b7', 0x1d723:u'\u03b8', 0x1d724:u'\u03b9', 0x1d725:u'\u03ba', 0x1d726:u'\u03bb', 0x1d727:u'\u03bc', 0x1d728:u'\u03bd', 0x1d729:u'\u03be', 0x1d72a:u'\u03bf', 0x1d72b:u'\u03c0', 0x1d72c:u'\u03c1', 0x1d72d:u'\u03b8', 0x1d72e:u'\u03c3', 0x1d72f:u'\u03c4', 0x1d730:u'\u03c5', 0x1d731:u'\u03c6', 0x1d732:u'\u03c7', 0x1d733:u'\u03c8', 0x1d734:u'\u03c9', 0x1d747:u'\u03c3', 0x1d756:u'\u03b1', 0x1d757:u'\u03b2', 0x1d758:u'\u03b3', 0x1d759:u'\u03b4', 0x1d75a:u'\u03b5', 0x1d75b:u'\u03b6', 0x1d75c:u'\u03b7', 0x1d75d:u'\u03b8', 0x1d75e:u'\u03b9', 0x1d75f:u'\u03ba', 0x1d760:u'\u03bb', 0x1d761:u'\u03bc', 0x1d762:u'\u03bd', 0x1d763:u'\u03be', 0x1d764:u'\u03bf', 0x1d765:u'\u03c0', 0x1d766:u'\u03c1', 0x1d767:u'\u03b8', 0x1d768:u'\u03c3', 0x1d769:u'\u03c4', 0x1d76a:u'\u03c5', 0x1d76b:u'\u03c6', 0x1d76c:u'\u03c7', 0x1d76d:u'\u03c8', 0x1d76e:u'\u03c9', 0x1d781:u'\u03c3', 0x1d790:u'\u03b1', 0x1d791:u'\u03b2', 0x1d792:u'\u03b3', 0x1d793:u'\u03b4', 0x1d794:u'\u03b5', 0x1d795:u'\u03b6', 0x1d796:u'\u03b7', 0x1d797:u'\u03b8', 0x1d798:u'\u03b9', 0x1d799:u'\u03ba', 0x1d79a:u'\u03bb', 0x1d79b:u'\u03bc', 0x1d79c:u'\u03bd', 0x1d79d:u'\u03be', 0x1d79e:u'\u03bf', 0x1d79f:u'\u03c0', 0x1d7a0:u'\u03c1', 0x1d7a1:u'\u03b8', 0x1d7a2:u'\u03c3', 0x1d7a3:u'\u03c4', 0x1d7a4:u'\u03c5', 0x1d7a5:u'\u03c6', 0x1d7a6:u'\u03c7', 0x1d7a7:u'\u03c8', 0x1d7a8:u'\u03c9', 0x1d7bb:u'\u03c3', } def map_table_b3(code): r = b3_exceptions.get(ord(code)) if r is not None: return r return code.lower() def map_table_b2(a): al = map_table_b3(a) b = unicodedata.normalize("NFKC", al) bl = u"".join([map_table_b3(ch) for ch in b]) c = unicodedata.normalize("NFKC", bl) if b != c: return c else: return al def in_table_c11(code): return code == u" " def in_table_c12(code): return unicodedata.category(code) == "Zs" and code != u" " def in_table_c11_c12(code): return unicodedata.category(code) == "Zs" def in_table_c21(code): return ord(code) < 128 and unicodedata.category(code) == "Cc" c22_specials = sets.Set([1757, 1807, 6158, 8204, 8205, 8232, 8233, 65279] + range(8288,8292) + range(8298,8304) + range(65529,65533) + range(119155,119163)) def in_table_c22(code): c = ord(code) if c < 128: return False if unicodedata.category(code) == "Cc": return True return c in c22_specials def in_table_c21_c22(code): return unicodedata.category(code) == "Cc" or \ ord(code) in c22_specials def in_table_c3(code): return unicodedata.category(code) == "Co" def in_table_c4(code): c = ord(code) if c < 0xFDD0: return False if c < 0xFDF0: return True return (ord(code) & 0xFFFF) in (0xFFFE, 0xFFFF) def in_table_c5(code): return unicodedata.category(code) == "Cs" c6_set = sets.Set(range(65529,65534)) def in_table_c6(code): return ord(code) in c6_set c7_set = sets.Set(range(12272,12284)) def in_table_c7(code): return ord(code) in c7_set c8_set = sets.Set([832, 833, 8206, 8207] + range(8234,8239) + range(8298,8304)) def in_table_c8(code): return ord(code) in c8_set c9_set = sets.Set([917505] + range(917536,917632)) def in_table_c9(code): return ord(code) in c9_set def in_table_d1(code): return unicodedata.bidirectional(code) in ("R","AL") def in_table_d2(code): return unicodedata.bidirectional(code) == "L" Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** httplib.py 6 Mar 2003 16:31:48 -0000 1.73 --- httplib.py 18 Apr 2003 10:39:51 -0000 1.74 *************** *** 656,664 **** if netloc: ! self.putheader('Host', netloc) elif self.port == HTTP_PORT: ! self.putheader('Host', self.host) else: ! self.putheader('Host', "%s:%s" % (self.host, self.port)) # note: we are assuming that clients will not attempt to set these --- 656,664 ---- if netloc: ! self.putheader('Host', netloc.encode("idna")) elif self.port == HTTP_PORT: ! self.putheader('Host', self.host.encode("idna")) else: ! self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port)) # note: we are assuming that clients will not attempt to set these From loewis@users.sourceforge.net Fri Apr 18 11:40:24 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:40:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codecs.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18193/Lib/test Modified Files: test_codecs.py Log Message: Implement IDNA (Internationalized Domain Names in Applications). Index: test_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_codecs.py 4 Feb 2003 19:35:01 -0000 1.5 --- test_codecs.py 18 Apr 2003 10:39:52 -0000 1.6 *************** *** 37,40 **** --- 37,334 ---- # bug in _codecsmodule.c + # From RFC 3492 + punycode_testcases = [ + # A Arabic (Egyptian): + (u"\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" + u"\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", + "egbpdaj6bu4bxfgehfvwxn"), + # B Chinese (simplified): + (u"\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587", + "ihqwcrb4cv8a8dqg056pqjye"), + # C Chinese (traditional): + (u"\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587", + "ihqwctvzc91f659drss3x8bo0yb"), + # D Czech: Proprostnemluvesky + (u"\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" + u"\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" + u"\u0065\u0073\u006B\u0079", + "Proprostnemluvesky-uyb24dma41a"), + # E Hebrew: + (u"\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" + u"\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" + u"\u05D1\u05E8\u05D9\u05EA", + "4dbcagdahymbxekheh6e0a7fei0b"), + # F Hindi (Devanagari): + (u"\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" + u"\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" + u"\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" + u"\u0939\u0948\u0902", + "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd"), + + #(G) Japanese (kanji and hiragana): + (u"\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" + u"\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B", + "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa"), + + # (H) Korean (Hangul syllables): + (u"\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" + u"\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" + u"\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C", + "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" + "psd879ccm6fea98c"), + + # (I) Russian (Cyrillic): + (u"\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" + u"\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" + u"\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" + u"\u0438", + "b1abfaaepdrnnbgefbaDotcwatmq2g4l"), + + # (J) Spanish: PorqunopuedensimplementehablarenEspaol + (u"\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" + u"\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" + u"\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" + u"\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" + u"\u0061\u00F1\u006F\u006C", + "PorqunopuedensimplementehablarenEspaol-fmd56a"), + + # (K) Vietnamese: + # Tisaohkhngthch\ + # nitingVit + (u"\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" + u"\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" + u"\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" + u"\u0056\u0069\u1EC7\u0074", + "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g"), + + + #(L) 3B + (u"\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F", + "3B-ww4c5e180e575a65lsy2b"), + + # (M) -with-SUPER-MONKEYS + (u"\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" + u"\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" + u"\u004F\u004E\u004B\u0045\u0059\u0053", + "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n"), + + # (N) Hello-Another-Way- + (u"\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" + u"\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" + u"\u305D\u308C\u305E\u308C\u306E\u5834\u6240", + "Hello-Another-Way--fc4qua05auwb3674vfr0b"), + + # (O) 2 + (u"\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032", + "2-u9tlzr9756bt3uc0v"), + + # (P) MajiKoi5 + (u"\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" + u"\u308B\u0035\u79D2\u524D", + "MajiKoi5-783gue6qz075azm5e"), + + # (Q) de + (u"\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", + "de-jg4avhby1noc0d"), + + # (R) + (u"\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067", + "d9juau41awczczp"), + + # (S) -> $1.00 <- + (u"\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" + u"\u003C\u002D", + "-> $1.00 <--") + ] + + for i in punycode_testcases: + if len(i)!=2: + print repr(i) + + class PunycodeTest(unittest.TestCase): + def test_encode(self): + for uni, puny in punycode_testcases: + # Need to convert both strings to lower case, since + # some of the extended encodings use upper case, but our + # code produces only lower case. Converting just puny to + # lower is also insufficient, since some of the input characters + # are upper case. + self.assertEquals(uni.encode("punycode").lower(), puny.lower()) + + def test_decode(self): + for uni, puny in punycode_testcases: + self.assertEquals(uni, puny.decode("punycode")) + + # From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html + nameprep_tests = [ + # 3.1 Map to nothing. + ('foo\xc2\xad\xcd\x8f\xe1\xa0\x86\xe1\xa0\x8bbar' + '\xe2\x80\x8b\xe2\x81\xa0baz\xef\xb8\x80\xef\xb8\x88\xef' + '\xb8\x8f\xef\xbb\xbf', + 'foobarbaz'), + # 3.2 Case folding ASCII U+0043 U+0041 U+0046 U+0045. + ('CAFE', + 'cafe'), + # 3.3 Case folding 8bit U+00DF (german sharp s). + # The original test case is bogus; it says \xc3\xdf + ('\xc3\x9f', + 'ss'), + # 3.4 Case folding U+0130 (turkish capital I with dot). + ('\xc4\xb0', + 'i\xcc\x87'), + # 3.5 Case folding multibyte U+0143 U+037A. + ('\xc5\x83\xcd\xba', + '\xc5\x84 \xce\xb9'), + # 3.6 Case folding U+2121 U+33C6 U+1D7BB. + # XXX: skip this as it fails in UCS-2 mode + #('\xe2\x84\xa1\xe3\x8f\x86\xf0\x9d\x9e\xbb', + # 'telc\xe2\x88\x95kg\xcf\x83'), + (None, None), + # 3.7 Normalization of U+006a U+030c U+00A0 U+00AA. + ('j\xcc\x8c\xc2\xa0\xc2\xaa', + '\xc7\xb0 a'), + # 3.8 Case folding U+1FB7 and normalization. + ('\xe1\xbe\xb7', + '\xe1\xbe\xb6\xce\xb9'), + # 3.9 Self-reverting case folding U+01F0 and normalization. + # The original test case is bogus, it says `\xc7\xf0' + ('\xc7\xb0', + '\xc7\xb0'), + # 3.10 Self-reverting case folding U+0390 and normalization. + ('\xce\x90', + '\xce\x90'), + # 3.11 Self-reverting case folding U+03B0 and normalization. + ('\xce\xb0', + '\xce\xb0'), + # 3.12 Self-reverting case folding U+1E96 and normalization. + ('\xe1\xba\x96', + '\xe1\xba\x96'), + # 3.13 Self-reverting case folding U+1F56 and normalization. + ('\xe1\xbd\x96', + '\xe1\xbd\x96'), + # 3.14 ASCII space character U+0020. + (' ', + ' '), + # 3.15 Non-ASCII 8bit space character U+00A0. + ('\xc2\xa0', + ' '), + # 3.16 Non-ASCII multibyte space character U+1680. + ('\xe1\x9a\x80', + None), + # 3.17 Non-ASCII multibyte space character U+2000. + ('\xe2\x80\x80', + ' '), + # 3.18 Zero Width Space U+200b. + ('\xe2\x80\x8b', + ''), + # 3.19 Non-ASCII multibyte space character U+3000. + ('\xe3\x80\x80', + ' '), + # 3.20 ASCII control characters U+0010 U+007F. + ('\x10\x7f', + '\x10\x7f'), + # 3.21 Non-ASCII 8bit control character U+0085. + ('\xc2\x85', + None), + # 3.22 Non-ASCII multibyte control character U+180E. + ('\xe1\xa0\x8e', + None), + # 3.23 Zero Width No-Break Space U+FEFF. + ('\xef\xbb\xbf', + ''), + # 3.24 Non-ASCII control character U+1D175. + ('\xf0\x9d\x85\xb5', + None), + # 3.25 Plane 0 private use character U+F123. + ('\xef\x84\xa3', + None), + # 3.26 Plane 15 private use character U+F1234. + ('\xf3\xb1\x88\xb4', + None), + # 3.27 Plane 16 private use character U+10F234. + ('\xf4\x8f\x88\xb4', + None), + # 3.28 Non-character code point U+8FFFE. + ('\xf2\x8f\xbf\xbe', + None), + # 3.29 Non-character code point U+10FFFF. + ('\xf4\x8f\xbf\xbf', + None), + # 3.30 Surrogate code U+DF42. + ('\xed\xbd\x82', + None), + # 3.31 Non-plain text character U+FFFD. + ('\xef\xbf\xbd', + None), + # 3.32 Ideographic description character U+2FF5. + ('\xe2\xbf\xb5', + None), + # 3.33 Display property character U+0341. + ('\xcd\x81', + '\xcc\x81'), + # 3.34 Left-to-right mark U+200E. + ('\xe2\x80\x8e', + None), + # 3.35 Deprecated U+202A. + ('\xe2\x80\xaa', + None), + # 3.36 Language tagging character U+E0001. + ('\xf3\xa0\x80\x81', + None), + # 3.37 Language tagging character U+E0042. + ('\xf3\xa0\x81\x82', + None), + # 3.38 Bidi: RandALCat character U+05BE and LCat characters. + ('foo\xd6\xbebar', + None), + # 3.39 Bidi: RandALCat character U+FD50 and LCat characters. + ('foo\xef\xb5\x90bar', + None), + # 3.40 Bidi: RandALCat character U+FB38 and LCat characters. + ('foo\xef\xb9\xb6bar', + 'foo \xd9\x8ebar'), + # 3.41 Bidi: RandALCat without trailing RandALCat U+0627 U+0031. + ('\xd8\xa71', + None), + # 3.42 Bidi: RandALCat character U+0627 U+0031 U+0628. + ('\xd8\xa71\xd8\xa8', + '\xd8\xa71\xd8\xa8'), + # 3.43 Unassigned code point U+E0002. + ('\xf3\xa0\x80\x82', + None), + # 3.44 Larger test (shrinking). + # Original test case reads \xc3\xdf + ('X\xc2\xad\xc3\x9f\xc4\xb0\xe2\x84\xa1j\xcc\x8c\xc2\xa0\xc2' + '\xaa\xce\xb0\xe2\x80\x80', + 'xssi\xcc\x87tel\xc7\xb0 a\xce\xb0 '), + # 3.45 Larger test (expanding). + # Original test case reads \xc3\x9f + ('X\xc3\x9f\xe3\x8c\x96\xc4\xb0\xe2\x84\xa1\xe2\x92\x9f\xe3\x8c' + '\x80', + 'xss\xe3\x82\xad\xe3\x83\xad\xe3\x83\xa1\xe3\x83\xbc\xe3' + '\x83\x88\xe3\x83\xabi\xcc\x87tel\x28d\x29\xe3\x82' + '\xa2\xe3\x83\x91\xe3\x83\xbc\xe3\x83\x88') + ] + + + class NameprepTest(unittest.TestCase): + def test_nameprep(self): + from encodings.idna import nameprep + for pos, (orig, prepped) in enumerate(nameprep_tests): + if orig is None: + # Skipped + continue + # The Unicode strings are given in UTF-8 + orig = unicode(orig, "utf-8") + if prepped is None: + # Input contains prohibited characters + self.assertRaises(UnicodeError, nameprep, orig) + else: + prepped = unicode(prepped, "utf-8") + try: + self.assertEquals(nameprep(orig), prepped) + except Exception,e: + raise test_support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) + def test_main(): suite = unittest.TestSuite() *************** *** 42,45 **** --- 336,341 ---- suite.addTest(unittest.makeSuite(EscapeDecodeTest)) suite.addTest(unittest.makeSuite(RecodingTest)) + suite.addTest(unittest.makeSuite(PunycodeTest)) + suite.addTest(unittest.makeSuite(NameprepTest)) test_support.run_suite(suite) From loewis@users.sourceforge.net Fri Apr 18 11:51:17 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 03:51:17 -0700 Subject: [Python-checkins] python/dist/src/PC config.c,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv21827 Modified Files: config.c Log Message: Patch #714957: Explain ADDMODULE MARKER. Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/config.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** config.c 1 Feb 2003 00:10:10 -0000 1.38 --- config.c 18 Apr 2003 10:51:14 -0000 1.39 *************** *** 48,52 **** extern void inititertools(void); ! /* XXX tim: what's the purpose of ADDMODULE MARKER? */ /* -- ADDMODULE MARKER 1 -- */ --- 48,52 ---- extern void inititertools(void); ! /* tools/freeze/makeconfig.py marker for additional "extern" */ /* -- ADDMODULE MARKER 1 -- */ *************** *** 104,108 **** {"zipimport", initzipimport}, ! /* XXX tim: what's the purpose of ADDMODULE MARKER? */ /* -- ADDMODULE MARKER 2 -- */ --- 104,108 ---- {"zipimport", initzipimport}, ! /* tools/freeze/makeconfig.py marker for additional "_inittab" entries */ /* -- ADDMODULE MARKER 2 -- */ From loewis@users.sourceforge.net Fri Apr 18 12:11:12 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 04:11:12 -0700 Subject: [Python-checkins] python/dist/src/Python thread_pthread.h,2.44,2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28937 Modified Files: thread_pthread.h Log Message: Patch #711835: Remove unnecessary lock operations. Will backport to 2.2. Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** thread_pthread.h 21 Jan 2003 10:14:41 -0000 2.44 --- thread_pthread.h 18 Apr 2003 11:11:09 -0000 2.45 *************** *** 498,504 **** CHECK_STATUS("pthread_mutex_lock[1]"); success = thelock->locked == 0; - if (success) thelock->locked = 1; - status = pthread_mutex_unlock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_unlock[1]"); if ( !success && waitflag ) { --- 498,501 ---- *************** *** 507,512 **** /* mut must be locked by me -- part of the condition * protocol */ - status = pthread_mutex_lock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_lock[2]"); while ( thelock->locked ) { status = pthread_cond_wait(&thelock->lock_released, --- 504,507 ---- *************** *** 514,522 **** CHECK_STATUS("pthread_cond_wait"); } - thelock->locked = 1; - status = pthread_mutex_unlock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_unlock[2]"); success = 1; } if (error) success = 0; dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); --- 509,518 ---- CHECK_STATUS("pthread_cond_wait"); } success = 1; } + if (success) thelock->locked = 1; + status = pthread_mutex_unlock( &thelock->mut ); + CHECK_STATUS("pthread_mutex_unlock[1]"); + if (error) success = 0; dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); From loewis@users.sourceforge.net Fri Apr 18 12:21:28 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 04:21:28 -0700 Subject: [Python-checkins] python/dist/src/Python thread_pthread.h,2.36.8.2,2.36.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv32511/Python Modified Files: Tag: release22-maint thread_pthread.h Log Message: Patch #711835: Remove unnecessary lock operations. Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.36.8.2 retrieving revision 2.36.8.3 diff -C2 -d -r2.36.8.2 -r2.36.8.3 *** thread_pthread.h 4 Oct 2002 10:16:27 -0000 2.36.8.2 --- thread_pthread.h 18 Apr 2003 11:21:22 -0000 2.36.8.3 *************** *** 360,366 **** CHECK_STATUS("pthread_mutex_lock[1]"); success = thelock->locked == 0; - if (success) thelock->locked = 1; - status = pthread_mutex_unlock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_unlock[1]"); if ( !success && waitflag ) { --- 360,363 ---- *************** *** 369,374 **** /* mut must be locked by me -- part of the condition * protocol */ - status = pthread_mutex_lock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_lock[2]"); while ( thelock->locked ) { status = pthread_cond_wait(&thelock->lock_released, --- 366,369 ---- *************** *** 376,384 **** CHECK_STATUS("pthread_cond_wait"); } - thelock->locked = 1; - status = pthread_mutex_unlock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_unlock[2]"); success = 1; } if (error) success = 0; dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); --- 371,380 ---- CHECK_STATUS("pthread_cond_wait"); } success = 1; } + if (success) thelock->locked = 1; + status = pthread_mutex_unlock( &thelock->mut ); + CHECK_STATUS("pthread_mutex_unlock[1]"); + if (error) success = 0; dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); From andymac@bullseye.apana.org.au Fri Apr 18 12:22:23 2003 From: andymac@bullseye.apana.org.au (Andrew MacIntyre) Date: Fri, 18 Apr 2003 21:22:23 +1000 (EST) Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.87,2.88 sre_constants.h,2.13,2.14 In-Reply-To: <20030418195054.C82068-200000@bullseye.apana.org.au> Message-ID: <20030418211144.I83410-100000@bullseye.apana.org.au> On Fri, 18 Apr 2003, Andrew MacIntyre wrote: > On Mon, 14 Apr 2003 gvanrossum@users.sourceforge.net wrote: > > > Update of /cvsroot/python/python/dist/src/Modules > > In directory sc8-pr-cvs1:/tmp/cvs-serv12812/Modules > > > > Modified Files: > > _sre.c sre_constants.h > > Log Message: > > SF patch #720991 by Gary Herron: > > A small fix for bug #545855 and Greg Chapman's > > addition of op code SRE_OP_MIN_REPEAT_ONE for > > eliminating recursion on simple uses of pattern '*?' on a > > long string. > > This patch is causing a bus error on FreeBSD 4.4 (hope to check 4.7 later > this weekend). The output of a verbose test_sre run is > > test_sre > Running tests on character literals > Running tests on sre.search and sre.match > bus error core dumped > > Compiler is gcc 2.95.3, with -O3. Dropping the optimisation to -O2 for _sre.c resolves the problem. I need to check my 4.7 system, which has gcc 2.95.4, to see whether it also has the same problem. I'll also try the gcc 2.95.2 compiler on OS/2. I recompiled the whole of Python with -O2, and on the 4.4 system (a Celeron 300A SMP box) the pystone rating goes from ~4550 (-O3) to ~4565 (-O2). I'd appreciate suggestions about formulating a patch, as I know essentially zip about autoconf... > Backing the patch out (effectively reverting to 2.3a2) results in the > attached log file, which looks like some sort of Unicode issue, where > 2.3a2 builds and tests fine on the same box. Forget that bit of blather... -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From andymac@bullseye.apana.org.au Fri Apr 18 11:04:20 2003 From: andymac@bullseye.apana.org.au (Andrew MacIntyre) Date: Fri, 18 Apr 2003 20:04:20 +1000 (EST) Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.87,2.88 sre_constants.h,2.13,2.14 In-Reply-To: Message-ID: <20030418195054.C82068-200000@bullseye.apana.org.au> This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-384371029-1050660260=:82068 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 14 Apr 2003 gvanrossum@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Modules > In directory sc8-pr-cvs1:/tmp/cvs-serv12812/Modules > > Modified Files: > _sre.c sre_constants.h > Log Message: > SF patch #720991 by Gary Herron: > A small fix for bug #545855 and Greg Chapman's > addition of op code SRE_OP_MIN_REPEAT_ONE for > eliminating recursion on simple uses of pattern '*?' on a > long string. This patch is causing a bus error on FreeBSD 4.4 (hope to check 4.7 later this weekend). The output of a verbose test_sre run is test_sre Running tests on character literals Running tests on sre.search and sre.match bus error core dumped Compiler is gcc 2.95.3, with -O3. Backing the patch out (effectively reverting to 2.3a2) results in the attached log file, which looks like some sort of Unicode issue, where 2.3a2 builds and tests fine on the same box. Failures also affect test_re, of course... -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia --0-384371029-1050660260=:82068 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="test_sre.log" Content-Transfer-Encoding: BASE64 Content-ID: <20030418200420.K82068@bullseye.apana.org.au> Content-Description: test_sre.log Content-Disposition: attachment; filename="test_sre.log" dGVzdF9zcmUNClJ1bm5pbmcgdGVzdHMgb24gY2hhcmFjdGVyIGxpdGVyYWxz DQpSdW5uaW5nIHRlc3RzIG9uIHNyZS5zZWFyY2ggYW5kIHNyZS5tYXRjaA0K UnVubmluZyB0ZXN0cyBvbiBzcmUuc3ViDQpSdW5uaW5nIHRlc3RzIG9uIHN5 bWJvbGljIHJlZmVyZW5jZXMNClJ1bm5pbmcgdGVzdHMgb24gc3JlLnN1Ym4N ClJ1bm5pbmcgdGVzdHMgb24gc3JlLnNwbGl0DQpSdW5uaW5nIHRlc3RzIG9u IHNyZS5maW5kYWxsDQpSdW5uaW5nIHRlc3RzIG9uIHNyZS5maW5kaXRlcg0K UnVubmluZyB0ZXN0cyBvbiBzcmUubWF0Y2gNClJ1bm5pbmcgdGVzdHMgb24g c3JlLmVzY2FwZQ0KUnVubmluZyB0ZXN0cyBvbiBzcmUuU2Nhbm5lcg0KUGlj a2xpbmcgYSBTUkVfUGF0dGVybiBpbnN0YW5jZQ0KVGVzdCBlbmdpbmUgbGlt aXRhdGlvbnMNClJ1bm5pbmcgcmVfdGVzdHMgdGVzdCBzdWl0ZQ0KPT09IEZh aWxlZCBpbmNvcnJlY3RseSAoJyg/dSlcXHcnLCB1J1x4YzQnLCAwLCAnZm91 bmQnLCB1J1x4YzQnKQ0KMSB0ZXN0IE9LLg0KQ0FVVElPTjogIHN0ZG91dCBp c24ndCBjb21wYXJlZCBpbiB2ZXJib3NlIG1vZGU6DQphIHRlc3QgdGhhdCBw YXNzZXMgaW4gdmVyYm9zZSBtb2RlIG1heSBmYWlsIHdpdGhvdXQgaXQuDQo= --0-384371029-1050660260=:82068-- From fdrake@users.sourceforge.net Fri Apr 18 16:50:15 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 18 Apr 2003 08:50:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19720 Modified Files: liboptparse.tex Log Message: - accepted (slightly) modified version of docs for the OptionGroup class; closes SF patch #697941 - use em-dashes intead of en-dashes - section references: use a "tie" between the word "section" and the section number, use quotation marks around section titles - other minor markup corrections/cleanups Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** liboptparse.tex 6 Jan 2003 16:51:35 -0000 1.1 --- liboptparse.tex 18 Apr 2003 15:50:13 -0000 1.2 *************** *** 22,26 **** \begin{verbatim} from optparse import OptionParser ! [...] parser = OptionParser() parser.add_option("-f", "--file", dest="filename", --- 22,26 ---- \begin{verbatim} from optparse import OptionParser ! parser = OptionParser() parser.add_option("-f", "--file", dest="filename", *************** *** 74,78 **** argument parsing, and \module{optparse} reflects many of those ideas. This section is meant to explain this philosophy, which in turn is ! heavily influenced by the Unix and GNU toolkits. \subsubsection{Terminology\label{optparse-terminology}} --- 74,78 ---- argument parsing, and \module{optparse} reflects many of those ideas. This section is meant to explain this philosophy, which in turn is ! heavily influenced by the \UNIX{} and GNU toolkits. \subsubsection{Terminology\label{optparse-terminology}} *************** *** 87,91 **** \var{sys.argv[1:]}. (\var{sys.argv[0]} is the name of the program being executed; in the context of parsing arguments, it's not very ! important.) Unix shells also use the term ``word''. It's occasionally desirable to substitute an argument list other --- 87,91 ---- \var{sys.argv[1:]}. (\var{sys.argv[0]} is the name of the program being executed; in the context of parsing arguments, it's not very ! important.) \UNIX{} shells also use the term ``word''. It's occasionally desirable to substitute an argument list other *************** *** 97,103 **** an argument used to supply extra information to guide or customize the execution of a program. There are many different syntaxes for ! options; the traditional Unix syntax is \programopt{-} followed by a single letter, e.g. \programopt{-x} or \programopt{-F}. Also, ! traditional Unix syntax allows multiple options to be merged into a single argument, e.g. \programopt{-x -F} is equivalent to \programopt{-xF}. The GNU project introduced \longprogramopt{} --- 97,103 ---- an argument used to supply extra information to guide or customize the execution of a program. There are many different syntaxes for ! options; the traditional \UNIX{} syntax is \programopt{-} followed by a single letter, e.g. \programopt{-x} or \programopt{-F}. Also, ! traditional \UNIX{} syntax allows multiple options to be merged into a single argument, e.g. \programopt{-x -F} is equivalent to \programopt{-xF}. The GNU project introduced \longprogramopt{} *************** *** 125,129 **** syntaxes, you'll have to subclass OptionParser and override all the difficult bits. But please don't! \module{optparse} does things the ! traditional Unix/GNU way deliberately; the first three are non-standard anywhere, and the last one makes sense only if you're exclusively targeting MS-DOS/Windows and/or VMS.) --- 125,129 ---- syntaxes, you'll have to subclass OptionParser and override all the difficult bits. But please don't! \module{optparse} does things the ! traditional \UNIX/GNU way deliberately; the first three are non-standard anywhere, and the last one makes sense only if you're exclusively targeting MS-DOS/Windows and/or VMS.) *************** *** 162,170 **** \term{required option} an option that must be supplied on the command-line; the phrase ! "required option" is an oxymoron and I personally consider it poor UI design. \module{optparse} doesn't prevent you from implementing ! required options, but doesn't give you much help at it either. See ! Extending Examples (section \ref{optparse-extending-examples}) for two ! ways to implement required options with \module{optparse}. \end{definitions} --- 162,170 ---- \term{required option} an option that must be supplied on the command-line; the phrase ! ``required option'' is an oxymoron and is usually considered poor UI design. \module{optparse} doesn't prevent you from implementing ! required options, but doesn't give you much help with it either. See ! ``Extending Examples'' (section~\ref{optparse-extending-examples}) for ! two ways to implement required options with \module{optparse}. \end{definitions} *************** *** 186,194 **** execution of a program. In case it wasn't clear, options are usually \emph{optional}. A program should be able to run just fine with no ! options whatsoever. (Pick a random program from the Unix or GNU toolsets. Can it run without any options at all and still make sense? ! The only exceptions I can think of are find, tar, and dd -- all of ! which are mutant oddballs that have been rightly criticized for their ! non-standard syntax and confusing interfaces.) Lots of people want their programs to have ``required options''. --- 186,195 ---- execution of a program. In case it wasn't clear, options are usually \emph{optional}. A program should be able to run just fine with no ! options whatsoever. (Pick a random program from the \UNIX{} or GNU toolsets. Can it run without any options at all and still make sense? ! The only exceptions I can think of are \program{find}, \program{tar}, ! and \program{dd} --- all of which are mutant oddballs that have been ! rightly criticized for their non-standard syntax and confusing ! interfaces.) Lots of people want their programs to have ``required options''. *************** *** 197,203 **** in order to run successfully, that's what positional arguments are for. (However, if you insist on adding ``required options'' to your ! programs, look in Extending Examples (section ! \ref{optparse-extending-examples}) for two ways of implementing them ! with \module{optparse}.) Consider the humble \program{cp} utility, for copying files. It --- 198,204 ---- in order to run successfully, that's what positional arguments are for. (However, if you insist on adding ``required options'' to your ! programs, look in ``Extending Examples'' ! (section~\ref{optparse-extending-examples}) for two ways of ! implementing them with \module{optparse}.) Consider the humble \program{cp} utility, for copying files. It *************** *** 228,232 **** possible. If your program requires 17 distinct pieces of information in order to run successfully, it doesn't much matter \emph{how} you get that ! information from the user -- most people will give up and walk away before they successfully run the program. This applies whether the user interface is a command-line, a configuration file, a GUI, or whatever: --- 229,233 ---- possible. If your program requires 17 distinct pieces of information in order to run successfully, it doesn't much matter \emph{how} you get that ! information from the user --- most people will give up and walk away before they successfully run the program. This applies whether the user interface is a command-line, a configuration file, a GUI, or whatever: *************** *** 235,243 **** In short, try to minimize the amount of information that users are ! absolutely required to supply -- use sensible defaults whenever possible. Of course, you also want to make your programs reasonably flexible. That's what options are for. Again, it doesn't matter if they are entries in a config file, checkboxes in the ``Preferences'' ! dialog of a GUI, or command-line options -- the more options you implement, the more flexible your program is, and the more complicated its implementation becomes. It's quite easy to overwhelm users (and --- 236,244 ---- In short, try to minimize the amount of information that users are ! absolutely required to supply --- use sensible defaults whenever possible. Of course, you also want to make your programs reasonably flexible. That's what options are for. Again, it doesn't matter if they are entries in a config file, checkboxes in the ``Preferences'' ! dialog of a GUI, or command-line options --- the more options you implement, the more flexible your program is, and the more complicated its implementation becomes. It's quite easy to overwhelm users (and *************** *** 269,273 **** Then you can start populating the parser with options. Each option is really a set of synonymous option strings; most commonly, you'll have ! one short option string and one long option string -- e.g. \programopt{-f} and \longprogramopt{file}: --- 270,274 ---- Then you can start populating the parser with options. Each option is really a set of synonymous option strings; most commonly, you'll have ! one short option string and one long option string --- e.g. \programopt{-f} and \longprogramopt{file}: *************** *** 308,314 **** When \module{optparse} sees the \programopt{-f}, it sucks in the next ! argument -- ``foo.txt'' -- and stores it in the \var{filename} attribute of a special object. That object is the first return value ! from \programopt{parse_args()}, so: \begin{verbatim} --- 309,315 ---- When \module{optparse} sees the \programopt{-f}, it sucks in the next ! argument --- ``foo.txt'' --- and stores it in the \var{filename} attribute of a special object. That object is the first return value ! from \function{parse_args()}, so: \begin{verbatim} *************** *** 326,333 **** Note that I didn't supply a long option, which is perfectly acceptable. ! I also didn't specify the action -- it defaults to ``store''. Let's parse another fake command-line. This time, we'll jam the ! option argument right up against the option -- \programopt{-n42} (one argument) is equivalent to \programopt{-n 42} (two arguments). : --- 327,334 ---- Note that I didn't supply a long option, which is perfectly acceptable. ! I also didn't specify the action --- it defaults to ``store''. Let's parse another fake command-line. This time, we'll jam the ! option argument right up against the option --- \programopt{-n42} (one argument) is equivalent to \programopt{-n 42} (two arguments). : *************** *** 356,366 **** destination for \programopt{-f} is \var{f}. ! Adding types is fairly easy; please refer to section ! \ref{optparse-adding-types}: Adding new types. \subsubsection{Other "store_*" actions\label{optparse-other-store-actions}} ! Flag options -- set a variable to true or false when a particular ! option is seen -- are quite common. \module{optparse} supports them with two separate actions, ``store_true'' and ``store_false''. For example, you might have a \var{verbose} flag that is turned on with --- 357,367 ---- destination for \programopt{-f} is \var{f}. ! Adding types is fairly easy; please refer to ! section~\ref{optparse-adding-types}, ``Adding new types.'' \subsubsection{Other "store_*" actions\label{optparse-other-store-actions}} ! Flag options --- set a variable to true or false when a particular ! option is seen --- are quite common. \module{optparse} supports them with two separate actions, ``store_true'' and ``store_false''. For example, you might have a \var{verbose} flag that is turned on with *************** *** 374,378 **** Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting ! default values -- see below.) When \module{optparse} sees \programopt{-v} on the command line, it --- 375,379 ---- Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting ! default values --- see below.) When \module{optparse} sees \programopt{-v} on the command line, it *************** *** 393,398 **** First, consider the verbose/quiet example. If we want ! \module{optparse} to set \var{verbose} to 1 unless -q is seen, then ! we can do this: \begin{verbatim} --- 394,399 ---- First, consider the verbose/quiet example. If we want ! \module{optparse} to set \var{verbose} to 1 unless \programopt{-q} is ! seen, then we can do this: \begin{verbatim} *************** *** 483,487 **** \item every option defines a help string, and doesn't worry about ! line-wrapping -- \module{optparse} takes care of wrapping lines and making the help output look good. --- 484,488 ---- \item every option defines a help string, and doesn't worry about ! line-wrapping --- \module{optparse} takes care of wrapping lines and making the help output look good. *************** *** 497,501 **** \programopt{-m}/\longprogramopt{mode}. By default, \module{optparse} converts the destination variable name to uppercase and uses that for ! the meta-variable. Sometimes, that's not what you want -- for example, the \var{filename} option explicitly sets \code{metavar="FILE"}, resulting in this automatically-generated --- 498,502 ---- \programopt{-m}/\longprogramopt{mode}. By default, \module{optparse} converts the destination variable name to uppercase and uses that for ! the meta-variable. Sometimes, that's not what you want --- for example, the \var{filename} option explicitly sets \code{metavar="FILE"}, resulting in this automatically-generated *************** *** 514,517 **** --- 515,553 ---- \end{itemize} + When dealing with many options, it is convenient to group these + options for better help output. An \class{OptionParser} can contain + several option groups, each of which can contain several options. + + Continuing with the parser defined above, adding an + \class{OptionGroup} to a parser is easy: + + \begin{verbatim} + group = OptionGroup(parser, "Dangerous Options", + "Caution: use these options at your own risk." + " It is believed that some of them bite.") + group.add_option("-g", action="store_true", help="Group option.") + parser.add_option_group(group) + \end{verbatim} + + This would result in the following help output: + + \begin{verbatim} + usage: [options] arg1 arg2 + + options: + -h, --help show this help message and exit + -v, --verbose make lots of noise [default] + -q, --quiet be vewwy quiet (I'm hunting wabbits) + -fFILE, --file=FILE write output to FILE + -mMODE, --mode=MODE interaction mode: one of 'novice', 'intermediate' + [default], 'expert' + + Dangerous Options: + Caution: use of these options is at your own risk. It is believed that + some of them bite. + -g Group option. + \end{verbatim} + + \subsubsection{Print a version number\label{optparse-print-version}} *************** *** 543,547 **** The one thing you need to know for basic usage is how \module{optparse} behaves when it encounters an error on the ! command-line -- e.g. \programopt{-n4x} where \programopt{-n} is an integer-valued option. \module{optparse} prints your usage message to stderr, followed by a useful and human-readable error message. Then --- 579,583 ---- The one thing you need to know for basic usage is how \module{optparse} behaves when it encounters an error on the ! command-line --- e.g. \programopt{-n4x} where \programopt{-n} is an integer-valued option. \module{optparse} prints your usage message to stderr, followed by a useful and human-readable error message. Then *************** *** 550,555 **** If you don't like this, subclass \class{OptionParser} and override the ! \method{error()} method. See section \ref{optparse-extending}: ! Extending \module{optparse}. \subsubsection{Putting it all together\label{optparse-basic-summary}} --- 586,591 ---- If you don't like this, subclass \class{OptionParser} and override the ! \method{error()} method. See section~\ref{optparse-extending}, ! ``Extending \module{optparse}.'' \subsubsection{Putting it all together\label{optparse-basic-summary}} *************** *** 560,564 **** from optparse import OptionParser ! [...] def main (): --- 596,600 ---- from optparse import OptionParser ! ... def main (): *************** *** 571,575 **** parser.add_option("-q", "--quiet", action="store_false", dest="verbose") ! [... more options ...] (options, args) = parser.parse_args() --- 607,611 ---- parser.add_option("-q", "--quiet", action="store_false", dest="verbose") ! # more options ... (options, args) = parser.parse_args() *************** *** 580,584 **** print "reading %s..." % options.filename ! [... go to work ...] if __name__ == "__main__": --- 616,620 ---- print "reading %s..." % options.filename ! # go to work ... if __name__ == "__main__": *************** *** 589,595 **** This is reference documentation. If you haven't read the basic ! documentation in section \ref{optparse-basic-usage}, do so now. ! \subsubsection{Creating and populating the parser\label{optparse-creating-the-parser}} There are several ways to populate the parser with options. One way --- 625,632 ---- This is reference documentation. If you haven't read the basic ! documentation in section~\ref{optparse-basic-usage}, do so now. ! \subsubsection{Creating and populating the ! parser\label{optparse-creating-the-parser}} There are several ways to populate the parser with options. One way *************** *** 605,609 **** \end{verbatim} ! (As of \module{optparse} 1.3, \function{make_option()} is an alias for the \class{Option} class, ie. this just calls the \class{Option} constructor. A future version of \module{optparse} will probably --- 642,646 ---- \end{verbatim} ! (\function{make_option()} is an alias for the \class{Option} class, ie. this just calls the \class{Option} constructor. A future version of \module{optparse} will probably *************** *** 618,622 **** option_list = [make_option("-f", "--filename", action="store", type="string", dest="filename"), ! # ... 17 other options ... make_option("-q", "--quiet", action="store_false", dest="verbose")] --- 655,659 ---- option_list = [make_option("-f", "--filename", action="store", type="string", dest="filename"), ! # 17 other options ... make_option("-q", "--quiet", action="store_false", dest="verbose")] *************** *** 637,641 **** This method makes it easier to track down exceptions raised by the \class{Option} constructor, which are common because of the complicated ! interdependencies among the various keyword arguments -- if you get it wrong, \module{optparse} raises \exception{OptionError}. --- 674,678 ---- This method makes it easier to track down exceptions raised by the \class{Option} constructor, which are common because of the complicated ! interdependencies among the various keyword arguments --- if you get it wrong, \module{optparse} raises \exception{OptionError}. *************** *** 766,771 **** \var{nargs} > 1, multiple arguments will be consumed from the command line; all will be converted according to \var{type} and stored to ! \var{dest} as a tuple. See section \ref{optparse-option-types}: ! Option types below. If \var{choices} is supplied (a list or tuple of strings), the type --- 803,808 ---- \var{nargs} > 1, multiple arguments will be consumed from the command line; all will be converted according to \var{type} and stored to ! \var{dest} as a tuple. See section~\ref{optparse-option-types}, ! ``Option types'' below. If \var{choices} is supplied (a list or tuple of strings), the type *************** *** 872,876 **** \end{verbatim} ! See Error handling (section \ref{optparse-error-handling}) for information on how \module{optparse} deals with something like \samp{--tracks=x}. --- 909,913 ---- \end{verbatim} ! See ``Error handling'' (section~\ref{optparse-error-handling}) for information on how \module{optparse} deals with something like \samp{--tracks=x}. *************** *** 917,922 **** \end{verbatim} ! Callback options are covered in detail in section ! \ref{optparse-callback-options}: Callback Options. \term{help} [required: none] --- 954,959 ---- \end{verbatim} ! Callback options are covered in detail in ! section~\ref{optparse-callback-options} ``Callback Options.'' \term{help} [required: none] *************** *** 978,982 **** -- long and complex are there mainly for completeness.) It's easy to add new option types by subclassing the \class{Option} class; see ! section \ref{optparse-extending}: Extending \module{optparse}. Arguments to string options are not checked or converted in any way: --- 1015,1019 ---- -- long and complex are there mainly for completeness.) It's easy to add new option types by subclassing the \class{Option} class; see ! section~\ref{optparse-extending}, ``Extending \module{optparse}.'' Arguments to string options are not checked or converted in any way: *************** *** 1037,1041 **** \begin{verbatim} parser.add_option("-n", "--dry-run", ...) ! [...] parser.add_option("-n", "--noisy", ...) \end{verbatim} --- 1074,1078 ---- \begin{verbatim} parser.add_option("-n", "--dry-run", ...) ! ... parser.add_option("-n", "--noisy", ...) \end{verbatim} *************** *** 1045,1052 **** On the assumption that this is usually a mistake, \module{optparse} ! 1.2 and later raise an exception (\exception{OptionConflictError}) by ! default when this happens. Since this is an easily-fixed programming ! error, you shouldn't try to catch this exception -- fix your mistake ! and get on with life. Sometimes, you want newer options to deliberately replace the option --- 1082,1089 ---- On the assumption that this is usually a mistake, \module{optparse} ! raises an exception (\exception{OptionConflictError}) by default when ! this happens. Since this is an easily-fixed programming error, you ! shouldn't try to catch this exception --- fix your mistake and get on ! with life. Sometimes, you want newer options to deliberately replace the option *************** *** 1086,1090 **** \begin{verbatim} parser.add_option("-n", "--dry-run", ..., help="original dry-run option") ! [...] parser.add_option("-n", "--noisy", ..., help="be noisy") \end{verbatim} --- 1123,1127 ---- \begin{verbatim} parser.add_option("-n", "--dry-run", ..., help="original dry-run option") ! ... parser.add_option("-n", "--noisy", ..., help="be noisy") \end{verbatim} *************** *** 1101,1105 **** options: --dry-run original dry-run option ! [...] -n, --noisy be noisy \end{verbatim} --- 1138,1142 ---- options: --dry-run original dry-run option ! ... -n, --noisy be noisy \end{verbatim} *************** *** 1122,1126 **** \begin{verbatim} options: ! [...] -n, --noisy be noisy --dry-run new dry-run option --- 1159,1163 ---- \begin{verbatim} options: ! ... -n, --noisy be noisy --dry-run new dry-run option *************** *** 1148,1152 **** \end{verbatim} ! Note that you supply a function object here -- so you must have already defined a function \function{my_callback()} when you define the callback option. In this simple case, \module{optparse} knows --- 1185,1189 ---- \end{verbatim} ! Note that you supply a function object here --- so you must have already defined a function \function{my_callback()} when you define the callback option. In this simple case, \module{optparse} knows *************** *** 1200,1204 **** is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, \var{opt} will be ! the full, canonical option string -- e.g. if the user puts \longprogramopt{foo} on the command-line as an abbreviation for \longprogramopt{foobar}, then \var{opt} will be --- 1237,1241 ---- is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, \var{opt} will be ! the full, canonical option string --- e.g. if the user puts \longprogramopt{foo} on the command-line as an abbreviation for \longprogramopt{foobar}, then \var{opt} will be *************** *** 1209,1213 **** \module{optparse} will only expect an argument if \var{type} is set; the type of \var{value} will be the type implied by the ! option's type (see \ref{optparse-option-types}: Option types). If \var{type} for this option is None (no argument expected), then \var{value} will be None. If \samp{nargs > 1}, \var{value} will --- 1246,1250 ---- \module{optparse} will only expect an argument if \var{type} is set; the type of \var{value} will be the type implied by the ! option's type (see~\ref{optparse-option-types}, ``Option types''). If \var{type} for this option is None (no argument expected), then \var{value} will be None. If \samp{nargs > 1}, \var{value} will *************** *** 1290,1294 **** raise OptionValueError("can't use -a after -b") parser.values.a = 1 ! [...] parser.add_option("-a", action="callback", callback=check_order) parser.add_option("-b", action="store_true", dest="b") --- 1327,1331 ---- raise OptionValueError("can't use -a after -b") parser.values.a = 1 ! ... parser.add_option("-a", action="callback", callback=check_order) parser.add_option("-b", action="store_true", dest="b") *************** *** 1305,1309 **** raise OptionValueError("can't use %s after -b" % opt) setattr(parser.values, option.dest, 1) ! [...] parser.add_option("-a", action="callback", callback=check_order, dest='a') parser.add_option("-b", action="store_true", dest="b") --- 1342,1346 ---- raise OptionValueError("can't use %s after -b" % opt) setattr(parser.values, option.dest, 1) ! ... parser.add_option("-a", action="callback", callback=check_order, dest='a') parser.add_option("-b", action="store_true", dest="b") *************** *** 1311,1315 **** \end{verbatim} ! Of course, you could put any condition in there -- you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all --- 1348,1352 ---- \end{verbatim} ! Of course, you could put any condition in there --- you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all *************** *** 1321,1325 **** raise OptionValueError("%s option invalid when moon full" % opt) setattr(parser.values, option.dest, 1) ! [...] parser.add_option("--foo", action="callback", callback=check_moon, dest="foo") --- 1358,1362 ---- raise OptionValueError("%s option invalid when moon full" % opt) setattr(parser.values, option.dest, 1) ! ... parser.add_option("--foo", action="callback", callback=check_moon, dest="foo") *************** *** 1343,1347 **** def store_value (option, opt, value, parser): setattr(parser.values, option.dest, value) ! [...] parser.add_option("--foo", action="callback", callback=store_value, --- 1380,1384 ---- def store_value (option, opt, value, parser): setattr(parser.values, option.dest, value) ! ... parser.add_option("--foo", action="callback", callback=store_value, *************** *** 1359,1363 **** arguments. For this case, you have to write a callback; \module{optparse} doesn't provide any built-in capabilities for it. ! You have to deal with the full-blown syntax for conventional Unix command-line parsing. (Previously, \module{optparse} took care of this for you, but I got it wrong. It was fixed at the cost of making --- 1396,1400 ---- arguments. For this case, you have to write a callback; \module{optparse} doesn't provide any built-in capabilities for it. ! You have to deal with the full-blown syntax for conventional \UNIX{} command-line parsing. (Previously, \module{optparse} took care of this for you, but I got it wrong. It was fixed at the cost of making *************** *** 1409,1413 **** setattr(parser.values, option.dest, value) ! [...] parser.add_option("-c", "--callback", action="callback", callback=varargs) --- 1446,1450 ---- setattr(parser.values, option.dest, value) ! ... parser.add_option("-c", "--callback", action="callback", callback=varargs) *************** *** 1651,1655 **** \begin{enumerate} \item subclass OptionParser and override the error() method ! \item subclass Option and override the take_action() method -- you'll need to provide your own handling of the "help" action that doesn't call sys.exit() --- 1688,1692 ---- \begin{enumerate} \item subclass OptionParser and override the error() method ! \item subclass Option and override the take_action() method --- you'll need to provide your own handling of the "help" action that doesn't call sys.exit() *************** *** 1691,1693 **** are present after parsing: ! \verbatiminput{required_2.py} \ No newline at end of file --- 1728,1730 ---- are present after parsing: ! \verbatiminput{required_2.py} From jlt63@users.sourceforge.net Fri Apr 18 18:27:49 2003 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Fri, 18 Apr 2003 10:27:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils unixccompiler.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv30186 Modified Files: unixccompiler.py Log Message: Patch #718049: Setting exe_extension for cygwin On cygwin, the setup.py script uses unixccompiler.py for compiling and linking C extensions. The unixccompiler.py script assumes that executables do not get special extensions, which makes sense for Unix. However, on Cygwin, executables get an .exe extension. This causes a problem during the configuration step (python setup.py config), in which some temporary executables may be generated. As unixccompiler.py does not know about the .exe extension, distutils fails to clean up after itself: it does not remove _configtest.exe but tries to remove _configtest instead. The attached patch to unixccompiler.py sets the correct exe_extension for cygwin by checking if sys.platform is 'cygwin'. With this patch, distutils cleans up after itself correctly. Michiel de Hoon University of Tokyo, Human Genome Center. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** unixccompiler.py 21 Nov 2002 20:33:24 -0000 1.51 --- unixccompiler.py 18 Apr 2003 17:27:47 -0000 1.52 *************** *** 78,81 **** --- 78,83 ---- dylib_lib_extension = ".dylib" static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" + if sys.platform == "cygwin": + exe_extension = ".exe" def preprocess(self, source, From gvanrossum@users.sourceforge.net Fri Apr 18 20:51:13 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 18 Apr 2003 12:51:13 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts combinerefs.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv338 Modified Files: combinerefs.py Log Message: Don't double-space the "??? new object ..." messages. Index: combinerefs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/combinerefs.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** combinerefs.py 18 Apr 2003 01:02:37 -0000 1.2 --- combinerefs.py 18 Apr 2003 19:51:10 -0000 1.3 *************** *** 107,111 **** addr, rc, guts = m.groups() # guts is type name here if addr not in addr2rc: ! print '??? new object created while tearing down:', line continue print addr, --- 107,111 ---- addr, rc, guts = m.groups() # guts is type name here if addr not in addr2rc: ! print '??? new object created while tearing down:', line.rstrip() continue print addr, From loewis@users.sourceforge.net Fri Apr 18 21:21:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 13:21:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codecs.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14896 Modified Files: test_codecs.py Log Message: Skip nameprep test 3.43, as we do allow unassigned characters. The test fails only in UCS-2 mode, since it tests a non-BMP character. Index: test_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_codecs.py 18 Apr 2003 10:39:52 -0000 1.6 --- test_codecs.py 18 Apr 2003 20:21:00 -0000 1.7 *************** *** 295,300 **** '\xd8\xa71\xd8\xa8'), # 3.43 Unassigned code point U+E0002. ! ('\xf3\xa0\x80\x82', ! None), # 3.44 Larger test (shrinking). # Original test case reads \xc3\xdf --- 295,302 ---- '\xd8\xa71\xd8\xa8'), # 3.43 Unassigned code point U+E0002. ! # Skip this test as we allow unassigned ! #('\xf3\xa0\x80\x82', ! # None), ! (None, None), # 3.44 Larger test (shrinking). # Original test case reads \xc3\xdf From loewis@users.sourceforge.net Fri Apr 18 22:04:41 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:04:41 -0700 Subject: [Python-checkins] python/dist/src/Lib DocXMLRPCServer.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2389/Lib Added Files: DocXMLRPCServer.py Log Message: Patch #536883: SimpleXMLRPCServer auto-docing subclass. --- NEW FILE: DocXMLRPCServer.py --- """Self documenting XML-RPC Server. This module can be used to create XML-RPC servers that serve pydoc-style documentation in response to HTTP GET requests. This documentation is dynamically generated based on the functions and methods registered with the server. This module is built upon the pydoc and SimpleXMLRPCServer modules. """ import pydoc import inspect import types import re from SimpleXMLRPCServer import SimpleXMLRPCServer,\ SimpleXMLRPCRequestHandler,\ CGIXMLRPCRequestHandler,\ resolve_dotted_attribute class ServerHTMLDoc(pydoc.HTMLDoc): """Class used to generate pydoc HTML document for a server""" def markup(self, text, escape=None, funcs={}, classes={}, methods={}): """Mark up some plain text, given a context of symbols to look for. Each context dictionary maps object names to anchor names.""" escape = escape or self.escape results = [] here = 0 # XXX Note that this regular expressions does not allow for the # hyperlinking of arbitrary strings being used as method # names. Only methods with names consisting of word characters # and '.'s are hyperlinked. pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|' r'RFC[- ]?(\d+)|' r'PEP[- ]?(\d+)|' r'(self\.)?((?:\w|\.)+))\b') while 1: match = pattern.search(text, here) if not match: break start, end = match.span() results.append(escape(text[here:start])) all, scheme, rfc, pep, selfdot, name = match.groups() if scheme: url = escape(all).replace('"', '"') results.append('
%s' % (url, url)) elif rfc: url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc) results.append('%s' % (url, escape(all))) elif pep: url = 'http://www.python.org/peps/pep-%04d.html' % int(pep) results.append('%s' % (url, escape(all))) elif text[end:end+1] == '(': results.append(self.namelink(name, methods, funcs, classes)) elif selfdot: results.append('self.%s' % name) else: results.append(self.namelink(name, classes)) here = end results.append(escape(text[here:])) return ''.join(results) def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" anchor = (cl and cl.__name__ or '') + '-' + name note = '' title = '%s' % (anchor, name) if inspect.ismethod(object): args, varargs, varkw, defaults = inspect.getargspec(object.im_func) # exclude the argument bound to the instance, it will be # confusing to the non-Python user argspec = inspect.formatargspec ( args[1:], varargs, varkw, defaults, formatvalue=self.formatvalue ) elif inspect.isfunction(object): args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) else: argspec = '(...)' if isinstance(object, types.TupleType): argspec = object[0] or argspec docstring = object[1] or "" else: docstring = pydoc.getdoc(object) decl = title + argspec + (note and self.grey( '%s' % note)) doc = self.markup( docstring, self.preformat, funcs, classes, methods) doc = doc and '
%s
' % doc return '
%s
%s
\n' % (decl, doc) def docserver(self, server_name, package_documentation, methods): """Produce HTML documentation for an XML-RPC server.""" fdict = {} for key, value in methods.items(): fdict[key] = '#-' + key fdict[value] = fdict[key] head = '%s' % server_name result = self.heading(head, '#ffffff', '#7799ee') doc = self.markup(package_documentation, self.preformat, fdict) doc = doc and '%s' % doc result = result + '

%s

\n' % doc contents = [] method_items = methods.items() method_items.sort() for key, value in method_items: contents.append(self.docroutine(value, key, funcs=fdict)) result = result + self.bigsection( 'Methods', '#ffffff', '#eeaa77', pydoc.join(contents)) return result class XMLRPCDocGenerator: """Generates documentation for an XML-RPC server. This class is designed as mix-in and should not be constructed directly. """ def __init__(self): # setup variables used for HTML documentation self.server_name = 'XML-RPC Server Documentation' self.server_documentation = \ "This server exports the following methods through the XML-RPC "\ "protocol." self.server_title = 'XML-RPC Server Documentation' def set_server_title(self, server_title): """Set the HTML title of the generated server documentation""" self.server_title = server_title def set_server_name(self, server_name): """Set the name of the generated HTML server documentation""" self.server_name = server_name def set_server_documentation(self, server_documentation): """Set the documentation string for the entire server.""" self.server_documentation = server_documentation def generate_html_documentation(self): """generate_html_documentation() => html documentation for the server Generates HTML documentation for the server using introspection for installed functions and instances that do not implement the _dispatch method. Alternatively, instances can choose to implement the _get_method_argstring(method_name) method to provide the argument string used in the documentation and the _methodHelp(method_name) method to provide the help text used in the documentation.""" methods = {} for method_name in self.system_listMethods(): if self.funcs.has_key(method_name): method = self.funcs[method_name] elif self.instance is not None: method_info = [None, None] # argspec, documentation if hasattr(self.instance, '_get_method_argstring'): method_info[0] = self.instance._get_method_argstring(method_name) if hasattr(self.instance, '_methodHelp'): method_info[1] = self.instance._methodHelp(method_name) method_info = tuple(method_info) if method_info != (None, None): method = method_info elif not hasattr(self.instance, '_dispatch'): try: method = resolve_dotted_attribute( self.instance, method_name ) except AttributeError: method = method_info else: method = method_info else: assert 0, "Could not find method in self.functions and no "\ "instance installed" methods[method_name] = method documenter = ServerHTMLDoc() documentation = documenter.docserver( self.server_name, self.server_documentation, methods ) return documenter.page(self.server_title, documentation) class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): """XML-RPC and documentation request handler class. Handles all HTTP POST requests and attempts to decode them as XML-RPC requests. Handles all HTTP GET requests and interprets them as requests for documentation. """ def do_GET(self): """Handles the HTTP GET request. Interpret all HTTP GET requests as requests for server documentation. """ response = self.server.generate_html_documentation() self.send_response(200) self.send_header("Content-type", "text/html") self.send_header("Content-length", str(len(response))) self.end_headers() self.wfile.write(response) # shut down the connection self.wfile.flush() self.connection.shutdown(1) class DocXMLRPCServer( SimpleXMLRPCServer, XMLRPCDocGenerator): """XML-RPC and HTML documentation server. Adds the ability to serve server documentation to the capabilities of SimpleXMLRPCServer. """ def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler, logRequests=1): SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests) XMLRPCDocGenerator.__init__(self) class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, XMLRPCDocGenerator): """Handler for XML-RPC data and documentation requests passed through CGI""" def handle_get(self): """Handles the HTTP GET request. Interpret all HTTP GET requests as requests for server documentation. """ response = self.generate_html_documentation() print 'Content-Type: text/html' print 'Content-Length: %d' % len(response) print print response def __init__(self): CGIXMLRPCRequestHandler.__init__(self) XMLRPCDocGenerator.__init__(self) if __name__ == '__main__': def deg_to_rad(deg): """deg_to_rad(90) => 1.5707963267948966 Converts an angle in degrees to an angle in radians""" import math return deg * math.pi / 180 server = DocXMLRPCServer(("localhost", 8000)) server.set_server_title("Math Server") server.set_server_name("Math XML-RPC Server") server.set_server_documentation("""This server supports various mathematical functions. You can use it from Python as follows: >>> from xmlrpclib import ServerProxy >>> s = ServerProxy("http://localhost:8000") >>> s.deg_to_rad(90.0) 1.5707963267948966""") server.register_function(deg_to_rad) server.register_introspection_functions() server.serve_forever() From loewis@users.sourceforge.net Fri Apr 18 22:04:43 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:04:43 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.733,1.734 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2389/Misc Modified Files: NEWS Log Message: Patch #536883: SimpleXMLRPCServer auto-docing subclass. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.733 retrieving revision 1.734 diff -C2 -d -r1.733 -r1.734 *** NEWS 18 Apr 2003 10:39:52 -0000 1.733 --- NEWS 18 Apr 2003 21:04:39 -0000 1.734 *************** *** 119,122 **** --- 119,124 ---- ------- + - The self-documenting XML server library DocXMLRPCServer was added. + - Support for internationalized domain names has been added through the 'idna' and 'punycode' encodings, the 'stringprep' module, the From loewis@users.sourceforge.net Fri Apr 18 22:05:12 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:05:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.138,1.139 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv2389/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Patch #536883: SimpleXMLRPCServer auto-docing subclass. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** whatsnew23.tex 18 Apr 2003 10:39:51 -0000 1.138 --- whatsnew23.tex 18 Apr 2003 21:04:35 -0000 1.139 *************** *** 1813,1816 **** --- 1813,1824 ---- \code{mkstringprep} and the \code{punycode} encoding have been added. + \item The new \module{DocXMLRPCServer} allows to write + self-documenting XML-RPC servers. Run it in demo mode (as a program) + to see it in action: Pointing the Web browser to the RPC server + produces pydoc-style documentation; pointing xmlrpclib to the + server allows to invoke the actual methods. + + Contributed by Brian Quinlan. + \end{itemize} From loewis@users.sourceforge.net Fri Apr 18 22:05:09 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:05:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdocxmlrpc.tex,NONE,1.1 lib.tex,1.219,1.220 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2389/Doc/lib Modified Files: lib.tex Added Files: libdocxmlrpc.tex Log Message: Patch #536883: SimpleXMLRPCServer auto-docing subclass. --- NEW FILE: libdocxmlrpc.tex --- \section{\module{DocXMLRPCServer} --- Self-documenting XML-RPC server} \declaremodule{standard}{DocXMLRPCServer} \modulesynopsis{Self-documenting XML-RPC server implementation.} \moduleauthor{Brian Quinlan}{brianq@activestate.com} \sectionauthor{Brian Quinlan}{brianq@activestate.com} \versionadded{2.3} The \module{DocXMLRPCServer} module extends the classes found in \module{SimpleXMLRPCServer} to serve HTML documentation in response to HTTP GET requests. Servers can either be free standing, using \class{DocXMLRPCServer}, or embedded in a CGI environment, using \class{DocCGIXMLRPCRequestHandler}. \begin{classdesc}{DocXMLRPCServer}{addr\optional{, requestHandler\optional{, logRequests}}} Create a new server instance. All parameters have the same meaning as for \class{SimpleXMLRPCServer.SimpleXMLRPCServer}; \var{requestHandler} defaults to \class{DocXMLRPCRequestHandler}. \end{classdesc} \begin{classdesc}{DocCGIXMLRPCRequestHandler}{} Create a new instance to handle XML-RPC requests in a CGI environment. \end{classdesc} \begin{classdesc}{DocXMLRPCRequestHandler}{} Create a new request handler instance. This request handler supports XML-RPC POST requests, documentation GET requests, and modifies logging so that the \var{logRequests} parameter to the \class{DocXMLRPCServer} constructor parameter is honored. \end{classdesc} \subsection{DocXMLRPCServer Objects \label{doc-xmlrpc-servers}} The \class{DocXMLRPCServer} class is derived from \class{SimpleXMLRPCServer.SimpleXMLRPCServer} and provides a means of creating self-documenting, stand alone XML-RPC servers. HTTP POST requests are handled as XML-RPC method calls. HTTP GET requests are handled by generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. \begin{methoddesc}{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} \begin{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" element. \end{methoddesc} \begin{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the documentation. \end{methoddesc} \subsection{DocCGIXMLRPCRequestHandler} The \class{DocCGIXMLRPCRequestHandler} class is derived from \class{SimpleXMLRPCServer.CGIXMLRPCRequestHandler} and provides a means of creating self-documenting, XML-RPC CGI scripts. HTTP POST requests are handled as XML-RPC method calls. HTTP GET requests are handled by generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. \begin{methoddesc}{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} \begin{methoddesc}{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" element. \end{methoddesc} \begin{methoddesc}{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the documentation. \end{methoddesc} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.219 retrieving revision 1.220 diff -C2 -d -r1.219 -r1.220 *** lib.tex 18 Apr 2003 10:39:50 -0000 1.219 --- lib.tex 18 Apr 2003 21:04:33 -0000 1.220 *************** *** 232,235 **** --- 232,236 ---- \input{libxmlrpclib} \input{libsimplexmlrpc} + \input{libdocxmlrpc} \input{libasyncore} \input{libasynchat} From loewis@users.sourceforge.net Fri Apr 18 22:45:29 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:45:29 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.105,1.106 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv20974 Modified Files: Makefile.deps Log Message: Add lib/libstringprep.tex lib/libdocxmlrpc.tex. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** Makefile.deps 11 Apr 2003 15:35:25 -0000 1.105 --- Makefile.deps 18 Apr 2003 21:45:26 -0000 1.106 *************** *** 131,134 **** --- 131,135 ---- lib/libcodecs.tex \ lib/libunicodedata.tex \ + lib/libstringprep.tex \ lib/libstruct.tex \ lib/libmisc.tex \ *************** *** 252,255 **** --- 253,257 ---- lib/libxmlrpclib.tex \ lib/libsimplexmlrpc.tex \ + lib/libdocxmlrpc.tex \ lib/libpyexpat.tex \ lib/xmldom.tex \ From loewis@users.sourceforge.net Fri Apr 18 22:48:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:48:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdocxmlrpc.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21947/lib Modified Files: libdocxmlrpc.tex Log Message: Correct methoddesc environments. Index: libdocxmlrpc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdocxmlrpc.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libdocxmlrpc.tex 18 Apr 2003 21:04:35 -0000 1.1 --- libdocxmlrpc.tex 18 Apr 2003 21:48:13 -0000 1.2 *************** *** 55,59 **** \end{methoddesc} ! \begin{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will --- 55,59 ---- \end{methoddesc} ! \begin{methoddesc}{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will *************** *** 64,68 **** ! \begin{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This --- 64,68 ---- ! \begin{methoddesc}{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This From loewis@users.sourceforge.net Fri Apr 18 22:48:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:48:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv22139/lib Modified Files: libcodecs.tex Log Message: Fix spelling of cedillas. Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** libcodecs.tex 18 Apr 2003 10:39:50 -0000 1.18 --- libcodecs.tex 18 Apr 2003 21:48:55 -0000 1.19 *************** *** 891,895 **** These RFCs together define a protocol to support non-ASCII characters in domain names. A domain name containing non-ASCII characters (such ! as ``www.Alliancefran\,caise.nu'') is converted into an ASCII-compatible encoding (ACE, such as ``www.xn--alliancefranaise-npb.nu''). The ACE form of the domain name --- 891,895 ---- These RFCs together define a protocol to support non-ASCII characters in domain names. A domain name containing non-ASCII characters (such ! as ``www.Alliancefran\c{c}aise.nu'') is converted into an ASCII-compatible encoding (ACE, such as ``www.xn--alliancefranaise-npb.nu''). The ACE form of the domain name From loewis@users.sourceforge.net Fri Apr 18 22:48:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 14:48:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.139,1.140 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv22139/whatsnew Modified Files: whatsnew23.tex Log Message: Fix spelling of cedillas. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** whatsnew23.tex 18 Apr 2003 21:04:35 -0000 1.139 --- whatsnew23.tex 18 Apr 2003 21:48:56 -0000 1.140 *************** *** 1797,1804 **** encoding (ACE). ! \begin{verbatim} ! >>> u"www.Alliancefran\,caise.nu".encode("idna") 'www.xn--alliancefranaise-npb.nu' ! \end{verbatim} In addition, the \module{socket} has been extended to transparently --- 1797,1804 ---- encoding (ACE). ! \begin{alltt} ! >>> u"www.Alliancefran\c{c}aise.nu".encode("idna") 'www.xn--alliancefranaise-npb.nu' ! \end{alltt} In addition, the \module{socket} has been extended to transparently From loewis@users.sourceforge.net Fri Apr 18 23:04:37 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 18 Apr 2003 15:04:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liblocale.tex,1.31,1.32 xmldom.tex,1.22,1.23 xmldomminidom.tex,1.7,1.8 xmlsax.tex,1.6,1.7 xmlsaxhandler.tex,1.9,1.10 xmlsaxreader.tex,1.4,1.5 xmlsaxutils.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28036 Modified Files: liblocale.tex xmldom.tex xmldomminidom.tex xmlsax.tex xmlsaxhandler.tex xmlsaxreader.tex xmlsaxutils.tex Log Message: Change email address. Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** liblocale.tex 3 Nov 2002 17:20:12 -0000 1.31 --- liblocale.tex 18 Apr 2003 22:04:33 -0000 1.32 *************** *** 4,9 **** \declaremodule{standard}{locale} \modulesynopsis{Internationalization services.} ! \moduleauthor{Martin von L\"owis}{loewis@informatik.hu-berlin.de} ! \sectionauthor{Martin von L\"owis}{loewis@informatik.hu-berlin.de} --- 4,9 ---- \declaremodule{standard}{locale} \modulesynopsis{Internationalization services.} ! \moduleauthor{Martin von L\"owis}{martin@v.loewis.de} ! \sectionauthor{Martin von L\"owis}{martin@v.loewis.de} Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** xmldom.tex 13 Nov 2002 15:56:13 -0000 1.22 --- xmldom.tex 18 Apr 2003 22:04:34 -0000 1.23 *************** *** 5,9 **** \modulesynopsis{Document Object Model API for Python.} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \versionadded{2.0} --- 5,9 ---- \modulesynopsis{Document Object Model API for Python.} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \versionadded{2.0} Index: xmldomminidom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldomminidom.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** xmldomminidom.tex 24 Oct 2002 19:36:04 -0000 1.7 --- xmldomminidom.tex 18 Apr 2003 22:04:34 -0000 1.8 *************** *** 6,10 **** \moduleauthor{Paul Prescod}{paul@prescod.net} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \versionadded{2.0} --- 6,10 ---- \moduleauthor{Paul Prescod}{paul@prescod.net} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \versionadded{2.0} Index: xmlsax.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsax.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** xmlsax.tex 25 Jun 2002 16:58:58 -0000 1.6 --- xmlsax.tex 18 Apr 2003 22:04:34 -0000 1.7 *************** *** 7,11 **** \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \versionadded{2.0} --- 7,11 ---- \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \versionadded{2.0} Index: xmlsaxhandler.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxhandler.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** xmlsaxhandler.tex 25 Jun 2002 17:10:49 -0000 1.9 --- xmlsaxhandler.tex 18 Apr 2003 22:04:34 -0000 1.10 *************** *** 4,8 **** \declaremodule{standard}{xml.sax.handler} \modulesynopsis{Base classes for SAX event handlers.} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} --- 4,8 ---- \declaremodule{standard}{xml.sax.handler} \modulesynopsis{Base classes for SAX event handlers.} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} Index: xmlsaxreader.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxreader.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xmlsaxreader.tex 25 Jun 2002 17:10:50 -0000 1.4 --- xmlsaxreader.tex 18 Apr 2003 22:04:34 -0000 1.5 *************** *** 4,8 **** \declaremodule{standard}{xml.sax.xmlreader} \modulesynopsis{Interface which SAX-compliant XML parsers must implement.} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} --- 4,8 ---- \declaremodule{standard}{xml.sax.xmlreader} \modulesynopsis{Interface which SAX-compliant XML parsers must implement.} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} Index: xmlsaxutils.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxutils.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xmlsaxutils.tex 26 Oct 2002 14:50:45 -0000 1.4 --- xmlsaxutils.tex 18 Apr 2003 22:04:34 -0000 1.5 *************** *** 4,8 **** \declaremodule{standard}{xml.sax.saxutils} \modulesynopsis{Convenience functions and classes for use with SAX.} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} --- 4,8 ---- \declaremodule{standard}{xml.sax.saxutils} \modulesynopsis{Convenience functions and classes for use with SAX.} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} From bwarsaw@users.sourceforge.net Sat Apr 19 00:03:57 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 18 Apr 2003 16:03:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib emailmessage.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18057 Modified Files: emailmessage.tex Log Message: Added some more documentation to as_string() to make it clear that it's a convenience only. Give an example of what to do for more flexibility. Index: emailmessage.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmessage.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** emailmessage.tex 10 Mar 2003 16:13:50 -0000 1.10 --- emailmessage.tex 18 Apr 2003 23:03:53 -0000 1.11 *************** *** 37,40 **** --- 37,54 ---- \var{unixfrom} is \code{True}, the envelope header is included in the returned string. \var{unixfrom} defaults to \code{False}. + + Note that this method is provided as a convenience and may not always + format the message the way you want. For more flexibility, + instantiate a \class{Generator} instance and use its + \method{flatten()} method directly. For example: + + \begin{verbatim} + from cStringIO import StringIO + from email.Generator import Generator + fp = StringIO() + g = Generator(mangle_from_=False, maxheaderlen=60) + g.flatten(msg) + text = fp.getvalue() + \end{verbatim} \end{methoddesc} From bwarsaw@users.sourceforge.net Sat Apr 19 00:04:38 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 18 Apr 2003 16:04:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv18340 Modified Files: Message.py Log Message: as_string(): Added some text to the docstring to make it clear that it's a convenience only and give hints on what to do for more flexibility. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Message.py 11 Mar 2003 04:33:30 -0000 1.30 --- Message.py 18 Apr 2003 23:04:35 -0000 1.31 *************** *** 103,106 **** --- 103,110 ---- Optional `unixfrom' when True, means include the Unix From_ envelope header. + + This is a convenience method and may not generate the message exactly + as you intend. For more flexibility, use the flatten() method of a + Generator instance. """ from email.Generator import Generator From mhammond@users.sourceforge.net Sat Apr 19 02:11:26 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Fri, 18 Apr 2003 18:11:26 -0700 Subject: [Python-checkins] python/nondist/peps pep-0311.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv23710 Modified Files: pep-0311.txt Log Message: Updated version with new names and no (known!) outstanding issues. Index: pep-0311.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0311.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0311.txt 14 Feb 2003 14:51:27 -0000 1.2 --- pep-0311.txt 19 Apr 2003 01:11:23 -0000 1.3 *************** *** 8,32 **** Content-Type: text/plain Created: 05-Feb-2003 ! Post-History: 05-Feb-2003 14-Feb-2003 ! ! ! Open Issues ! ! This is where I note comments from people that are yet to be ! resolved. ! ! - JustvR prefers a PyGIL prefix over PyAutoThreadState. ! - JackJ notes that the "Auto" prefix will look a little silly ! in a few years, assuming this becomes the standard way of ! managing the lock. He doesn't really like Just's "GIL", and ! suggested "PyIntLock" ! - JackJ prefers "Acquire" over "Ensure", even though the semantics ! are different than for other "Acquire" functions in the API. ! Mark still prefers Ensure for exactly this reason. ! - Mark notes Dutch people must love names, and still remembers ! "pulling dead cows from the ditch" (but has forgotten the ! Dutch!) He also hopes Jack remembers the reference . ! - Should we provide Py_AUTO_THREAD_STATE macros? ! - Is my "Limitation" regarding PyEval_InitThreads() OK? --- 8,12 ---- Content-Type: text/plain Created: 05-Feb-2003 ! Post-History: 05-Feb-2003 14-Feb-2003 19-Apr-2003 *************** *** 140,186 **** platforms built with WITH_THREAD defined. ! The intent is that an extension author be able to use a small, ! well-defined "prologue dance", at any time and on any thread, and ! assuming Python has correctly been initialized, this dance will ! ensure Python is ready to be used on that thread. After the ! extension has finished with Python, it must also perform an ! "epilogue dance" to release any resources previously acquired. ! Ideally, these dances can be expressed in a single line. Specifically, the following new APIs are proposed: ! /* Ensure that the current thread is ready to call the Python C ! API, regardless of the current state of Python, or of its thread ! lock. This may be called as many times as desired by a thread, so ! long as each call is matched with a call to ! PyAutoThreadState_Release() ! ! The return value is an opaque "handle" to the thread state when ! PyAutoThreadState_Ensure() was called, and must be passed to ! PyAutoThreadState_Release() to ensure Python is left in the same ! state. ! ! When the function returns, the current thread will hold the GIL. ! Thus, the GIL is held by the thread until ! PyAutoThreadState_Release() is called. (Note that as happens now ! in Python, calling a Python API function may indeed cause a ! thread-switch and therefore a GIL ownership change. However, ! Python guarantees that when the API function returns, the GIL will ! again be owned by the thread making the call) ! ! Failure is a fatal error. */ ! PyAutoThreadState_State PyAutoThreadState_Ensure(void); ! ! /* Release any resources previously acquired. After this call, ! Python's state will be the same as it was prior to the ! corresponding PyAutoThreadState_Ensure call (but generally this ! state will be unknown to the caller, hence the use of the ! AutoThreadState API.) ! Every call to PyAutoThreadState_Ensure must be matched by a ! call to PyAutoThreadState_Release on the same thread. */ ! void PyAutoThreadState_Release(PyAutoThreadState_State state); Common usage will be: --- 120,165 ---- platforms built with WITH_THREAD defined. ! The intent is that assuming Python has correctly been initialized, ! an extension author be able to use a small, well-defined "prologue ! dance", at any time and on any thread, which will ensure Python ! is ready to be used on that thread. After the extension has ! finished with Python, it must also perform an "epilogue dance" to ! release any resources previously acquired. Ideally, these dances ! can be expressed in a single line. Specifically, the following new APIs are proposed: ! /* Ensure that the current thread is ready to call the Python ! C API, regardless of the current state of Python, or of its ! thread lock. This may be called as many times as desired ! by a thread so long as each call is matched with a call to ! PyGILState_Release(). In general, other thread-state APIs may ! be used between _Ensure() and _Release() calls, so long as the ! thread-state is restored to its previous state before the Release(). ! For example, normal use of the Py_BEGIN_ALLOW_THREADS/ ! Py_END_ALLOW_THREADS macros are acceptable. ! ! The return value is an opaque "handle" to the thread state when ! PyGILState_Acquire() was called, and must be passed to ! PyGILState_Release() to ensure Python is left in the same state. Even ! though recursive calls are allowed, these handles can *not* be ! shared - each unique call to PyGILState_Ensure must save the handle ! for its call to PyGILState_Release. ! ! When the function returns, the current thread will hold the GIL. ! ! Failure is a fatal error. */ ! PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); ! /* Release any resources previously acquired. After this call, Python's ! state will be the same as it was prior to the corresponding ! PyGILState_Acquire call (but generally this state will be unknown to ! the caller, hence the use of the GILState API.) ! ! Every call to PyGILState_Ensure must be matched by a call to ! PyGILState_Release on the same thread. */ ! PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); Common usage will be: *************** *** 189,197 **** { /* ensure we hold the lock */ ! PyAutoThreadState_State state = PyAutoThreadState_Ensure(); /* Use the Python API */ ... /* Restore the state of Python */ ! PyAutoThreadState_Release(state); } --- 168,176 ---- { /* ensure we hold the lock */ ! PyGILState_STATE state = PyGILState_Ensure(); /* Use the Python API */ ... /* Restore the state of Python */ ! PyGILState_Release(state); } *************** *** 199,204 **** Design and Implementation ! The general operation of PyAutoThreadState_Ensure() will be: ! - assert Python is initialized. - Get a PyThreadState for the current thread, creating and saving --- 178,182 ---- Design and Implementation ! The general operation of PyGILState_Ensure() will be: - assert Python is initialized. - Get a PyThreadState for the current thread, creating and saving *************** *** 213,220 **** - assert our thread currently holds the lock. ! - If old state indicates lock as previously unlocked, release GIL. - Decrement the PyAutoThreadState_Ensure counter for the thread. - If counter == 0: ! - release the PyThreadState. - forget the ThreadState as being owned by the thread. - return --- 191,198 ---- - assert our thread currently holds the lock. ! - If old state indicates lock was previously unlocked, release GIL. - Decrement the PyAutoThreadState_Ensure counter for the thread. - If counter == 0: ! - release and delete the PyThreadState. - forget the ThreadState as being owned by the thread. - return From bcannon@users.sourceforge.net Sat Apr 19 05:00:59 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 18 Apr 2003 21:00:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1962/Lib/test Modified Files: test_strptime.py Log Message: Make _strptime escape regex syntax in format string to prevent use in internal regex. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_strptime.py 9 Mar 2003 07:44:42 -0000 1.10 --- test_strptime.py 19 Apr 2003 04:00:56 -0000 1.11 *************** *** 169,172 **** --- 169,180 ---- pattern_string) + def test_pattern_escaping(self): + # Make sure any characters in the format string that might be taken as + # regex syntax is escaped. + pattern_string = self.time_re.pattern("\d+") + self.failUnless(r"\\d\+" in pattern_string, + "%s does not have re characters escaped properly" % + pattern_string) + def test_compile(self): # Check that compiled regex is correct *************** *** 201,204 **** --- 209,218 ---- self.failUnless(_strptime.TimeRE(test_locale).pattern("%Z") == '', "with timezone == ('',''), TimeRE().pattern('%Z') != ''") + + def test_matching_with_escapes(self): + # Make sure a format that requires escaping of characters works + compiled_re = self.time_re.compile("\w+ %m") + found = compiled_re.match("\w+ 10") + self.failUnless(found, "Escaping failed of format '\w+ 10'") class StrptimeTests(unittest.TestCase): From bcannon@users.sourceforge.net Sat Apr 19 05:00:59 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 18 Apr 2003 21:00:59 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1962/Lib Modified Files: _strptime.py Log Message: Make _strptime escape regex syntax in format string to prevent use in internal regex. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** _strptime.py 9 Mar 2003 07:44:41 -0000 1.13 --- _strptime.py 19 Apr 2003 04:00:54 -0000 1.14 *************** *** 374,379 **** def pattern(self, format): ! """Return re pattern for the format string.""" processed_format = '' whitespace_replacement = re_compile('\s+') format = whitespace_replacement.sub('\s*', format) --- 374,388 ---- def pattern(self, format): ! """Return re pattern for the format string. ! ! Need to make sure that any characters that might be interpreted as ! regex syntax is escaped. ! ! """ processed_format = '' + # The sub() call escapes all characters that might be misconstrued + # as regex syntax. + regex_chars = re_compile(r"([\\.^$*+?{}\[\]|])") + format = regex_chars.sub(r"\\\1", format) whitespace_replacement = re_compile('\s+') format = whitespace_replacement.sub('\s*', format) From loewis@users.sourceforge.net Sat Apr 19 08:44:54 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 00:44:54 -0700 Subject: [Python-checkins] python/dist/src/Python thread_pthread.h,2.45,2.46 thread_solaris.h,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27572 Modified Files: thread_pthread.h thread_solaris.h Log Message: Patch #716969: Detect thread creation failure. Will backport to 2.2. Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** thread_pthread.h 18 Apr 2003 11:11:09 -0000 2.45 --- thread_pthread.h 19 Apr 2003 07:44:52 -0000 2.46 *************** *** 189,193 **** { pthread_t th; ! int success; sigset_t oldmask, newmask; #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) --- 189,193 ---- { pthread_t th; ! int status; sigset_t oldmask, newmask; #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) *************** *** 215,219 **** SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask); ! success = pthread_create(&th, #if defined(PY_PTHREAD_D4) pthread_attr_default, --- 215,219 ---- SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask); ! status = pthread_create(&th, #if defined(PY_PTHREAD_D4) pthread_attr_default, *************** *** 245,255 **** pthread_attr_destroy(&attrs); #endif ! if (success == 0) { #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7) ! pthread_detach(&th); #elif defined(PY_PTHREAD_STD) ! pthread_detach(th); #endif ! } #if SIZEOF_PTHREAD_T <= SIZEOF_LONG return (long) th; --- 245,257 ---- pthread_attr_destroy(&attrs); #endif ! if (status != 0) ! return -1; ! #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7) ! pthread_detach(&th); #elif defined(PY_PTHREAD_STD) ! pthread_detach(th); #endif ! #if SIZEOF_PTHREAD_T <= SIZEOF_LONG return (long) th; Index: thread_solaris.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_solaris.h,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** thread_solaris.h 19 Jan 2002 22:02:55 -0000 2.18 --- thread_solaris.h 19 Apr 2003 07:44:52 -0000 2.19 *************** *** 41,46 **** thread_t tid; struct func_arg *funcarg; - int success = 0; /* init not needed when SOLARIS_THREADS and */ - /* C_THREADS implemented properly */ dprintf(("PyThread_start_new_thread called\n")); --- 41,44 ---- *************** *** 54,58 **** perror("thr_create"); free((void *) funcarg); ! success = -1; } return tid; --- 52,56 ---- perror("thr_create"); free((void *) funcarg); ! return -1; } return tid; From loewis@users.sourceforge.net Sat Apr 19 08:46:30 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 00:46:30 -0700 Subject: [Python-checkins] python/dist/src/Python thread_pthread.h,2.36.8.3,2.36.8.4 thread_solaris.h,2.16.10.1,2.16.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27985 Modified Files: Tag: release22-maint thread_pthread.h thread_solaris.h Log Message: Patch #716969: Detect thread creation failure. Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.36.8.3 retrieving revision 2.36.8.4 diff -C2 -d -r2.36.8.3 -r2.36.8.4 *** thread_pthread.h 18 Apr 2003 11:21:22 -0000 2.36.8.3 --- thread_pthread.h 19 Apr 2003 07:46:28 -0000 2.36.8.4 *************** *** 154,158 **** { pthread_t th; ! int success; sigset_t oldmask, newmask; #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) --- 154,158 ---- { pthread_t th; ! int status; sigset_t oldmask, newmask; #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) *************** *** 180,184 **** SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask); ! success = pthread_create(&th, #if defined(PY_PTHREAD_D4) pthread_attr_default, --- 180,184 ---- SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask); ! status = pthread_create(&th, #if defined(PY_PTHREAD_D4) pthread_attr_default, *************** *** 210,220 **** pthread_attr_destroy(&attrs); #endif ! if (success == 0) { #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7) ! pthread_detach(&th); #elif defined(PY_PTHREAD_STD) ! pthread_detach(th); #endif ! } #if SIZEOF_PTHREAD_T <= SIZEOF_LONG return (long) th; --- 210,222 ---- pthread_attr_destroy(&attrs); #endif ! if (status != 0) ! return -1; ! #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7) ! pthread_detach(&th); #elif defined(PY_PTHREAD_STD) ! pthread_detach(th); #endif ! #if SIZEOF_PTHREAD_T <= SIZEOF_LONG return (long) th; Index: thread_solaris.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_solaris.h,v retrieving revision 2.16.10.1 retrieving revision 2.16.10.2 diff -C2 -d -r2.16.10.1 -r2.16.10.2 *** thread_solaris.h 12 Jan 2002 11:13:24 -0000 2.16.10.1 --- thread_solaris.h 19 Apr 2003 07:46:28 -0000 2.16.10.2 *************** *** 41,46 **** thread_t tid; struct func_arg *funcarg; - int success = 0; /* init not needed when SOLARIS_THREADS and */ - /* C_THREADS implemented properly */ dprintf(("PyThread_start_new_thread called\n")); --- 41,44 ---- *************** *** 54,58 **** perror("thr_create"); free((void *) funcarg); ! success = -1; } return tid; --- 52,56 ---- perror("thr_create"); free((void *) funcarg); ! return -1; } return tid; From loewis@users.sourceforge.net Sat Apr 19 09:37:27 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 01:37:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sre.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7931/Lib/test Modified Files: test_sre.py Log Message: Patch #681152: Support escaped Unicode characters in classes. Fixes #612074. Will backport to 2.2. Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_sre.py 14 Apr 2003 17:59:33 -0000 1.39 --- test_sre.py 19 Apr 2003 08:37:24 -0000 1.40 *************** *** 97,100 **** --- 97,104 ---- test(r"""sre.search('(a|b)*?c', 10000*'ab'+'cd').end(0)""", None, RuntimeError) + # bug 612074 + pat=u"["+sre.escape(u"\u2039")+u"]" + test(r"""sre.compile(pat) and 1""", 1, None) + if verbose: print 'Running tests on sre.sub' From loewis@users.sourceforge.net Sat Apr 19 09:37:27 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 01:37:27 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_parse.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7931/Lib Modified Files: sre_parse.py Log Message: Patch #681152: Support escaped Unicode characters in classes. Fixes #612074. Will backport to 2.2. Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** sre_parse.py 14 Apr 2003 17:59:32 -0000 1.56 --- sre_parse.py 19 Apr 2003 08:37:23 -0000 1.57 *************** *** 255,259 **** raise error, "bogus escape: %s" % repr("\\" + escape) return LITERAL, atoi(escape, 16) & 0xff ! elif str(escape[1:2]) in OCTDIGITS: # octal escape (up to three digits) while source.next in OCTDIGITS and len(escape) < 5: --- 255,259 ---- raise error, "bogus escape: %s" % repr("\\" + escape) return LITERAL, atoi(escape, 16) & 0xff ! elif escape[1:2] in OCTDIGITS: # octal escape (up to three digits) while source.next in OCTDIGITS and len(escape) < 5: From loewis@users.sourceforge.net Sat Apr 19 09:39:07 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 01:39:07 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_parse.py,1.51,1.51.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8605/Lib Modified Files: Tag: release22-maint sre_parse.py Log Message: Patch #681152: Support escaped unicode characters in classes. Fixes 612074. Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.51 retrieving revision 1.51.6.1 diff -C2 -d -r1.51 -r1.51.6.1 *** sre_parse.py 9 Dec 2001 16:13:15 -0000 1.51 --- sre_parse.py 19 Apr 2003 08:39:04 -0000 1.51.6.1 *************** *** 255,259 **** raise error, "bogus escape: %s" % repr("\\" + escape) return LITERAL, atoi(escape, 16) & 0xff ! elif str(escape[1:2]) in OCTDIGITS: # octal escape (up to three digits) while source.next in OCTDIGITS and len(escape) < 5: --- 255,259 ---- raise error, "bogus escape: %s" % repr("\\" + escape) return LITERAL, atoi(escape, 16) & 0xff ! elif escape[1:2] in OCTDIGITS: # octal escape (up to three digits) while source.next in OCTDIGITS and len(escape) < 5: From loewis@users.sourceforge.net Sat Apr 19 09:39:07 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 01:39:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sre.py,1.35,1.35.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv8605/Lib/test Modified Files: Tag: release22-maint test_sre.py Log Message: Patch #681152: Support escaped unicode characters in classes. Fixes 612074. Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.35 retrieving revision 1.35.6.1 diff -C2 -d -r1.35 -r1.35.6.1 *** test_sre.py 9 Dec 2001 16:13:15 -0000 1.35 --- test_sre.py 19 Apr 2003 08:39:04 -0000 1.35.6.1 *************** *** 79,82 **** --- 79,86 ---- test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1)) + # bug 612074 + pat=u"["+sre.escape(u"\u2039")+u"]" + test(r"""sre.compile(pat) and 1""", 1, None) + if verbose: print 'Running tests on sre.sub' From loewis@users.sourceforge.net Sat Apr 19 13:56:10 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 05:56:10 -0700 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.46,1.47 sre_constants.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11938/Lib Modified Files: sre_compile.py sre_constants.py Log Message: Fully support 32-bit codes. Enable BIGCHARSET in UCS-4 builds. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** sre_compile.py 14 Apr 2003 17:59:31 -0000 1.46 --- sre_compile.py 19 Apr 2003 12:56:07 -0000 1.47 *************** *** 17,21 **** assert _sre.MAGIC == MAGIC, "SRE module mismatch" ! MAXCODE = 65535 def _compile(code, pattern, flags): --- 17,24 ---- assert _sre.MAGIC == MAGIC, "SRE module mismatch" ! if _sre.CODESIZE == 2: ! MAXCODE = 65535 ! else: ! MAXCODE = 0xFFFFFFFFL def _compile(code, pattern, flags): *************** *** 192,198 **** return charset # cannot compress except IndexError: - if sys.maxunicode != 65535: - # XXX: big charsets don't work in UCS-4 builds - return charset # character set contains unicode characters return _optimize_unicode(charset, fixup) --- 195,198 ---- *************** *** 229,233 **** def _mk_bitmap(bits): data = [] ! m = 1; v = 0 for c in bits: if c: --- 229,237 ---- def _mk_bitmap(bits): data = [] ! if _sre.CODESIZE == 2: ! start = (1, 0) ! else: ! start = (1L, 0L) ! m, v = start for c in bits: if c: *************** *** 236,240 **** if m > MAXCODE: data.append(v) ! m = 1; v = 0 return data --- 240,244 ---- if m > MAXCODE: data.append(v) ! m, v = start return data *************** *** 259,277 **** # CHARSET matching). def _optimize_unicode(charset, fixup): charmap = [0]*65536 negate = 0 ! for op, av in charset: ! if op is NEGATE: ! negate = 1 ! elif op is LITERAL: ! charmap[fixup(av)] = 1 ! elif op is RANGE: ! for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = 1 ! elif op is CATEGORY: ! # XXX: could expand category ! return charset # cannot compress if negate: for i in range(65536): charmap[i] = not charmap[i] --- 263,298 ---- # CHARSET matching). + # In UCS-4 mode, the BIGCHARSET opcode still supports only subsets + # of the basic multilingual plane; an efficient representation + # for all of UTF-16 has not yet been developed. This means, + # in particular, that negated charsets cannot be represented as + # bigcharsets. + def _optimize_unicode(charset, fixup): + try: + import array + except ImportError: + return charset charmap = [0]*65536 negate = 0 ! try: ! for op, av in charset: ! if op is NEGATE: ! negate = 1 ! elif op is LITERAL: ! charmap[fixup(av)] = 1 ! elif op is RANGE: ! for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = 1 ! elif op is CATEGORY: ! # XXX: could expand category ! return charset # cannot compress ! except IndexError: ! # non-BMP characters ! return charset if negate: + if sys.maxunicode != 65535: + # XXX: negation does not work with big charsets + return charset for i in range(65536): charmap[i] = not charmap[i] *************** *** 288,297 **** data = data + _mk_bitmap(chunk) header = [block] ! assert MAXCODE == 65535 ! for i in range(128): ! if sys.byteorder == 'big': ! header.append(256*mapping[2*i]+mapping[2*i+1]) ! else: ! header.append(mapping[2*i]+256*mapping[2*i+1]) data[0:0] = header return [(BIGCHARSET, data)] --- 309,320 ---- data = data + _mk_bitmap(chunk) header = [block] ! if MAXCODE == 65535: ! code = 'H' ! else: ! code = 'L' ! # Convert block indices to byte array of 256 bytes ! mapping = array.array('b', mapping).tostring() ! # Convert byte array to word array ! header = header + array.array(code, mapping).tolist() data[0:0] = header return [(BIGCHARSET, data)] Index: sre_constants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_constants.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** sre_constants.py 14 Apr 2003 17:59:32 -0000 1.31 --- sre_constants.py 19 Apr 2003 12:56:07 -0000 1.32 *************** *** 14,18 **** # update when constants are added or removed ! MAGIC = 20010701 # max code word in this release --- 14,18 ---- # update when constants are added or removed ! MAGIC = 20030419 # max code word in this release From loewis@users.sourceforge.net Sat Apr 19 13:56:10 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 05:56:10 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.88,2.89 sre_constants.h,2.14,2.15 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11938/Modules Modified Files: _sre.c sre_constants.h Log Message: Fully support 32-bit codes. Enable BIGCHARSET in UCS-4 builds. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -d -r2.88 -r2.89 *** _sre.c 14 Apr 2003 17:59:34 -0000 2.88 --- _sre.c 19 Apr 2003 12:56:07 -0000 2.89 *************** *** 21,24 **** --- 21,25 ---- * 2001-12-07 fl fixed memory leak in sub/subn (Guido van Rossum) * 2002-11-09 fl fixed empty sub/subn return type + * 2003-04-18 mvl fully support 4-byte codes * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. *************** *** 511,518 **** case SRE_OP_CHARSET: ! /* (16 bits per code word) */ ! if (ch < 256 && (set[ch >> 4] & (1 << (ch & 15)))) ! return ok; ! set += 16; break; --- 512,527 ---- case SRE_OP_CHARSET: ! if (sizeof(SRE_CODE) == 2) { ! /* (16 bits per code word) */ ! if (ch < 256 && (set[ch >> 4] & (1 << (ch & 15)))) ! return ok; ! set += 16; ! } ! else { ! /* (32 bits per code word) */ ! if (ch < 256 && (set[ch >> 5] & (1 << (ch & 31)))) ! return ok; ! set += 8; ! } break; *************** *** 522,530 **** int count, block; count = *(set++); ! block = ((unsigned char*)set)[ch >> 8]; ! set += 128; ! if (set[block*16 + ((ch & 255)>>4)] & (1 << (ch & 15))) ! return ok; ! set += count*16; break; } --- 531,553 ---- int count, block; count = *(set++); ! ! if (sizeof(SRE_CODE) == 2) { ! block = ((unsigned char*)set)[ch >> 8]; ! set += 128; ! if (set[block*16 + ((ch & 255)>>4)] & (1 << (ch & 15))) ! return ok; ! set += count*16; ! } ! else { ! if (ch < 65536) ! block = ((unsigned char*)set)[ch >> 8]; ! else ! block = -1; ! set += 64; ! if (block >=0 && ! (set[block*8 + ((ch & 255)>>5)] & (1 << (ch & 31)))) ! return ok; ! set += count*8; ! } break; } *************** *** 1372,1376 **** for (i = 0; i < n; i++) { PyObject *o = PyList_GET_ITEM(code, i); ! self->code[i] = (SRE_CODE) PyInt_AsLong(o); } --- 1395,1402 ---- for (i = 0; i < n; i++) { PyObject *o = PyList_GET_ITEM(code, i); ! if (PyInt_Check(o)) ! self->code[i] = (SRE_CODE) PyInt_AsLong(o); ! else ! self->code[i] = (SRE_CODE) PyLong_AsUnsignedLong(o); } *************** *** 3043,3046 **** --- 3069,3078 ---- if (x) { PyDict_SetItemString(d, "MAGIC", x); + Py_DECREF(x); + } + + x = PyInt_FromLong(sizeof(SRE_CODE)); + if (x) { + PyDict_SetItemString(d, "CODESIZE", x); Py_DECREF(x); } Index: sre_constants.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sre_constants.h,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** sre_constants.h 14 Apr 2003 17:59:34 -0000 2.14 --- sre_constants.h 19 Apr 2003 12:56:08 -0000 2.15 *************** *** 12,16 **** */ ! #define SRE_MAGIC 20010701 #define SRE_OP_FAILURE 0 #define SRE_OP_SUCCESS 1 --- 12,16 ---- */ ! #define SRE_MAGIC 20030419 #define SRE_OP_FAILURE 0 #define SRE_OP_SUCCESS 1 From loewis@users.sourceforge.net Sat Apr 19 13:58:00 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 05:58:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_stringprep.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12519 Added Files: test_stringprep.py Log Message: New file. --- NEW FILE: test_stringprep.py --- # To fully test this module, we would need a copy of the stringprep tables. # Since we don't have them, this test checks only a few codepoints. from test.test_support import verify, vereq import sha import stringprep from stringprep import * verify(in_table_a1(u"\u0221")) verify(not in_table_a1(u"\u0222")) verify(in_table_b1(u"\u00ad")) verify(not in_table_b1(u"\u00ae")) verify(map_table_b2(u"\u0041"), u"\u0061") verify(map_table_b2(u"\u0061"), u"\u0061") verify(map_table_b3(u"\u0041"), u"\u0061") verify(map_table_b3(u"\u0061"), u"\u0061") verify(in_table_c11(u"\u0020")) verify(not in_table_c11(u"\u0021")) verify(in_table_c12(u"\u00a0")) verify(not in_table_c12(u"\u00a1")) verify(in_table_c12(u"\u00a0")) verify(not in_table_c12(u"\u00a1")) verify(in_table_c11_c12(u"\u00a0")) verify(not in_table_c11_c12(u"\u00a1")) verify(in_table_c21(u"\u001f")) verify(not in_table_c21(u"\u0020")) verify(in_table_c22(u"\u009f")) verify(not in_table_c22(u"\u00a0")) verify(in_table_c21_c22(u"\u009f")) verify(not in_table_c21_c22(u"\u00a0")) verify(in_table_c3(u"\ue000")) verify(not in_table_c3(u"\uf900")) verify(in_table_c4(u"\uffff")) verify(not in_table_c4(u"\u0000")) verify(in_table_c5(u"\ud800")) verify(not in_table_c5(u"\ud7ff")) verify(in_table_c6(u"\ufff9")) verify(not in_table_c6(u"\ufffe")) verify(in_table_c7(u"\u2ff0")) verify(not in_table_c7(u"\u2ffc")) verify(in_table_c8(u"\u0340")) verify(not in_table_c8(u"\u0342")) # C.9 is not in the bmp # verify(in_table_c9(u"\U000E0001")) # verify(not in_table_c8(u"\U000E0002")) verify(in_table_d1(u"\u05be")) verify(not in_table_d1(u"\u05bf")) verify(in_table_d2(u"\u0041")) verify(not in_table_d2(u"\u0040")) # This would generate a hash of all predicates. However, running # it is quite expensive, and only serves to detect changes in the # unicode database. Instead, stringprep.py asserts the version of # of the database. # predicates = [k for k in dir(stringprep) if k.startswith("in_table")] # predicates.sort() # for p in predicates: # f = getattr(stringprep, p) # # Collect all BMP code points # data = ["0"] * 0x10000 # for i in range(0x10000): # if f(unichr(i)): # data[i] = "1" # data = "".join(data) # h = sha.sha() # h.update(data) # print p,h.hexdigest() From akuchling@users.sourceforge.net Sat Apr 19 16:38:50 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 19 Apr 2003 08:38:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.140,1.141 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv29793 Modified Files: whatsnew23.tex Log Message: Mention the bz2 module Various rewrites Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** whatsnew23.tex 18 Apr 2003 21:48:56 -0000 1.140 --- whatsnew23.tex 19 Apr 2003 15:38:47 -0000 1.141 *************** *** 18,23 **** {\large This article is a draft, and is currently up to date for ! Python 2.3alpha2. Please send any additions, comments or errata to ! the author.} This article explains the new features in Python 2.3. The tentative --- 18,23 ---- {\large This article is a draft, and is currently up to date for ! Python 2.3beta1. Please send any additions, comments or errata to the ! author.} This article explains the new features in Python 2.3. The tentative *************** *** 1367,1372 **** \file{pickle2db.py} which you will find in the distribution's Tools/scripts directory. If you've already been using the PyBSDDB ! package, importing it as \module{bsddb3}, you will have to change your \code{import} statements. \item The Distutils \class{Extension} class now supports --- 1367,1377 ---- \file{pickle2db.py} which you will find in the distribution's Tools/scripts directory. If you've already been using the PyBSDDB ! package and importing it as \module{bsddb3}, you will have to change your \code{import} statements. + + \item The new \module{bz2} module is an interface to the bz2 data + compression library. bz2 usually produces output that's smaller than + the compressed output from the \module{zlib} module, meaning that it + compresses data more highly. (Contributed by Gustavo Niemeyer.) \item The Distutils \class{Extension} class now supports *************** *** 1747,1755 **** (Contributed by Raymond Hettinger.) - \item The DOM implementation - in \module{xml.dom.minidom} can now generate XML output in a - particular encoding by providing an optional encoding argument to - the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. - item The \module{Tix} module has received various bug fixes and updates for the current version of the Tix package. --- 1752,1755 ---- *************** *** 1792,1799 **** Any breakage caused by this change should be reported as a bug. \item Support for internationalized domain names (RFCs 3454, 3490, 3491, and 3492) has been added. The ``idna'' encoding can be used to convert between a Unicode domain name and the ASCII-compatible ! encoding (ACE). \begin{alltt} --- 1792,1811 ---- Any breakage caused by this change should be reported as a bug. + \item The DOM implementation + in \module{xml.dom.minidom} can now generate XML output in a + particular encoding by providing an optional encoding argument to + the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. + + \item The new \module{DocXMLRPCServer} module allows writing + self-documenting XML-RPC servers. Run it in demo mode (as a program) + to see it in action. Pointing the Web browser to the RPC server + produces pydoc-style documentation; pointing xmlrpclib to the + server allows invoking the actual methods. + (Contributed by Brian Quinlan.) + \item Support for internationalized domain names (RFCs 3454, 3490, 3491, and 3492) has been added. The ``idna'' encoding can be used to convert between a Unicode domain name and the ASCII-compatible ! encoding (ACE) of that name. \begin{alltt} *************** *** 1802,1823 **** \end{alltt} ! In addition, the \module{socket} has been extended to transparently ! convert Unicode hostnames to the ACE before passing them to the C ! library. In turn, modules that pass hostnames ``through'' (such as ! \module{httplib}, \module{ftplib}) also support Unicode host names ! (httplib also sends ACE Host: headers). \module{urllib} supports ! Unicode URLs with non-ASCII host names as long as the \code{path} part ! of the URL is ASCII only. To implement this change, the module \module{stringprep}, the tool ! \code{mkstringprep} and the \code{punycode} encoding have been added. ! ! \item The new \module{DocXMLRPCServer} allows to write ! self-documenting XML-RPC servers. Run it in demo mode (as a program) ! to see it in action: Pointing the Web browser to the RPC server ! produces pydoc-style documentation; pointing xmlrpclib to the ! server allows to invoke the actual methods. ! ! Contributed by Brian Quinlan. \end{itemize} --- 1814,1828 ---- \end{alltt} ! The \module{socket} module has also been extended to transparently ! convert Unicode hostnames to the ACE version before passing them to ! the C library. Modules that deal with hostnames such as ! \module{httplib} and \module{ftplib}) also support Unicode host names; ! \module{httplib} also sends HTTP \samp{Host} headers using the ACE ! version of the domain name. \module{urllib} supports Unicode URLs ! with non-ASCII host names as long as the \code{path} part of the URL ! is ASCII only. To implement this change, the module \module{stringprep}, the tool ! \code{mkstringprep} and the \code{punycode} encoding have been added. \end{itemize} From mhammond@users.sourceforge.net Sat Apr 19 16:41:57 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sat, 19 Apr 2003 08:41:57 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.358,2.359 pystate.c,2.25,2.26 pythonrun.c,2.190,2.191 thread.c,2.45,2.46 thread_sgi.h,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv30725/Python Modified Files: ceval.c pystate.c pythonrun.c thread.c thread_sgi.h Log Message: New PyGILState_ API - implements pep 311, from patch 684256. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.358 retrieving revision 2.359 diff -C2 -d -r2.358 -r2.359 *** ceval.c 9 Apr 2003 19:06:17 -0000 2.358 --- ceval.c 19 Apr 2003 15:41:48 -0000 2.359 *************** *** 322,325 **** --- 322,327 ---- if (tstate == NULL) Py_FatalError("PyEval_AcquireThread: NULL new thread state"); + /* Check someone has called PyEval_InitThreads() to create the lock */ + assert(interpreter_lock); PyThread_acquire_lock(interpreter_lock, 1); if (PyThreadState_Swap(tstate) != NULL) Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** pystate.c 15 Apr 2003 15:12:39 -0000 2.25 --- pystate.c 19 Apr 2003 15:41:49 -0000 2.26 *************** *** 143,146 **** --- 143,147 ---- tstate->use_tracing = 0; tstate->tick_counter = 0; + tstate->gilstate_counter = 0; tstate->dict = NULL; *************** *** 260,264 **** _PyThreadState_Current = new; ! return old; } --- 261,275 ---- _PyThreadState_Current = new; ! /* It should not be possible for more than one thread state ! to be used for a thread. Check this the best we can in debug ! builds. ! */ ! #if defined(Py_DEBUG) ! if (new) { ! PyThreadState *check = PyGILState_GetThisThreadState(); ! if (check && check != new) ! Py_FatalError("Invalid thread state for this thread"); ! } ! #endif return old; } *************** *** 309,310 **** --- 320,449 ---- return tstate->next; } + + /* Python "auto thread state" API. */ + #ifdef WITH_THREAD + + /* Keep this as a static, as it is not reliable! It can only + ever be compared to the state for the *current* thread. + * If not equal, then it doesn't matter that the actual + value may change immediately after comparison, as it can't + possibly change to the current thread's state. + * If equal, then the current thread holds the lock, so the value can't + change until we yield the lock. + */ + static int + PyThreadState_IsCurrent(PyThreadState *tstate) + { + /* Must be the tstate for this thread */ + assert(PyGILState_GetThisThreadState()==tstate); + /* On Windows at least, simple reads and writes to 32 bit values + are atomic. + */ + return tstate == _PyThreadState_Current; + } + + /* The single PyInterpreterState used by this process' + GILState implementation + */ + static PyInterpreterState *autoInterpreterState = NULL; + static int autoTLSkey = 0; + + /* Internal initialization/finalization functions called by + Py_Initialize/Py_Finalize + */ + void _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) + { + assert(i && t); /* must init with a valid states */ + autoTLSkey = PyThread_create_key(); + autoInterpreterState = i; + /* Now stash the thread state for this thread in TLS */ + PyThread_set_key_value(autoTLSkey, (void *)t); + assert(t->gilstate_counter==0); /* must be a new thread state */ + t->gilstate_counter = 1; + } + + void _PyGILState_Fini(void) + { + PyThread_delete_key(autoTLSkey); + autoTLSkey = 0; + autoInterpreterState = NULL;; + } + + /* The public functions */ + PyThreadState *PyGILState_GetThisThreadState(void) + { + if (autoInterpreterState==NULL || autoTLSkey==0) + return NULL; + return (PyThreadState *) PyThread_get_key_value(autoTLSkey); + } + + PyGILState_STATE PyGILState_Ensure(void) + { + int current; + PyThreadState *tcur; + /* Note that we do not auto-init Python here - apart from + potential races with 2 threads auto-initializing, pep-311 + spells out other issues. Embedders are expected to have + called Py_Initialize() and usually PyEval_InitThreads(). + */ + assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ + tcur = PyThread_get_key_value(autoTLSkey); + if (tcur==NULL) { + /* Create a new thread state for this thread */ + tcur = PyThreadState_New(autoInterpreterState); + if (tcur==NULL) + Py_FatalError("Couldn't create thread-state for new thread"); + PyThread_set_key_value(autoTLSkey, (void *)tcur); + current = 0; /* new thread state is never current */ + } else + current = PyThreadState_IsCurrent(tcur); + if (!current) + PyEval_RestoreThread(tcur); + /* Update our counter in the thread-state - no need for locks: + - tcur will remain valid as we hold the GIL. + - the counter is safe as we are the only thread "allowed" + to modify this value + */ + tcur->gilstate_counter++; + return current ? PyGILState_LOCKED : PyGILState_UNLOCKED; + } + + void PyGILState_Release(PyGILState_STATE oldstate) + { + PyThreadState *tcur = PyThread_get_key_value(autoTLSkey); + if (tcur==NULL) + Py_FatalError("auto-releasing thread-state, " + "but no thread-state for this thread"); + /* We must hold the GIL and have our thread state current */ + /* XXX - remove the check - the assert should be fine, + but while this is very new (April 2003), the extra check + by release-only users can't hurt. + */ + if (!PyThreadState_IsCurrent(tcur)) + Py_FatalError("This thread state must be current when releasing"); + assert (PyThreadState_IsCurrent(tcur)); + tcur->gilstate_counter -= 1; + assert (tcur->gilstate_counter >= 0); /* illegal counter value */ + + /* If we are about to destroy this thread-state, we must + clear it while the lock is held, as destructors may run + */ + if (tcur->gilstate_counter==0) { + /* can't have been locked when we created it */ + assert(oldstate==PyGILState_UNLOCKED); + PyThreadState_Clear(tcur); + } + + /* Release the lock if necessary */ + if (oldstate==PyGILState_UNLOCKED) + PyEval_ReleaseThread(tcur); + + /* Now complete destruction of the thread if necessary */ + if (tcur->gilstate_counter==0) { + /* Delete this thread from our TLS */ + PyThread_delete_key_value(autoTLSkey); + /* Delete the thread-state */ + PyThreadState_Delete(tcur); + } + } + #endif /* WITH_THREAD */ Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.190 retrieving revision 2.191 diff -C2 -d -r2.190 -r2.191 *** pythonrun.c 17 Apr 2003 19:52:29 -0000 2.190 --- pythonrun.c 19 Apr 2003 15:41:52 -0000 2.191 *************** *** 51,54 **** --- 51,59 ---- extern void _PyUnicode_Fini(void); + #ifdef WITH_THREAD + extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); + extern void _PyGILState_Fini(void); + #endif /* WITH_THREAD */ + int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ *************** *** 181,184 **** --- 186,194 ---- initsite(); /* Module site */ + /* auto-thread-state API, if available */ + #ifdef WITH_THREAD + _PyGILState_Init(interp, tstate); + #endif /* WITH_THREAD */ + PyModule_WarningsModule = PyImport_ImportModule("warnings"); *************** *** 244,247 **** --- 254,262 ---- call_sys_exitfunc(); initialized = 0; + + /* Cleanup auto-thread-state */ + #ifdef WITH_THREAD + _PyGILState_Fini(); + #endif /* WITH_THREAD */ /* Get current thread state and interpreter pointer */ Index: thread.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** thread.c 19 Jul 2002 06:55:41 -0000 2.45 --- thread.c 19 Apr 2003 15:41:53 -0000 2.46 *************** *** 138,139 **** --- 138,247 ---- #endif */ + + #ifndef Py_HAVE_NATIVE_TLS + /* If the platform has not supplied a platform specific + TLS implementation, provide our own. + + This code stolen from "thread_sgi.h", where it was the only + implementation of an existing Python TLS API. + */ + /* + * Per-thread data ("key") support. + */ + + struct key { + struct key *next; + long id; + int key; + void *value; + }; + + static struct key *keyhead = NULL; + static int nkeys = 0; + static PyThread_type_lock keymutex = NULL; + + static struct key *find_key(int key, void *value) + { + struct key *p; + long id = PyThread_get_thread_ident(); + for (p = keyhead; p != NULL; p = p->next) { + if (p->id == id && p->key == key) + return p; + } + if (value == NULL) + return NULL; + p = (struct key *)malloc(sizeof(struct key)); + if (p != NULL) { + p->id = id; + p->key = key; + p->value = value; + PyThread_acquire_lock(keymutex, 1); + p->next = keyhead; + keyhead = p; + PyThread_release_lock(keymutex); + } + return p; + } + + int PyThread_create_key(void) + { + if (keymutex == NULL) + keymutex = PyThread_allocate_lock(); + return ++nkeys; + } + + void PyThread_delete_key(int key) + { + struct key *p, **q; + PyThread_acquire_lock(keymutex, 1); + q = &keyhead; + while ((p = *q) != NULL) { + if (p->key == key) { + *q = p->next; + free((void *)p); + /* NB This does *not* free p->value! */ + } + else + q = &p->next; + } + PyThread_release_lock(keymutex); + } + + int PyThread_set_key_value(int key, void *value) + { + struct key *p = find_key(key, value); + if (p == NULL) + return -1; + else + return 0; + } + + void *PyThread_get_key_value(int key) + { + struct key *p = find_key(key, NULL); + if (p == NULL) + return NULL; + else + return p->value; + } + + void PyThread_delete_key_value(int key) + { + long id = PyThread_get_thread_ident(); + struct key *p, **q; + PyThread_acquire_lock(keymutex, 1); + q = &keyhead; + while ((p = *q) != NULL) { + if (p->key == key && p->id == id) { + *q = p->next; + free((void *)p); + /* NB This does *not* free p->value! */ + break; + } + else + q = &p->next; + } + PyThread_release_lock(keymutex); + } + + #endif /* Py_HAVE_NATIVE_TLS */ Index: thread_sgi.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_sgi.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** thread_sgi.h 19 Jan 2002 22:02:55 -0000 2.16 --- thread_sgi.h 19 Apr 2003 15:41:53 -0000 2.17 *************** *** 378,459 **** perror("usunsetlock"); } - - /* - * Per-thread data ("key") support. - */ - - struct key { - struct key *next; - long id; - int key; - void *value; - }; - - static struct key *keyhead = NULL; - static int nkeys = 0; - static PyThread_type_lock keymutex = NULL; - - static struct key *find_key(int key, void *value) - { - struct key *p; - long id = PyThread_get_thread_ident(); - for (p = keyhead; p != NULL; p = p->next) { - if (p->id == id && p->key == key) - return p; - } - if (value == NULL) - return NULL; - p = (struct key *)malloc(sizeof(struct key)); - if (p != NULL) { - p->id = id; - p->key = key; - p->value = value; - PyThread_acquire_lock(keymutex, 1); - p->next = keyhead; - keyhead = p; - PyThread_release_lock(keymutex); - } - return p; - } - - int PyThread_create_key(void) - { - if (keymutex == NULL) - keymutex = PyThread_allocate_lock(); - return ++nkeys; - } - - void PyThread_delete_key(int key) - { - struct key *p, **q; - PyThread_acquire_lock(keymutex, 1); - q = &keyhead; - while ((p = *q) != NULL) { - if (p->key == key) { - *q = p->next; - free((void *)p); - /* NB This does *not* free p->value! */ - } - else - q = &p->next; - } - PyThread_release_lock(keymutex); - } - - int PyThread_set_key_value(int key, void *value) - { - struct key *p = find_key(key, value); - if (p == NULL) - return -1; - else - return 0; - } - - void *PyThread_get_key_value(int key) - { - struct key *p = find_key(key, NULL); - if (p == NULL) - return NULL; - else - return p->value; - } --- 378,379 ---- From mhammond@users.sourceforge.net Sat Apr 19 16:42:19 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sat, 19 Apr 2003 08:42:19 -0700 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.23,2.24 pythread.h,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv30725/Include Modified Files: pystate.h pythread.h Log Message: New PyGILState_ API - implements pep 311, from patch 684256. Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** pystate.h 19 Mar 2003 00:35:35 -0000 2.23 --- pystate.h 19 Apr 2003 15:41:45 -0000 2.24 *************** *** 73,76 **** --- 73,77 ---- int tick_counter; + int gilstate_counter; /* XXX signal handlers should also be here */ *************** *** 104,107 **** --- 105,153 ---- #define PyThreadState_GET() (_PyThreadState_Current) #endif + + typedef + enum {PyGILState_LOCKED, PyGILState_UNLOCKED} + PyGILState_STATE; + + /* Ensure that the current thread is ready to call the Python + C API, regardless of the current state of Python, or of its + thread lock. This may be called as many times as desired + by a thread so long as each call is matched with a call to + PyGILState_Release(). In general, other thread-state APIs may + be used between _Ensure() and _Release() calls, so long as the + thread-state is restored to its previous state before the Release(). + For example, normal use of the Py_BEGIN_ALLOW_THREADS/ + Py_END_ALLOW_THREADS macros are acceptable. + + The return value is an opaque "handle" to the thread state when + PyGILState_Acquire() was called, and must be passed to + PyGILState_Release() to ensure Python is left in the same state. Even + though recursive calls are allowed, these handles can *not* be shared - + each unique call to PyGILState_Ensure must save the handle for its + call to PyGILState_Release. + + When the function returns, the current thread will hold the GIL. + + Failure is a fatal error. + */ + PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); + + /* Release any resources previously acquired. After this call, Python's + state will be the same as it was prior to the corresponding + PyGILState_Acquire call (but generally this state will be unknown to + the caller, hence the use of the GILState API.) + + Every call to PyGILState_Ensure must be matched by a call to + PyGILState_Release on the same thread. + */ + PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); + + /* Helper/diagnostic function - get the current thread state for + this thread. May return NULL if no GILState API has been used + on the current thread. Note the main thread always has such a + thread-state, even if no auto-thread-state call has been made + on the main thread. + */ + PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); /* Routines for advanced debuggers, requested by David Beazley. Index: pythread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythread.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** pythread.h 12 Aug 2002 07:21:57 -0000 2.20 --- pythread.h 19 Apr 2003 15:41:45 -0000 2.21 *************** *** 31,38 **** --- 31,40 ---- #endif + /* Thread Local Storage (TLS) API */ PyAPI_FUNC(int) PyThread_create_key(void); PyAPI_FUNC(void) PyThread_delete_key(int); PyAPI_FUNC(int) PyThread_set_key_value(int, void *); PyAPI_FUNC(void *) PyThread_get_key_value(int); + PyAPI_FUNC(void) PyThread_delete_key_value(int key); #ifdef __cplusplus From mhammond@users.sourceforge.net Sat Apr 19 16:42:19 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sat, 19 Apr 2003 08:42:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_capi.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30725/Lib/test Modified Files: test_capi.py Log Message: New PyGILState_ API - implements pep 311, from patch 684256. Index: test_capi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_capi.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_capi.py 23 Jul 2002 19:03:45 -0000 1.4 --- test_capi.py 19 Apr 2003 15:41:46 -0000 1.5 *************** *** 15,16 **** --- 15,45 ---- except _testcapi.error: raise test_support.TestFailed, sys.exc_info()[1] + + # some extra thread-state tests driven via _testcapi + def TestThreadState(): + import thread + import time + + if test_support.verbose: + print "auto-thread-state" + + idents = [] + + def callback(): + idents.append(thread.get_ident()) + + _testcapi._test_thread_state(callback) + time.sleep(1) + # Check our main thread is in the list exactly 3 times. + if idents.count(thread.get_ident()) != 3: + raise test_support.TestFailed, \ + "Couldn't find main thread correctly in the list" + + try: + _testcapi._test_thread_state + have_thread_state = True + except AttributeError: + have_thread_state = False + + if have_thread_state: + TestThreadState() From mhammond@users.sourceforge.net Sat Apr 19 16:42:20 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sat, 19 Apr 2003 08:42:20 -0700 Subject: [Python-checkins] python/dist/src/Modules _testcapimodule.c,1.21,1.22 posixmodule.c,2.294,2.295 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30725/Modules Modified Files: _testcapimodule.c posixmodule.c Log Message: New PyGILState_ API - implements pep 311, from patch 684256. Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** _testcapimodule.c 17 Apr 2003 18:55:25 -0000 1.21 --- _testcapimodule.c 19 Apr 2003 15:41:47 -0000 1.22 *************** *** 8,11 **** --- 8,15 ---- #include "Python.h" + #ifdef WITH_THREAD + #include "pythread.h" + #endif /* WITH_THREAD */ + static PyObject *TestError; /* set to exception object in init */ *************** *** 536,539 **** --- 540,583 ---- } + #ifdef WITH_THREAD + + void _make_call(void *callable) + { + PyObject *rc; + PyGILState_STATE s = PyGILState_Ensure(); + rc = PyObject_CallFunction(callable, ""); + Py_XDECREF(rc); + PyGILState_Release(s); + } + + static PyObject * + test_thread_state(PyObject *self, PyObject *args) + { + PyObject *fn; + if (!PyArg_ParseTuple(args, "O:test_thread_state", &fn)) + return NULL; + /* Ensure Python is setup for threading */ + PyEval_InitThreads(); + /* Start a new thread for our callback. */ + PyThread_start_new_thread( _make_call, fn); + /* Make the callback with the thread lock held by this thread */ + _make_call(fn); + /* Do it all again, but this time with the thread-lock released */ + Py_BEGIN_ALLOW_THREADS + _make_call(fn); + Py_END_ALLOW_THREADS + /* And once more with and without a thread + XXX - should use a lock and work out exactly what we are trying + to test + */ + Py_BEGIN_ALLOW_THREADS + PyThread_start_new_thread( _make_call, fn); + _make_call(fn); + Py_END_ALLOW_THREADS + Py_INCREF(Py_None); + return Py_None; + } + #endif + static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, *************** *** 554,557 **** --- 598,604 ---- #ifdef Py_USING_UNICODE {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, + #endif + #ifdef WITH_THREAD + {"_test_thread_state", (PyCFunction)test_thread_state, METH_VARARGS}, #endif {NULL, NULL} /* sentinel */ Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.294 retrieving revision 2.295 diff -C2 -d -r2.294 -r2.295 *** posixmodule.c 29 Mar 2003 10:04:54 -0000 2.294 --- posixmodule.c 19 Apr 2003 15:41:47 -0000 2.295 *************** *** 4355,4374 **** * files to be closed in any order - it is always the close() of the * final handle that will return the exit code. */ - /* RED_FLAG 31-Aug-2000 Tim - * This is always called (today!) between a pair of - * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS - * macros. So the thread running this has no valid thread state, as - * far as Python is concerned. However, this calls some Python API - * functions that cannot be called safely without a valid thread - * state, in particular PyDict_GetItem. - * As a temporary hack (although it may last for years ...), we - * *rely* on not having a valid thread state in this function, in - * order to create our own "from scratch". - * This will deadlock if _PyPclose is ever called by a thread - * holding the global lock. - */ - static int _PyPclose(FILE *file) { --- 4355,4363 ---- * files to be closed in any order - it is always the close() of the * final handle that will return the exit code. + * + * NOTE: This function is currently called with the GIL released. + * hence we use the GILState API to manage our state. */ static int _PyPclose(FILE *file) { *************** *** 4379,4384 **** long file_count; #ifdef WITH_THREAD ! PyInterpreterState* pInterpreterState; ! PyThreadState* pThreadState; #endif --- 4368,4372 ---- long file_count; #ifdef WITH_THREAD ! PyGILState_STATE state; #endif *************** *** 4387,4416 **** */ result = fclose(file); - #ifdef WITH_THREAD ! /* Bootstrap a valid thread state into existence. */ ! pInterpreterState = PyInterpreterState_New(); ! if (!pInterpreterState) { ! /* Well, we're hosed now! We don't have a thread ! * state, so can't call a nice error routine, or raise ! * an exception. Just die. ! */ ! Py_FatalError("unable to allocate interpreter state " ! "when closing popen object"); ! return -1; /* unreachable */ ! } ! pThreadState = PyThreadState_New(pInterpreterState); ! if (!pThreadState) { ! Py_FatalError("unable to allocate thread state " ! "when closing popen object"); ! return -1; /* unreachable */ ! } ! /* Grab the global lock. Note that this will deadlock if the ! * current thread already has the lock! (see RED_FLAG comments ! * before this function) ! */ ! PyEval_RestoreThread(pThreadState); #endif - if (_PyPopenProcs) { if ((fileObj = PyLong_FromVoidPtr(file)) != NULL && --- 4375,4381 ---- */ result = fclose(file); #ifdef WITH_THREAD ! state = PyGILState_Ensure(); #endif if (_PyPopenProcs) { if ((fileObj = PyLong_FromVoidPtr(file)) != NULL && *************** *** 4471,4485 **** #ifdef WITH_THREAD ! /* Tear down the thread & interpreter states. ! * Note that interpreter state clear & delete functions automatically ! * call the thread clear & delete functions, and indeed insist on ! * doing that themselves. The lock must be held during the clear, but ! * need not be held during the delete. ! */ ! PyInterpreterState_Clear(pInterpreterState); ! PyEval_ReleaseThread(pThreadState); ! PyInterpreterState_Delete(pInterpreterState); #endif - return result; } --- 4436,4441 ---- #ifdef WITH_THREAD ! PyGILState_Release(state); #endif return result; } From mhammond@users.sourceforge.net Sat Apr 19 16:46:17 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sat, 19 Apr 2003 08:46:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0311.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv32575 Modified Files: pep-0311.txt Log Message: Approved! Index: pep-0311.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0311.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0311.txt 19 Apr 2003 01:11:23 -0000 1.3 --- pep-0311.txt 19 Apr 2003 15:46:15 -0000 1.4 *************** *** 4,8 **** Last-Modified: $Date$ Author: Mark Hammond ! Status: Draft Type: Standards Track Content-Type: text/plain --- 4,8 ---- Last-Modified: $Date$ Author: Mark Hammond ! Status: Approved Type: Standards Track Content-Type: text/plain From gvanrossum@users.sourceforge.net Sat Apr 19 19:05:00 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:05:00 -0700 Subject: [Python-checkins] python/dist/src/Lib nntplib.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12530/Lib Modified Files: nntplib.py Log Message: - Several methods of nntplib.NNTP have grown an optional file argument which specifies a file where to divert the command's output (already supported by the body() method). (SF patch #720468) Thanks to Terry Carroll. Index: nntplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** nntplib.py 27 Feb 2003 20:14:36 -0000 1.35 --- nntplib.py 19 Apr 2003 18:04:57 -0000 1.36 *************** *** 265,269 **** return self.getlongresp(file) ! def newgroups(self, date, time): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date --- 265,269 ---- return self.getlongresp(file) ! def newgroups(self, date, time, file=None): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date *************** *** 273,279 **** - list: list of newsgroup names""" ! return self.longcmd('NEWGROUPS ' + date + ' ' + time) ! def newnews(self, group, date, time): """Process a NEWNEWS command. Arguments: - group: group name or '*' --- 273,279 ---- - list: list of newsgroup names""" ! return self.longcmd('NEWGROUPS ' + date + ' ' + time, file) ! def newnews(self, group, date, time, file=None): """Process a NEWNEWS command. Arguments: - group: group name or '*' *************** *** 285,296 **** cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time ! return self.longcmd(cmd) ! def list(self): """Process a LIST command. Return: - resp: server response if successful - list: list of (group, last, first, flag) (strings)""" ! resp, list = self.longcmd('LIST') for i in range(len(list)): # Parse lines into "group last first flag" --- 285,296 ---- cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time ! return self.longcmd(cmd, file) ! def list(self, file=None): """Process a LIST command. Return: - resp: server response if successful - list: list of (group, last, first, flag) (strings)""" ! resp, list = self.longcmd('LIST', file) for i in range(len(list)): # Parse lines into "group last first flag" *************** *** 324,333 **** return resp, count, first, last, name ! def help(self): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings""" ! return self.longcmd('HELP') def statparse(self, resp): --- 324,333 ---- return resp, count, first, last, name ! def help(self, file=None): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings""" ! return self.longcmd('HELP',file) def statparse(self, resp): *************** *** 415,419 **** return self.shortcmd('SLAVE') ! def xhdr(self, hdr, str): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') --- 415,419 ---- return self.shortcmd('SLAVE') ! def xhdr(self, hdr, str, file=None): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') *************** *** 424,428 **** pat = re.compile('^([0-9]+) ?(.*)\n?') ! resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str) for i in range(len(lines)): line = lines[i] --- 424,428 ---- pat = re.compile('^([0-9]+) ?(.*)\n?') ! resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str, file) for i in range(len(lines)): line = lines[i] *************** *** 432,436 **** return resp, lines ! def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range --- 432,436 ---- return resp, lines ! def xover(self, start, end, file=None): """Process an XOVER command (optional server extension) Arguments: - start: start of range *************** *** 441,445 **** id, references, size, lines)""" ! resp, lines = self.longcmd('XOVER ' + start + '-' + end) xover_lines = [] for line in lines: --- 441,445 ---- id, references, size, lines)""" ! resp, lines = self.longcmd('XOVER ' + start + '-' + end, file) xover_lines = [] for line in lines: *************** *** 458,462 **** return resp,xover_lines ! def xgtitle(self, group): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) --- 458,462 ---- return resp,xover_lines ! def xgtitle(self, group, file=None): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) *************** *** 466,470 **** line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$") ! resp, raw_lines = self.longcmd('XGTITLE ' + group) lines = [] for raw_line in raw_lines: --- 466,470 ---- line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$") ! resp, raw_lines = self.longcmd('XGTITLE ' + group, file) lines = [] for raw_line in raw_lines: From gvanrossum@users.sourceforge.net Sat Apr 19 19:04:59 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:04:59 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.734,1.735 ACKS,1.232,1.233 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv12530/Misc Modified Files: NEWS ACKS Log Message: - Several methods of nntplib.NNTP have grown an optional file argument which specifies a file where to divert the command's output (already supported by the body() method). (SF patch #720468) Thanks to Terry Carroll. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.734 retrieving revision 1.735 diff -C2 -d -r1.734 -r1.735 *** NEWS 18 Apr 2003 21:04:39 -0000 1.734 --- NEWS 19 Apr 2003 18:04:54 -0000 1.735 *************** *** 119,122 **** --- 119,126 ---- ------- + - Several methods of nntplib.NNTP have grown an optional file argument + which specifies a file where to divert the command's output + (already supported by the body() method). (SF patch #720468) + - The self-documenting XML server library DocXMLRPCServer was added. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.232 retrieving revision 1.233 diff -C2 -d -r1.232 -r1.233 *** ACKS 25 Mar 2003 10:20:54 -0000 1.232 --- ACKS 19 Apr 2003 18:04:55 -0000 1.233 *************** *** 87,90 **** --- 87,91 ---- Brett Cannon Mike Carlton + Terry Carroll Luke Kenneth Casson Leighton Donn Cave From gvanrossum@users.sourceforge.net Sat Apr 19 19:05:26 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:05:26 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libnntplib.tex,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12530/Doc/lib Modified Files: libnntplib.tex Log Message: - Several methods of nntplib.NNTP have grown an optional file argument which specifies a file where to divert the command's output (already supported by the body() method). (SF patch #720468) Thanks to Terry Carroll. Index: libnntplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnntplib.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** libnntplib.tex 31 Dec 2002 15:28:44 -0000 1.28 --- libnntplib.tex 19 Apr 2003 18:04:53 -0000 1.29 *************** *** 133,137 **** \end{methoddesc} ! \begin{methoddesc}{newgroups}{date, time} Send a \samp{NEWGROUPS} command. The \var{date} argument should be a string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the --- 133,137 ---- \end{methoddesc} ! \begin{methoddesc}{newgroups}{date, time, \optional{file}} Send a \samp{NEWGROUPS} command. The \var{date} argument should be a string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the *************** *** 140,153 **** \code{(\var{response}, \var{groups})} where \var{groups} is a list of group names that are new since the given date and time. \end{methoddesc} ! \begin{methoddesc}{newnews}{group, date, time} Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or \code{'*'}, and \var{date} and \var{time} have the same meaning as for \method{newgroups()}. Return a pair \code{(\var{response}, \var{articles})} where \var{articles} is a list of article ids. \end{methoddesc} ! \begin{methoddesc}{list}{} Send a \samp{LIST} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of tuples. Each tuple has the --- 140,165 ---- \code{(\var{response}, \var{groups})} where \var{groups} is a list of group names that are new since the given date and time. + If the \var{file} parameter is supplied, then the output of the + \samp{NEWGROUPS} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} ! \begin{methoddesc}{newnews}{group, date, time, \optional{file}} Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or \code{'*'}, and \var{date} and \var{time} have the same meaning as for \method{newgroups()}. Return a pair \code{(\var{response}, \var{articles})} where \var{articles} is a list of article ids. + If the \var{file} parameter is supplied, then the output of the + \samp{NEWNEWS} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} ! \begin{methoddesc}{list}{\optional{file}} Send a \samp{LIST} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of tuples. Each tuple has the *************** *** 158,161 **** --- 170,179 ---- the newsgroup is moderated. (Note the ordering: \var{last}, \var{first}.) + If the \var{file} parameter is supplied, then the output of the + \samp{LIST} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 169,175 **** \end{methoddesc} ! \begin{methoddesc}{help}{} Send a \samp{HELP} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of help strings. \end{methoddesc} --- 187,199 ---- \end{methoddesc} ! \begin{methoddesc}{help}{\optional{file}} Send a \samp{HELP} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of help strings. + If the \var{file} parameter is supplied, then the output of the + \samp{HELP} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 206,210 **** If \var{file} is a file object, then it will start calling \method{write()} on it to store the lines of the body. ! Return as for \method{head()}. If \var{file} is supplied. Then the returned \var{list} is an empty list. \end{methoddesc} --- 230,234 ---- If \var{file} is a file object, then it will start calling \method{write()} on it to store the lines of the body. ! Return as for \method{head()}. If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 219,223 **** \end{methoddesc} ! \begin{methoddesc}{xhdr}{header, string} Send an \samp{XHDR} command. This command is not defined in the RFC but is a common extension. The \var{header} argument is a header --- 243,247 ---- \end{methoddesc} ! \begin{methoddesc}{xhdr}{header, string, \optional{file}} Send an \samp{XHDR} command. This command is not defined in the RFC but is a common extension. The \var{header} argument is a header *************** *** 229,232 **** --- 253,262 ---- (as a string) and \var{text} is the text of the requested header for that article. + If the \var{file} parameter is supplied, then the output of the + \samp{XHDR} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 252,265 **** \end{methoddesc} ! \begin{methoddesc}{xgtitle}{name} Process an \samp{XGTITLE} command, returning a pair \code{(\var{response}, \var{list})}, where \var{list} is a list of tuples containing \code{(\var{name}, \var{title})}. % XXX huh? Should that be name, description? This is an optional NNTP extension, and may not be supported by all servers. \end{methoddesc} ! \begin{methoddesc}{xover}{start, end} Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list of tuples, one for each article in the range delimited by the \var{start} --- 282,301 ---- \end{methoddesc} ! \begin{methoddesc}{xgtitle}{name, \optional{file}} Process an \samp{XGTITLE} command, returning a pair \code{(\var{response}, \var{list})}, where \var{list} is a list of tuples containing \code{(\var{name}, \var{title})}. % XXX huh? Should that be name, description? + If the \var{file} parameter is supplied, then the output of the + \samp{XGTITLE} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. This is an optional NNTP extension, and may not be supported by all servers. \end{methoddesc} ! \begin{methoddesc}{xover}{start, end, \optional{file}} Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list of tuples, one for each article in the range delimited by the \var{start} *************** *** 267,270 **** --- 303,312 ---- \code{(\var{article number}, \var{subject}, \var{poster}, \var{date}, \var{id}, \var{references}, \var{size}, \var{lines})}. + If the \var{file} parameter is supplied, then the output of the + \samp{XOVER} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. This is an optional NNTP extension, and may not be supported by all servers. From gvanrossum@users.sourceforge.net Sat Apr 19 19:15:12 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:15:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.48,1.49 test_bool.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15651/Lib/test Modified Files: test_types.py test_bool.py Log Message: - bool() called without arguments now returns False rather than raising an exception. This is consistent with calling the constructors for the other builtin types -- called without argument they all return the false value of that type. (SF patch #724135) Thanks to Alex Martelli. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_types.py 14 Apr 2003 20:58:03 -0000 1.48 --- test_types.py 19 Apr 2003 18:15:07 -0000 1.49 *************** *** 87,90 **** --- 87,94 ---- if -1 != -1L or -1 != -1.0 or -1L != -1.0: raise TestFailed, 'int/long/float value not equal' + # calling built-in types without argument must return 0 + if int() != 0: raise TestFailed, 'int() does not return 0' + if long() != 0L: raise TestFailed, 'long() does not return 0L' + if float() != 0.0: raise TestFailed, 'float() does not return 0.0' if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass else: raise TestFailed, 'int() does not round properly' *************** *** 215,218 **** --- 219,224 ---- print '6.5.2 Tuples' + # calling built-in types without argument must return empty + if tuple() != (): raise TestFailed,'tuple() does not return ()' if len(()) != 0: raise TestFailed, 'len(())' if len((1,)) != 1: raise TestFailed, 'len((1,))' *************** *** 252,255 **** --- 258,263 ---- print '6.5.3 Lists' + # calling built-in types without argument must return empty + if list() != []: raise TestFailed,'list() does not return []' if len([]) != 0: raise TestFailed, 'len([])' if len([1,]) != 1: raise TestFailed, 'len([1,])' *************** *** 442,445 **** --- 450,455 ---- print '6.6 Mappings == Dictionaries' + # calling built-in types without argument must return empty + if dict() != {}: raise TestFailed,'dict() does not return {}' d = {} if d.keys() != []: raise TestFailed, '{}.keys()' Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_bool.py 23 Jul 2002 19:03:45 -0000 1.7 --- test_bool.py 19 Apr 2003 18:15:09 -0000 1.8 *************** *** 138,141 **** --- 138,142 ---- veris(bool("hello"), True) veris(bool(""), False) + veris(bool(), False) veris(hasattr([], "append"), True) From gvanrossum@users.sourceforge.net Sat Apr 19 19:15:13 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:15:13 -0700 Subject: [Python-checkins] python/dist/src/Objects boolobject.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv15651/Objects Modified Files: boolobject.c Log Message: - bool() called without arguments now returns False rather than raising an exception. This is consistent with calling the constructors for the other builtin types -- called without argument they all return the false value of that type. (SF patch #724135) Thanks to Alex Martelli. Index: boolobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/boolobject.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** boolobject.c 6 Aug 2002 22:12:52 -0000 1.5 --- boolobject.c 19 Apr 2003 18:15:10 -0000 1.6 *************** *** 52,59 **** { static char *kwlist[] = {"x", 0}; ! PyObject *x; long ok; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:bool", kwlist, &x)) return NULL; ok = PyObject_IsTrue(x); --- 52,59 ---- { static char *kwlist[] = {"x", 0}; ! PyObject *x = Py_False; long ok; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:bool", kwlist, &x)) return NULL; ok = PyObject_IsTrue(x); From gvanrossum@users.sourceforge.net Sat Apr 19 19:15:39 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:15:39 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.735,1.736 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv15651/Misc Modified Files: NEWS Log Message: - bool() called without arguments now returns False rather than raising an exception. This is consistent with calling the constructors for the other builtin types -- called without argument they all return the false value of that type. (SF patch #724135) Thanks to Alex Martelli. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.735 retrieving revision 1.736 diff -C2 -d -r1.735 -r1.736 *** NEWS 19 Apr 2003 18:04:54 -0000 1.735 --- NEWS 19 Apr 2003 18:15:04 -0000 1.736 *************** *** 13,16 **** --- 13,21 ---- ----------------- + - bool() called without arguments now returns False rather than + raising an exception. This is consistent with calling the + constructors for the other builtin types -- called without argument + they all return the false value of that type. (SF patch #724135) + - In support of PEP 269 (making the pgen parser generator accessible from Python), some changes to the pgen code structure were made; a From tim_one@users.sourceforge.net Sat Apr 19 19:21:07 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:21:07 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts combinerefs.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv17713/Tools/scripts Modified Files: combinerefs.py Log Message: Docstring clarifications. Index: combinerefs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/combinerefs.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** combinerefs.py 18 Apr 2003 19:51:10 -0000 1.3 --- combinerefs.py 19 Apr 2003 18:21:04 -0000 1.4 *************** *** 11,15 **** After cleaning up everything it can, it prints all remaining live objects again, but the second time just prints their addresses, refcounts, and type ! names. Save all this output into a file, then run this script passing the path to --- 11,16 ---- After cleaning up everything it can, it prints all remaining live objects again, but the second time just prints their addresses, refcounts, and type ! names (because the interpreter has been torn down, calling repr methods at ! this point can get into infinite loops or blow up). Save all this output into a file, then run this script passing the path to *************** *** 37,40 **** --- 38,47 ---- repr is repr(object), extracted from the first PYTHONDUMPREFS output block. + CAUTION: If object is a container type, it may not actually contain all the + objects shown in the repr: the repr was captured from the first output block, + and some of the containees may have been released since then. For example, + it's common for the line showing the dict of interned strings to display + strings that no longer exist at the end of Py_Finalize; this can be recognized + (albeit painfully) because such containees don't have a line of their own. The objects are listed in allocation order, with most-recently allocated *************** *** 58,67 **** 00858028 [1025->1456] str '' ! The string '', which is used in dictobject.c as the name of the ! dummy key that overwrites a real key that gets deleted, actually grew ! several hundred references during cleanup. It suggests that stuff did get ! removed from dicts by cleanup, but that the dicts themselves are staying ! alive for some reason. ! """ import re --- 65,72 ---- 00858028 [1025->1456] str '' ! The string '', which is used in dictobject.c to overwrite a real ! key that gets deleted, grew several hundred references during cleanup. It ! suggests that stuff did get removed from dicts by cleanup, but that the dicts ! themselves are staying alive for some reason. """ import re From tim_one@users.sourceforge.net Sat Apr 19 19:47:04 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 19 Apr 2003 11:47:04 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.191,2.192 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24688/python/Python Modified Files: pythonrun.c Log Message: handle_system_exit(): This leaked the current exception info, in particular leaving the traceback object (and everything reachable from it) alive throughout shutdown. The patch is mostly from Guido. Bugfix candidate. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.191 retrieving revision 2.192 diff -C2 -d -r2.191 -r2.192 *** pythonrun.c 19 Apr 2003 15:41:52 -0000 2.191 --- pythonrun.c 19 Apr 2003 18:47:02 -0000 2.192 *************** *** 915,918 **** --- 915,920 ---- { PyObject *exception, *value, *tb; + int exitcode = 0; + PyErr_Fetch(&exception, &value, &tb); if (Py_FlushLine()) *************** *** 920,924 **** fflush(stdout); if (value == NULL || value == Py_None) ! Py_Exit(0); if (PyInstance_Check(value)) { /* The error code should be in the `code' attribute. */ --- 922,926 ---- fflush(stdout); if (value == NULL || value == Py_None) ! goto done; if (PyInstance_Check(value)) { /* The error code should be in the `code' attribute. */ *************** *** 928,932 **** value = code; if (value == Py_None) ! Py_Exit(0); } /* If we failed to dig out the 'code' attribute, --- 930,934 ---- value = code; if (value == Py_None) ! goto done; } /* If we failed to dig out the 'code' attribute, *************** *** 934,943 **** } if (PyInt_Check(value)) ! Py_Exit((int)PyInt_AsLong(value)); else { PyObject_Print(value, stderr, Py_PRINT_RAW); PySys_WriteStderr("\n"); ! Py_Exit(1); } } --- 936,955 ---- } if (PyInt_Check(value)) ! exitcode = (int)PyInt_AsLong(value); else { PyObject_Print(value, stderr, Py_PRINT_RAW); PySys_WriteStderr("\n"); ! exitcode = 1; } + done: + /* Restore and clear the exception info, in order to properly decref + * the exception, value, and traceback. If we just exit instead, + * these leak, which confuses PYTHONDUMPREFS output, and may prevent + * some finalizers from running. + */ + PyErr_Restore(exception, value, tb); + PyErr_Clear(); + Py_Exit(exitcode); + /* NOTREACHED */ } From loewis@users.sourceforge.net Sat Apr 19 21:59:05 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 13:59:05 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.736,1.737 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv7812/Misc Modified Files: NEWS Log Message: Patch #553171: Add writeback parameter. Also add protocol parameter. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.736 retrieving revision 1.737 diff -C2 -d -r1.736 -r1.737 *** NEWS 19 Apr 2003 18:15:04 -0000 1.736 --- NEWS 19 Apr 2003 20:59:03 -0000 1.737 *************** *** 124,127 **** --- 124,130 ---- ------- + - shelve now supports the optional writeback argument, and exposes + pickle protocol versions. + - Several methods of nntplib.NNTP have grown an optional file argument which specifies a file where to divert the command's output From loewis@users.sourceforge.net Sat Apr 19 21:59:05 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 13:59:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_shelve.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7812/Lib/test Modified Files: test_shelve.py Log Message: Patch #553171: Add writeback parameter. Also add protocol parameter. Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_shelve.py 9 Mar 2003 07:05:14 -0000 1.3 --- test_shelve.py 19 Apr 2003 20:59:02 -0000 1.4 *************** *** 29,32 **** --- 29,42 ---- os.unlink(f) + def test_proto2_file_shelf(self): + try: + s = shelve.open(self.fn, protocol=2) + s['key1'] = (1,2,3,4) + self.assertEqual(s['key1'], (1,2,3,4)) + s.close() + finally: + for f in glob.glob(self.fn+"*"): + os.unlink(f) + def test_in_memory_shelf(self): d1 = {} *************** *** 44,47 **** --- 54,78 ---- self.assertNotEqual(d1, d2) + def test_mutable_entry(self): + d1 = {} + s = shelve.Shelf(d1, protocol=2, writeback=False) + s['key1'] = [1,2,3,4] + self.assertEqual(s['key1'], [1,2,3,4]) + s['key1'].append(5) + self.assertEqual(s['key1'], [1,2,3,4]) + s.close() + + d2 = {} + s = shelve.Shelf(d2, protocol=2, writeback=True) + s['key1'] = [1,2,3,4] + self.assertEqual(s['key1'], [1,2,3,4]) + s['key1'].append(5) + self.assertEqual(s['key1'], [1,2,3,4,5]) + s.close() + + self.assertEqual(len(d1), 1) + self.assertEqual(len(d2), 1) + + from test_userdict import TestMappingProtocol *************** *** 57,64 **** def _empty_mapping(self): if self._in_mem: ! x= shelve.Shelf({}, binary = self._binary) else: self.counter+=1 ! x= shelve.open(self.fn+str(self.counter), binary=self._binary) self._db.append(x) return x --- 88,95 ---- def _empty_mapping(self): if self._in_mem: ! x= shelve.Shelf({}, **self._args) else: self.counter+=1 ! x= shelve.open(self.fn+str(self.counter), **self._args) self._db.append(x) return x *************** *** 72,85 **** class TestAsciiFileShelve(TestShelveBase): ! _binary = False _in_mem = False class TestBinaryFileShelve(TestShelveBase): ! _binary = True _in_mem = False class TestAsciiMemShelve(TestShelveBase): ! _binary = False _in_mem = True class TestBinaryMemShelve(TestShelveBase): ! _binary = True _in_mem = True --- 103,122 ---- class TestAsciiFileShelve(TestShelveBase): ! _args={'binary':False} _in_mem = False class TestBinaryFileShelve(TestShelveBase): ! _args={'binary':True} ! _in_mem = False ! class TestProto2FileShelve(TestShelveBase): ! _args={'protocol':2} _in_mem = False class TestAsciiMemShelve(TestShelveBase): ! _args={'binary':False} _in_mem = True class TestBinaryMemShelve(TestShelveBase): ! _args={'binary':True} ! _in_mem = True ! class TestProto2MemShelve(TestShelveBase): ! _args={'protocol':2} _in_mem = True *************** *** 88,93 **** --- 125,132 ---- suite.addTest(unittest.makeSuite(TestAsciiFileShelve)) suite.addTest(unittest.makeSuite(TestBinaryFileShelve)) + suite.addTest(unittest.makeSuite(TestProto2FileShelve)) suite.addTest(unittest.makeSuite(TestAsciiMemShelve)) suite.addTest(unittest.makeSuite(TestBinaryMemShelve)) + suite.addTest(unittest.makeSuite(TestProto2MemShelve)) suite.addTest(unittest.makeSuite(TestCase)) test_support.run_suite(suite) From loewis@users.sourceforge.net Sat Apr 19 21:59:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 13:59:04 -0700 Subject: [Python-checkins] python/dist/src/Lib shelve.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7812/Lib Modified Files: shelve.py Log Message: Patch #553171: Add writeback parameter. Also add protocol parameter. Index: shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shelve.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shelve.py 21 Jan 2003 01:53:09 -0000 1.20 --- shelve.py 19 Apr 2003 20:59:02 -0000 1.21 *************** *** 16,21 **** d[key] = data # store data at key (overwrites old data if # using an existing key) ! data = d[key] # retrieve data at key (raise KeyError if no ! # such key) del d[key] # delete data stored at key (raises KeyError # if no such key) --- 16,22 ---- d[key] = data # store data at key (overwrites old data if # using an existing key) ! data = d[key] # retrieve a COPY of the data at key (raise ! # KeyError if no such key) -- NOTE that this ! # access returns a *copy* of the entry! del d[key] # delete data stored at key (raises KeyError # if no such key) *************** *** 27,30 **** --- 28,58 ---- Dependent on the implementation, closing a persistent dictionary may or may not be necessary to flush changes to disk. + + Normally, d[key] returns a COPY of the entry. This needs care when + mutable entries are mutated: for example, if d[key] is a list, + d[key].append(anitem) + does NOT modify the entry d[key] itself, as stored in the persistent + mapping -- it only modifies the copy, which is then immediately + discarded, so that the append has NO effect whatsoever. To append an + item to d[key] in a way that will affect the persistent mapping, use: + data = d[key] + data.append(anitem) + d[key] = data + + To avoid the problem with mutable entries, you may pass the keyword + argument writeback=True in the call to shelve.open. When you use: + d = shelve.open(filename, writeback=True) + then d keeps a cache of all entries you access, and writes them all back + to the persistent mapping when you call d.close(). This ensures that + such usage as d[key].append(anitem) works as intended. + + However, using keyword argument writeback=True may consume vast amount + of memory for the cache, and it may make d.close() very slow, if you + access many of d's entries after opening it in this way: d has no way to + check which of the entries you access are mutable and/or which ones you + actually mutate, so it must cache, and write back at close, all of the + entries that you access. You can call d.sync() to write back all the + entries in the cache, and empty the cache (d.sync() also synchronizes + the persistent dictionary on disk, if feasible). """ *************** *** 42,45 **** --- 70,74 ---- import UserDict + import warnings __all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"] *************** *** 52,58 **** """ ! def __init__(self, dict, binary=False): self.dict = dict ! self._binary = binary def keys(self): --- 81,97 ---- """ ! def __init__(self, dict, protocol=None, writeback=False, binary=None): self.dict = dict ! if protocol is not None and binary is not None: ! raise ValueError, "can't specify both 'protocol' and 'binary'" ! if binary is not None: ! warnings.warn("The 'binary' argument to Shelf() is deprecated", ! PendingDeprecationWarning) ! protocol = int(binary) ! if protocol is None: ! protocol = 0 ! self._protocol = protocol ! self.writeback = writeback ! self.cache = {} def keys(self): *************** *** 74,83 **** def __getitem__(self, key): ! f = StringIO(self.dict[key]) ! return Unpickler(f).load() def __setitem__(self, key, value): f = StringIO() ! p = Pickler(f, self._binary) p.dump(value) self.dict[key] = f.getvalue() --- 113,130 ---- def __getitem__(self, key): ! try: ! value = self.cache[key] ! except KeyError: ! f = StringIO(self.dict[key]) ! value = Unpickler(f).load() ! if self.writeback: ! self.cache[key] = value ! return value def __setitem__(self, key, value): + if self.writeback: + self.cache[key] = value f = StringIO() ! p = Pickler(f, self._protocol) p.dump(value) self.dict[key] = f.getvalue() *************** *** 85,90 **** --- 132,142 ---- def __delitem__(self, key): del self.dict[key] + try: + del self.cache[key] + except KeyError: + pass def close(self): + self.sync() try: self.dict.close() *************** *** 97,100 **** --- 149,158 ---- def sync(self): + if self.writeback and self.cache: + self.writeback = False + for key, entry in self.cache.iteritems(): + self[key] = entry + self.writeback = True + self.cache = {} if hasattr(self.dict, 'sync'): self.dict.sync() *************** *** 114,119 **** """ ! def __init__(self, dict, binary=False): ! Shelf.__init__(self, dict, binary) def set_location(self, key): --- 172,177 ---- """ ! def __init__(self, dict, protocol=None, writeback=False, binary=None): ! Shelf.__init__(self, dict, protocol, writeback, binary) def set_location(self, key): *************** *** 150,170 **** """ ! def __init__(self, filename, flag='c', binary=False): import anydbm ! Shelf.__init__(self, anydbm.open(filename, flag), binary) ! def open(filename, flag='c', binary=False): """Open a persistent dictionary for reading and writing. ! The filename parameter is the base filename for the underlying database. ! As a side-effect, an extension may be added to the filename and more ! than one file may be created. The optional flag parameter has the ! same interpretation as the flag parameter of anydbm.open(). The ! optional binary parameter may be set to True to force the use of binary ! pickles for serializing data values. See the module's __doc__ string for an overview of the interface. """ ! return DbfilenameShelf(filename, flag, binary) --- 208,231 ---- """ ! def __init__(self, filename, flag='c', protocol=None, writeback=False, binary=None): import anydbm ! Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback, binary) ! def open(filename, flag='c', protocol=None, writeback=False, binary=None): """Open a persistent dictionary for reading and writing. ! The filename parameter is the base filename for the underlying ! database. As a side-effect, an extension may be added to the ! filename and more than one file may be created. The optional flag ! parameter has the same interpretation as the flag parameter of ! anydbm.open(). The optional protocol parameter specifies the ! version of the pickle protocol (0, 1, or 2). ! ! The optional binary parameter is deprecated and may be set to True ! to force the use of binary pickles for serializing data values. See the module's __doc__ string for an overview of the interface. """ ! return DbfilenameShelf(filename, flag, binary, writeback) From loewis@users.sourceforge.net Sat Apr 19 21:59:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 19 Apr 2003 13:59:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libshelve.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7812/Doc/lib Modified Files: libshelve.tex Log Message: Patch #553171: Add writeback parameter. Also add protocol parameter. Index: libshelve.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshelve.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** libshelve.tex 21 Jan 2003 01:52:39 -0000 1.19 --- libshelve.tex 19 Apr 2003 20:59:02 -0000 1.20 *************** *** 14,18 **** \refstmodindex{pickle} ! \begin{funcdesc}{open}{filename\optional{,flag='c'\optional{,binary=\code{False}}}} Open a persistent dictionary. The filename specified is the base filename for the underlying database. As a side-effect, an extension may be added to --- 14,18 ---- \refstmodindex{pickle} ! \begin{funcdesc}{open}{filename\optional{,flag='c'\optional{,protocol=\code{None}\optional{,writeback=\code{False}\optional{,binary=\code{None}}}}}} Open a persistent dictionary. The filename specified is the base filename for the underlying database. As a side-effect, an extension may be added to *************** *** 20,26 **** underlying database file is opened for reading and writing. The optional {}\var{flag} pararameter has the same interpretation as the \var{flag} ! parameter of \function{anydbm.open}. By default, ASCII pickles are used to ! serialize values. If the optional \var{binary} parameter is set to ! {}\var{True}, binary pickles will be used instead. \end{funcdesc} --- 20,41 ---- underlying database file is opened for reading and writing. The optional {}\var{flag} pararameter has the same interpretation as the \var{flag} ! parameter of \function{anydbm.open}. ! ! By default, version 0 pickles are used to serialize values. ! The version of the pickle protocol can be specified with the ! \var{protocol} parameter. \versionchanged[The \var{protocol} ! parameter was added. The \var{binary} parameter is deprecated ! and provided for backwards compatibility only]{2.3} ! ! By default, mutations to persistent-dictionary mutable entries are not ! automatically written back. If the optional \var{writeback} parameter ! is set to {}\var{True}, all entries accessed are cached in memory, and ! written back at close time; this can make it handier to mutate mutable ! entries in the persistent dictionary, but, if many entries are ! accessed, it can consume vast amounts of memory for the cache, and it ! can make the close operation very slow since all accessed entries are ! written back (there is no way to determine which accessed entries are ! mutable, nor which ones were actually mutated). ! \end{funcdesc} *************** *** 62,92 **** \end{itemize} ! \begin{classdesc}{Shelf}{dict\optional{, binary=False}} A subclass of \class{UserDict.DictMixin} which stores pickled values in the ! \var{dict} object. If the \var{binary} parameter is \code{True}, binary ! pickles will be used. This can provide much more compact storage than plain ! text pickles, depending on the nature of the objects stored in the database. \end{classdesc} ! \begin{classdesc}{BsdDbShelf}{dict\optional{, binary=False}} ! A subclass of \class{Shelf} which exposes \method{first}, \method{next}, ! \method{previous}, \method{last} and \method{set_location} which are ! available in the \module{bsddb} module but not in other database modules. ! The \var{dict} object passed to the constructor must support those methods. ! This is generally accomplished by calling one of \function{bsddb.hashopen}, \function{bsddb.btopen} or \function{bsddb.rnopen}. The optional ! \var{binary} parameter has the same interpretation as for the \class{Shelf} ! class. \end{classdesc} ! \begin{classdesc}{DbfilenameShelf}{filename\optional{, flag='c'\optional{, binary=False}}} ! A subclass of \class{Shelf} which accepts a \var{filename} instead of a ! dict-like object. The underlying file will be opened using ! {}\function{anydbm.open}. By default, the file will be created and opened ! for both read and write. The optional \var{flag} parameter has the same ! interpretation as for the \function{open} function. The optional ! \var{binary} parameter has the same interpretation as for the ! {}\class{Shelf} class. \end{classdesc} --- 77,121 ---- \end{itemize} ! \begin{classdesc}{Shelf}{dict\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}} A subclass of \class{UserDict.DictMixin} which stores pickled values in the ! \var{dict} object. ! ! By default, version 0 pickles are used to serialize values. The ! version of the pickle protocol can be specified with the ! \var{protocol} parameter. See the \module{pickle} documentation for a ! discussion of the pickle protocols. \versionchanged[The \var{protocol} ! parameter was added. The \var{binary} parameter is deprecated and ! provided for backwards compatibility only]{2.3} ! ! If the \var{writeback} parameter is \code{True}, the object will hold a ! cache of all entries accessed and write them back to the \var{dict} at ! sync and close times. This allows natural operations on mutable entries, ! but can consume much more memory and make sync and close take a long time. \end{classdesc} ! \begin{classdesc}{BsdDbShelf}{dict\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}} ! ! A subclass of \class{Shelf} which exposes \method{first}, ! \method{next}, \method{previous}, \method{last} and ! \method{set_location} which are available in the \module{bsddb} module ! but not in other database modules. The \var{dict} object passed to ! the constructor must support those methods. This is generally ! accomplished by calling one of \function{bsddb.hashopen}, \function{bsddb.btopen} or \function{bsddb.rnopen}. The optional ! \var{protocol}, \var{writeback}, and \var{binary} parameters have the ! same interpretation as for the \class{Shelf} class. ! \end{classdesc} ! \begin{classdesc}{DbfilenameShelf}{filename\optional{, flag='c'\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}}} ! A subclass of \class{Shelf} which accepts a \var{filename} instead of ! a dict-like object. The underlying file will be opened using ! {}\function{anydbm.open}. By default, the file will be created and ! opened for both read and write. The optional \var{flag} parameter has ! the same interpretation as for the \function{open} function. The ! optional \var{protocol}, \var{writeback}, and \var{binary} parameters ! have the same interpretation as for the \class{Shelf} class. ! \end{classdesc} *************** *** 104,108 **** d[key] = data # store data at key (overwrites old data if # using an existing key) ! data = d[key] # retrieve data at key (raise KeyError if no # such key) del d[key] # delete data stored at key (raises KeyError --- 133,137 ---- d[key] = data # store data at key (overwrites old data if # using an existing key) ! data = d[key] # retrieve a COPY of data at key (raise KeyError if no # such key) del d[key] # delete data stored at key (raises KeyError *************** *** 110,113 **** --- 139,153 ---- flag = d.has_key(key) # true if the key exists list = d.keys() # a list of all existing keys (slow!) + + # as d was opened WITHOUT writeback=True, beware: + d['xx'] = range(4) # this works as expected, but... + d['xx'].append(5) # *this doesn't!* -- d['xx'] is STILL range(4)!!! + # having opened d without writeback=True, you need to code carefully: + temp = d['xx'] # extracts the copy + temp.append(5) # mutates the copy + d['xx'] = temp # stores the copy right back, to persist it + # or, d=shelve.open(filename,writeback=True) would let you just code + # d['xx'].append(5) and have it work as expected, BUT it would also + # consume more memory and make the d.close() operation slower. d.close() # close it From niemeyer@users.sourceforge.net Sun Apr 20 01:45:15 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 19 Apr 2003 17:45:15 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.89,2.90 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18693/Modules Modified Files: _sre.c Log Message: - Fixed bug #672491. This change restores the behavior of lastindex/lastgroup to be compliant with previous python versions, by backing out the changes made in revision 2.84 which affected this. The bugfix for backtracking is still maintained. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -d -r2.89 -r2.90 *** _sre.c 19 Apr 2003 12:56:07 -0000 2.89 --- _sre.c 20 Apr 2003 00:45:13 -0000 2.90 *************** *** 880,888 **** TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0])); i = pattern[0]; ! if (i > state->lastmark) { state->lastmark = i; - if (i & 1) - state->lastindex = i/2 + 1; - } state->mark[i] = ptr; pattern++; --- 880,887 ---- TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0])); i = pattern[0]; ! if (i & 1) ! state->lastindex = i/2 + 1; ! if (i > state->lastmark) state->lastmark = i; state->mark[i] = ptr; pattern++; *************** *** 1140,1146 **** return i; i = mark_restore(state, 0, lastmark); if (i < 0) return i; - lastmark_restore(state, lastmark); rp->count = count - 1; state->ptr = ptr; --- 1139,1145 ---- return i; i = mark_restore(state, 0, lastmark); + state->lastmark = lastmark; if (i < 0) return i; rp->count = count - 1; state->ptr = ptr; From bwarsaw@users.sourceforge.net Sun Apr 20 01:59:26 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 19 Apr 2003 17:59:26 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts logmerge.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv23353 Modified Files: logmerge.py Log Message: Finally added a -h option to print the module docstring and exit. ;) Index: logmerge.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/logmerge.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** logmerge.py 7 Jan 2003 16:46:24 -0000 1.10 --- logmerge.py 20 Apr 2003 00:59:24 -0000 1.11 *************** *** 29,35 **** not very useful.) XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 from their output. - """ --- 29,36 ---- not very useful.) + -h prints this message and exits. + XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 from their output. """ *************** *** 44,48 **** reverse = 0 branch = None ! opts, args = getopt.getopt(sys.argv[1:], "trb:") for o, a in opts: if o == '-t': --- 45,49 ---- reverse = 0 branch = None ! opts, args = getopt.getopt(sys.argv[1:], "trb:h") for o, a in opts: if o == '-t': *************** *** 52,55 **** --- 53,59 ---- elif o == '-b': branch = a + elif o == '-h': + print __doc__ + sys.exit(0) database = [] while 1: From niemeyer@users.sourceforge.net Sun Apr 20 02:49:02 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 19 Apr 2003 18:49:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.96,1.97 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2974/lib Modified Files: libre.tex Log Message: - Included examples documenting how the lastindex member of match objects work. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** libre.tex 4 Mar 2003 14:17:05 -0000 1.96 --- libre.tex 20 Apr 2003 01:48:59 -0000 1.97 *************** *** 824,835 **** \end{memberdesc} \begin{memberdesc}[MatchObject]{lastgroup} The name of the last matched capturing group, or \code{None} if the group didn't have a name, or if no group was matched at all. - \end{memberdesc} - - \begin{memberdesc}[MatchObject]{lastindex} - The integer index of the last matched capturing group, or \code{None} - if no group was matched at all. \end{memberdesc} --- 824,839 ---- \end{memberdesc} + \begin{memberdesc}[MatchObject]{lastindex} + The integer index of the last matched capturing group, or \code{None} + if no group was matched at all. For example, the expressions + \regexp{(a)b}, \regexp{((a)(b))}, and \regexp{((ab))} will have + \code{lastindex == 1} if applyied to the string \code{'ab'}, + while the expression \regexp{(a)(b)} will have \code{lastindex == 2}, + if applyied to the same string. + \end{memberdesc} + \begin{memberdesc}[MatchObject]{lastgroup} The name of the last matched capturing group, or \code{None} if the group didn't have a name, or if no group was matched at all. \end{memberdesc} From niemeyer@users.sourceforge.net Sun Apr 20 02:57:06 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 19 Apr 2003 18:57:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4707/Doc/lib Modified Files: libshlex.tex Log Message: - Changed shlex.split() method to have more useful and meaningful parameters. Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libshlex.tex 17 Apr 2003 23:09:04 -0000 1.15 --- libshlex.tex 20 Apr 2003 01:57:03 -0000 1.16 *************** *** 26,35 **** The \module{shlex} module defines the following functions: ! \begin{funcdesc}{split}{s\optional{, posix=\code{True}\optional{, ! spaces=\code{True}}}} ! Split the string \var{s} using shell-like syntax. If \var{posix} is ! \code{True}, operate in \POSIX{} mode. If \var{spaces} is \code{True}, it ! will only split words in whitespaces (setting the ! \member{whitespace_split} member of the \class{shlex} instance). \versionadded{2.3} \end{funcdesc} --- 26,34 ---- The \module{shlex} module defines the following functions: ! \begin{funcdesc}{split}{s\optional{, comments=\code{False}}} ! Split the string \var{s} using shell-like syntax. If \var{comments} is ! \code{False}, the parsing of comments in the given string will be ! disabled (setting the \member{commenters} member of the \class{shlex} ! instance to the empty string). This function operates in \POSIX{} mode. \versionadded{2.3} \end{funcdesc} From niemeyer@users.sourceforge.net Sun Apr 20 02:57:05 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 19 Apr 2003 18:57:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_shlex.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4707/Lib/test Modified Files: test_shlex.py Log Message: - Changed shlex.split() method to have more useful and meaningful parameters. Index: test_shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shlex.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_shlex.py 17 Apr 2003 23:04:22 -0000 1.2 --- test_shlex.py 20 Apr 2003 01:57:03 -0000 1.3 *************** *** 152,158 **** item[0] = item[0].replace(r"\n", "\n") ! def splitTest(self, data, posix, spaces): for i in range(len(data)): ! l = shlex.split(data[i][0], posix=posix, spaces=spaces) self.assertEqual(l, data[i][1:], "%s: %s != %s" % --- 152,158 ---- item[0] = item[0].replace(r"\n", "\n") ! def splitTest(self, data, comments): for i in range(len(data)): ! l = shlex.split(data[i][0], comments=comments) self.assertEqual(l, data[i][1:], "%s: %s != %s" % *************** *** 168,178 **** return ret - def testSplit(self): - """Test data splitting with non-posix parser""" - self.splitTest(self.data, posix=0, spaces=0) - def testSplitPosix(self): """Test data splitting with posix parser""" ! self.splitTest(self.posix_data, posix=1, spaces=1) def testCompat(self): --- 168,174 ---- return ret def testSplitPosix(self): """Test data splitting with posix parser""" ! self.splitTest(self.posix_data, comments=True) def testCompat(self): From niemeyer@users.sourceforge.net Sun Apr 20 02:57:05 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 19 Apr 2003 18:57:05 -0700 Subject: [Python-checkins] python/dist/src/Lib shlex.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4707/Lib Modified Files: shlex.py Log Message: - Changed shlex.split() method to have more useful and meaningful parameters. Index: shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shlex.py 17 Apr 2003 23:09:08 -0000 1.20 --- shlex.py 20 Apr 2003 01:57:02 -0000 1.21 *************** *** 272,278 **** return token ! def split(s, posix=True, spaces=True): ! lex = shlex(s, posix=posix) ! lex.whitespace_split = spaces return list(lex) --- 272,280 ---- return token ! def split(s, comments=False): ! lex = shlex(s, posix=True) ! lex.whitespace_split = True ! if not comments: ! lex.commenters = '' return list(lex) From niemeyer@users.sourceforge.net Sun Apr 20 08:35:46 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 20 Apr 2003 00:35:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test re_tests.py,1.34,1.35 test_sre.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16123/Lib/test Modified Files: re_tests.py test_sre.py Log Message: More work on bug #672491 and patch #712900. I've applied a modified version of Greg Chapman's patch. I've included the fixes without introducing the reorganization mentioned, for the sake of stability. Also, the second fix mentioned in the patch don't fix the mentioned problem anymore, because of the change introduced by patch #720991 (by Greg as well). The new fix wasn't complicated though, and is included as well. As a note. It seems that there are other places that require the "protection" of LASTMARK_SAVE()/LASTMARK_RESTORE(), and are just waiting for someone to find how to break them. Particularly, I belive that every recursion of SRE_MATCH() should be protected by these macros. I won't do that right now since I'm not completely sure about this, and we don't have much time for testing until the next release. Index: re_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/re_tests.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** re_tests.py 24 Feb 2003 01:18:35 -0000 1.34 --- re_tests.py 20 Apr 2003 07:35:44 -0000 1.35 *************** *** 656,659 **** --- 656,663 ---- # bug 470582: nested groups problem (r'^((a)c)?(ab)$', 'ab', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-ab'), + # another minimizing repeat problem (capturing groups in assertions) + ('^([ab]*?)(?=(b)?)c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), + ('^([ab]*?)(?!(b))c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), + ('^([ab]*?)(?a)(?Pb)?b','ab').lastgroup""", 'a') # bug 545855 -- This pattern failed to cause a compile error as it --- 79,88 ---- test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1)) ! # bug described in patches 527371/672491 test(r"""sre.match(r'(a)?a','a').lastindex""", None) test(r"""sre.match(r'(a)(b)?b','ab').lastindex""", 1) test(r"""sre.match(r'(?Pa)(?Pb)?b','ab').lastgroup""", 'a') + test(r"""sre.match("(?Pa(b))", "ab").lastgroup""", 'a') + test(r"""sre.match("((a))", "a").lastindex""", 1) # bug 545855 -- This pattern failed to cause a compile error as it From niemeyer@users.sourceforge.net Sun Apr 20 08:35:46 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 20 Apr 2003 00:35:46 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.90,2.91 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16123/Modules Modified Files: _sre.c Log Message: More work on bug #672491 and patch #712900. I've applied a modified version of Greg Chapman's patch. I've included the fixes without introducing the reorganization mentioned, for the sake of stability. Also, the second fix mentioned in the patch don't fix the mentioned problem anymore, because of the change introduced by patch #720991 (by Greg as well). The new fix wasn't complicated though, and is included as well. As a note. It seems that there are other places that require the "protection" of LASTMARK_SAVE()/LASTMARK_RESTORE(), and are just waiting for someone to find how to break them. Particularly, I belive that every recursion of SRE_MATCH() should be protected by these macros. I won't do that right now since I'm not completely sure about this, and we don't have much time for testing until the next release. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -d -r2.90 -r2.91 *** _sre.c 20 Apr 2003 00:45:13 -0000 2.90 --- _sre.c 20 Apr 2003 07:35:44 -0000 2.91 *************** *** 338,354 **** } - static void - lastmark_restore(SRE_STATE *state, int lastmark) - { - if (state->lastmark > lastmark) { - memset( - state->mark + lastmark + 1, 0, - (state->lastmark - lastmark) * sizeof(void*) - ); - state->lastmark = lastmark; - state->lastindex = (lastmark == 0) ? -1 : (lastmark-1)/2+1; - } - } - /* generate 8-bit version */ --- 338,341 ---- *************** *** 691,694 **** --- 678,697 ---- #endif + /* macros to preserve lastmark in case of backtracking */ + #define LASTMARK_SAVE() \ + do { \ + lastmark = state->lastmark; \ + lastindex = state->lastindex; \ + } while (0) + #define LASTMARK_RESTORE() \ + do { \ + if (state->lastmark > lastmark) { \ + memset(state->mark + lastmark + 1, 0, \ + (state->lastmark - lastmark) * sizeof(void*)); \ + state->lastmark = lastmark; \ + state->lastindex = lastindex; \ + } \ + } while (0) + LOCAL(int) SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) *************** *** 701,705 **** int i, count; SRE_REPEAT* rp; ! int lastmark; SRE_CODE chr; --- 704,708 ---- int i, count; SRE_REPEAT* rp; ! int lastmark, lastindex; SRE_CODE chr; *************** *** 928,932 **** /* <0=skip> code ... */ TRACE(("|%p|%p|BRANCH\n", pattern, ptr)); ! lastmark = state->lastmark; for (; pattern[0]; pattern += pattern[0]) { if (pattern[1] == SRE_OP_LITERAL && --- 931,935 ---- /* <0=skip> code ... */ TRACE(("|%p|%p|BRANCH\n", pattern, ptr)); ! LASTMARK_SAVE(); for (; pattern[0]; pattern += pattern[0]) { if (pattern[1] == SRE_OP_LITERAL && *************** *** 940,944 **** if (i) return i; ! lastmark_restore(state, lastmark); } return 0; --- 943,947 ---- if (i) return i; ! LASTMARK_RESTORE(); } return 0; *************** *** 980,985 **** state->ptr = ptr; return 1; ! } else if (pattern[pattern[0]] == SRE_OP_LITERAL) { /* tail starts with a literal. skip positions where the rest of the pattern cannot possibly match */ --- 983,991 ---- state->ptr = ptr; return 1; + } ! LASTMARK_SAVE(); ! ! if (pattern[pattern[0]] == SRE_OP_LITERAL) { /* tail starts with a literal. skip positions where the rest of the pattern cannot possibly match */ *************** *** 999,1007 **** ptr--; count--; } } else { /* general case */ - lastmark = state->lastmark; while (count >= (int) pattern[1]) { state->ptr = ptr; --- 1005,1013 ---- ptr--; count--; + LASTMARK_RESTORE(); } } else { /* general case */ while (count >= (int) pattern[1]) { state->ptr = ptr; *************** *** 1011,1015 **** ptr--; count--; ! lastmark_restore(state, lastmark); } } --- 1017,1021 ---- ptr--; count--; ! LASTMARK_RESTORE(); } } *************** *** 1056,1060 **** int matchmax = ((int)pattern[2] == 65535); int c; ! lastmark = state->lastmark; while (matchmax || count <= (int) pattern[2]) { state->ptr = ptr; --- 1062,1066 ---- int matchmax = ((int)pattern[2] == 65535); int c; ! LASTMARK_SAVE(); while (matchmax || count <= (int) pattern[2]) { state->ptr = ptr; *************** *** 1066,1069 **** --- 1072,1076 ---- if (c < 0) return c; + LASTMARK_RESTORE(); if (c == 0) break; *************** *** 1072,1076 **** count++; } - lastmark_restore(state, lastmark); } return 0; --- 1079,1082 ---- *************** *** 1114,1117 **** --- 1120,1125 ---- TRACE(("|%p|%p|MAX_UNTIL %d\n", pattern, ptr, count)); + LASTMARK_SAVE(); + if (count < rp->pattern[1]) { /* not enough matches */ *************** *** 1123,1126 **** --- 1131,1135 ---- rp->count = count - 1; state->ptr = ptr; + LASTMARK_RESTORE(); return 0; } *************** *** 1130,1134 **** match another item, do so */ rp->count = count; - lastmark = state->lastmark; i = mark_save(state, 0, lastmark); if (i < 0) --- 1139,1142 ---- *************** *** 1139,1143 **** return i; i = mark_restore(state, 0, lastmark); ! state->lastmark = lastmark; if (i < 0) return i; --- 1147,1151 ---- return i; i = mark_restore(state, 0, lastmark); ! LASTMARK_RESTORE(); if (i < 0) return i; *************** *** 1183,1186 **** --- 1191,1196 ---- } + LASTMARK_SAVE(); + /* see if the tail matches */ state->repeat = rp->prev; *************** *** 1192,1195 **** --- 1202,1207 ---- state->repeat = rp; + LASTMARK_RESTORE(); + if (count >= rp->pattern[2] && rp->pattern[2] != 65535) return 0; *************** *** 3085,3086 **** --- 3097,3101 ---- #endif /* !defined(SRE_RECURSIVE) */ + + /* vim:ts=4:sw=4:et + */ From gward@users.sourceforge.net Mon Apr 21 03:40:37 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 20 Apr 2003 19:40:37 -0700 Subject: [Python-checkins] python/dist/src/Lib optparse.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13506/Lib Modified Files: optparse.py Log Message: Update to Optik 1.4.1; here are the relevant bits of the change log: * Fixed some long-hidden bugs revealed by the new PyUnit-based test suite (thanks to Johannes Gijsbers the new test suite, improved tests that caught the bugs, and the bug fixes). * Make store_true/store_false store True/False rather than 1/0. Details available in Optik's CVS repository. Index: optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/optparse.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** optparse.py 4 Jan 2003 21:54:26 -0000 1.2 --- optparse.py 21 Apr 2003 02:40:34 -0000 1.3 *************** *** 3,13 **** By Greg Ward ! Originally distributed as Optik. ! See http://optik.sourceforge.net/ """ __copyright__ = """ ! Copyright (c) 2001-2002 Gregory P. Ward. All rights reserved. Redistribution and use in source and binary forms, with or without --- 3,25 ---- By Greg Ward ! Originally distributed as Optik; see http://optik.sourceforge.net/ . ! If you have problems with this module, please do not files bugs, ! patches, or feature requests with Python; instead, use Optik's ! SourceForge project page: ! http://sourceforge.net/projects/optik ! ! For support, use the optik-users@lists.sourceforge.net mailing list ! (http://lists.sourceforge.net/lists/listinfo/optik-users). """ + # Python developers: please do not make changes to this file, since + # it is automatically generated from the Optik source code. + + + __version__ = "1.4.1" + __copyright__ = """ ! Copyright (c) 2001-2003 Gregory P. Ward. All rights reserved. Redistribution and use in source and binary forms, with or without *************** *** 43,48 **** import textwrap - __version__ = "1.4+" - class OptParseError (Exception): def __init__ (self, msg): --- 55,58 ---- *************** *** 52,55 **** --- 62,66 ---- return self.msg + class OptionError (OptParseError): """ *************** *** 83,86 **** --- 94,99 ---- Raised if an invalid or ambiguous option is seen on the command-line. """ + + class HelpFormatter: *************** *** 119,126 **** self.level = 0 self.help_width = width - max_help_position ! if short_first: ! self.format_option_strings = self.format_option_strings_short_first ! else: ! self.format_option_strings = self.format_option_strings_long_first def indent (self): --- 132,136 ---- self.level = 0 self.help_width = width - max_help_position ! self.short_first = short_first def indent (self): *************** *** 199,234 **** def format_option_strings (self, option): """Return a comma-separated list of option strings & metavariables.""" ! raise NotImplementedError( ! "abstract method: use format_option_strings_short_first or " ! "format_option_strings_long_first instead.") ! ! def format_option_strings_short_first (self, option): ! opts = [] # list of "-a" or "--foo=FILE" strings ! takes_value = option.takes_value() ! if takes_value: metavar = option.metavar or option.dest.upper() ! for sopt in option._short_opts: ! opts.append(sopt + metavar) ! for lopt in option._long_opts: ! opts.append(lopt + "=" + metavar) else: ! for opt in option._short_opts + option._long_opts: ! opts.append(opt) ! return ", ".join(opts) ! def format_option_strings_long_first (self, option): ! opts = [] # list of "-a" or "--foo=FILE" strings ! takes_value = option.takes_value() ! if takes_value: ! metavar = option.metavar or option.dest.upper() ! for lopt in option._long_opts: ! opts.append(lopt + "=" + metavar) ! for sopt in option._short_opts: ! opts.append(sopt + metavar) else: ! for opt in option._long_opts + option._short_opts: ! opts.append(opt) ! return ", ".join(opts) class IndentedHelpFormatter (HelpFormatter): --- 209,226 ---- def format_option_strings (self, option): """Return a comma-separated list of option strings & metavariables.""" ! if option.takes_value(): metavar = option.metavar or option.dest.upper() ! short_opts = [sopt + metavar for sopt in option._short_opts] ! long_opts = [lopt + "=" + metavar for lopt in option._long_opts] else: ! short_opts = option._short_opts ! long_opts = option._long_opts ! if self.short_first: ! opts = short_opts + long_opts else: ! opts = long_opts + short_opts + return ", ".join(opts) class IndentedHelpFormatter (HelpFormatter): *************** *** 268,271 **** --- 260,265 ---- def format_heading (self, heading): return "%s\n%s\n" % (heading, "=-"[self.level] * len(heading)) + + _builtin_cvt = { "int" : (int, "integer"), "long" : (long, "long integer"), *************** *** 401,405 **** def __init__ (self, *opts, **attrs): ! # Set _short_opts, _long_opts attrs from 'opts' tuple opts = self._check_opt_strings(opts) self._set_opt_strings(opts) --- 395,402 ---- def __init__ (self, *opts, **attrs): ! # Set _short_opts, _long_opts attrs from 'opts' tuple. ! # Have to be set now, in case no option strings are supplied. ! self._short_opts = [] ! self._long_opts = [] opts = self._check_opt_strings(opts) self._set_opt_strings(opts) *************** *** 422,432 **** opts = filter(None, opts) if not opts: ! raise OptionError("at least one option string must be supplied", ! self) return opts def _set_opt_strings (self, opts): - self._short_opts = [] - self._long_opts = [] for opt in opts: if len(opt) < 2: --- 419,426 ---- opts = filter(None, opts) if not opts: ! raise TypeError("at least one option string must be supplied") return opts def _set_opt_strings (self, opts): for opt in opts: if len(opt) < 2: *************** *** 570,577 **** def __str__ (self): ! if self._short_opts or self._long_opts: ! return "/".join(self._short_opts + self._long_opts) ! else: ! raise RuntimeError, "short_opts and long_opts both empty!" def takes_value (self): --- 564,568 ---- def __str__ (self): ! return "/".join(self._short_opts + self._long_opts) def takes_value (self): *************** *** 610,616 **** setattr(values, dest, self.const) elif action == "store_true": ! setattr(values, dest, 1) elif action == "store_false": ! setattr(values, dest, 0) elif action == "append": values.ensure_value(dest, []).append(value) --- 601,607 ---- setattr(values, dest, self.const) elif action == "store_true": ! setattr(values, dest, True) elif action == "store_false": ! setattr(values, dest, False) elif action == "append": values.ensure_value(dest, []).append(value) *************** *** 633,636 **** --- 624,629 ---- # class Option + + def get_prog_name (): return os.path.basename(sys.argv[0]) *************** *** 923,927 **** a usage string for your program. Before it is displayed to the user, "%prog" will be expanded to the name of ! your program (os.path.basename(sys.argv[0])). allow_interspersed_args : boolean = true --- 916,923 ---- a usage string for your program. Before it is displayed to the user, "%prog" will be expanded to the name of ! your program (self.prog or os.path.basename(sys.argv[0])). ! prog : string ! the name of the current program (to override ! os.path.basename(sys.argv[0])). allow_interspersed_args : boolean = true *************** *** 968,975 **** description=None, formatter=None, ! add_help_option=1): OptionContainer.__init__( self, option_class, conflict_handler, description) self.set_usage(usage) self.version = version self.allow_interspersed_args = 1 --- 964,973 ---- description=None, formatter=None, ! add_help_option=1, ! prog=None): OptionContainer.__init__( self, option_class, conflict_handler, description) self.set_usage(usage) + self.prog = prog self.version = version self.allow_interspersed_args = 1 *************** *** 1383,1384 **** --- 1381,1383 ---- # classes. make_option = Option + From gward@users.sourceforge.net Mon Apr 21 03:41:28 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 20 Apr 2003 19:41:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_optparse.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15486/Lib/test Added Files: test_optparse.py Log Message: Test suite for optparse. This is a slightly-edited copy of test/test_optik.py (rev 1.19) from the Optik CVS. --- NEW FILE: test_optparse.py --- #!/usr/bin/python # # Test suite for Optik. Supplied by Johannes Gijsbers # (taradino@softhome.net) -- translated from the original Optik # test suite to this PyUnit-based version. # # $Id: test_optparse.py,v 1.1 2003/04/21 02:41:25 gward Exp $ # import sys import os import copy import unittest from cStringIO import StringIO from pprint import pprint from test import test_support [...1171 lines suppressed...] possibilities = ", ".join(wordmap.keys()) self.assertRaises(_match_abbrev, BadOptionError, "ambiguous option: --f (%s?)" % possibilities, funcargs=[s, wordmap]) def _testclasses(): mod = sys.modules[__name__] return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] def suite(): suite = unittest.TestSuite() for testclass in _testclasses(): suite.addTest(unittest.makeSuite(testclass)) return suite def test_main(): test_support.run_suite(suite()) if __name__ == '__main__': unittest.main() From aimacintyre@users.sourceforge.net Mon Apr 21 15:33:08 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 21 Apr 2003 07:33:08 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.10,1.11 config.c,1.4,1.5 README.os2emx,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv29795 Modified Files: Makefile config.c README.os2emx Log Message: Makefile & config.c: - restructure build for modules now in Python DLL README.os2emx - clean out old cruft no longer appropriate now that EMX port builds from CVS - reflect move of modules into core DLL - add section on building from source Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile 21 Apr 2003 14:27:59 -0000 1.10 --- Makefile 21 Apr 2003 14:33:03 -0000 1.11 *************** *** 265,269 **** Modules/signalmodule.c \ Modules/posixmodule.c \ ! Modules/threadmodule.c SRC.PARSE1= $(addprefix $(TOP), \ Parser/acceler.c \ --- 265,305 ---- Modules/signalmodule.c \ Modules/posixmodule.c \ ! Modules/threadmodule.c \ ! Modules/arraymodule.c \ ! Modules/binascii.c \ ! Modules/cmathmodule.c \ ! Modules/_codecsmodule.c \ ! Modules/cPickle.c \ ! Modules/cStringIO.c \ ! Modules/_csv.c \ ! Modules/datetimemodule.c \ ! Modules/dlmodule.c \ ! Modules/errnomodule.c \ ! Modules/fcntlmodule.c \ ! Modules/imageop.c \ ! Modules/itertoolsmodule.c \ ! Modules/_localemodule.c \ ! Modules/mathmodule.c \ ! Modules/md5c.c \ ! Modules/md5module.c \ ! Modules/operator.c \ ! Modules/pcremodule.c \ ! Modules/pypcre.c \ ! Modules/_randommodule.c \ ! Modules/regexmodule.c \ ! Modules/regexpr.c \ ! Modules/rgbimgmodule.c \ ! Modules/shamodule.c \ ! Modules/_sre.c \ ! Modules/stropmodule.c \ ! Modules/structmodule.c \ ! Modules/symtablemodule.c \ ! Modules/termios.c \ ! Modules/timemodule.c \ ! Modules/timingmodule.c \ ! Modules/_weakref.c \ ! Modules/xreadlinesmodule.c \ ! Modules/xxsubtype.c \ ! Modules/zipimport.c) SRC.PARSE1= $(addprefix $(TOP), \ Parser/acceler.c \ *************** *** 377,427 **** # (the 'module' in ?????module.c is assumed) # - these can be built with implicit rules ! EASYEXTMODULES= array \ ! cmath \ ! _codecs \ ! datetime \ ! dl \ ! errno \ ! fcntl \ ! fpectl \ fpetest \ - _locale \ - math \ parser \ pwd \ - _random \ - rgbimg \ rotor \ ! select \ ! sha \ ! strop \ ! struct \ ! time \ ! timing # Python modules to be dynamically loaded that need explicit build rules # (either multiple source files and/or non-standard module naming) # (NOTE: use shortened names for modules affected by 8 char name limit) ! HARDEXTMODULES= binascii \ ! cPickle \ ! cStringI \ ! _csv \ ! _hotshot \ ! imageop \ ! itertool \ ! md5 \ ! operator \ ! pcre \ ! regex \ _socket \ - _sre \ - _symtabl \ - termios \ _testcap \ ! unicoded \ ! _weakref \ ! xreadlin \ ! xxsubtyp \ ! zipimpor # Python external ($(MODULE.EXT)) modules - can be EASY or HARD --- 413,430 ---- # (the 'module' in ?????module.c is assumed) # - these can be built with implicit rules ! EASYEXTMODULES= fpectl \ fpetest \ parser \ pwd \ rotor \ ! select # Python modules to be dynamically loaded that need explicit build rules # (either multiple source files and/or non-standard module naming) # (NOTE: use shortened names for modules affected by 8 char name limit) ! HARDEXTMODULES= _hotshot \ _socket \ _testcap \ ! unicoded # Python external ($(MODULE.EXT)) modules - can be EASY or HARD *************** *** 529,589 **** # awkward handling (due e.g. to non-std naming, or multiple source files) # - standard modules - binascii$(MODULE.EXT): $(OUT)binascii$O $(OUT)binascii_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - cPickle$(MODULE.EXT): $(OUT)cPickle$O $(OUT)cPickle_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - # cStringIO needs to be renamed to be useful (8 char DLL name limit) - cStringIO$(MODULE.EXT): $(OUT)cStringIO$O $(OUT)cStringIO_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - cStringI$(MODULE.EXT): cStringIO$(MODULE.EXT) - cp $^ $@ - - _csv$(MODULE.EXT): $(OUT)_csv$O $(OUT)_csv_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) _hotshot$(MODULE.EXT): $(OUT)_hotshot$O $(OUT)_hotshot_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - imageop$(MODULE.EXT): $(OUT)imageop$O $(OUT)imageop_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - # itertools needs to be renamed to be useful - itertools$(MODULE.EXT): $(OUT)itertoolsmodule$O $(OUT)itertools_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - itertool$(MODULE.EXT): itertools$(MODULE.EXT) - cp $^ $@ - - md5$(MODULE.EXT): $(OUT)md5module$O $(OUT)md5c$O $(OUT)md5_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - operator$(MODULE.EXT): $(OUT)operator$O $(OUT)operator_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - pcre$(MODULE.EXT): $(OUT)pcremodule$O $(OUT)pypcre$O $(OUT)pcre_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - regex$(MODULE.EXT): $(OUT)regexmodule$O $(OUT)regexpr$O $(OUT)regex_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - _socket$(MODULE.EXT): $(OUT)socketmodule$O $(OUT)_socket_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - _sre$(MODULE.EXT): $(OUT)_sre$O $(OUT)_sre_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - # _symtable needs to be renamed to be useful - _symtable$(MODULE.EXT): $(OUT)symtablemodule$O $(OUT)_symtable_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - _symtabl$(MODULE.EXT): _symtable$(MODULE.EXT) - cp $^ $@ - - termios$(MODULE.EXT): $(OUT)termios$O $(OUT)termios_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - # _testcapi needs to be renamed to be useful _testcapi$(MODULE.EXT): $(OUT)_testcapimodule$O $(OUT)_testcapi_m.def $(PYTHON.IMPLIB) --- 532,542 ---- *************** *** 598,625 **** unicoded$(MODULE.EXT): unicodedata$(MODULE.EXT) - cp $^ $@ - - _weakref$(MODULE.EXT): $(OUT)_weakref$O $(OUT)_weakref_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - # xreadlines needs to be renamed to be useful - xreadlines$(MODULE.EXT): $(OUT)xreadlinesmodule$O $(OUT)xreadlines_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - xreadlin$(MODULE.EXT): xreadlines$(MODULE.EXT) - cp $^ $@ - - # xxsubtype needs to be renamed to be useful - xxsubtype$(MODULE.EXT): $(OUT)xxsubtype$O $(OUT)xxsubtype_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - xxsubtyp$(MODULE.EXT): xxsubtype$(MODULE.EXT) - cp $^ $@ - - # zipimport needs to be renamed to be useful - zipimport$(MODULE.EXT): $(OUT)zipimport$O $(OUT)zipimport_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) - - zipimpor$(MODULE.EXT): zipimport$(MODULE.EXT) cp $^ $@ --- 551,554 ---- Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/config.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config.c 21 Apr 2003 14:28:00 -0000 1.4 --- config.c 21 Apr 2003 14:33:04 -0000 1.5 *************** *** 42,60 **** extern void initthread(); #endif - #if !HAVE_DYNAMIC_LOADING extern void init_codecs(); ! extern void init_curses(); ! extern void init_curses_panel(); ! extern void init_hotshot(); extern void init_locale(); extern void init_random(); extern void init_sre(); extern void init_symtable(); - extern void init_testcapi(); extern void init_weakref(); extern void initarray(); extern void initbinascii(); - extern void initbsddb185(); - extern void initbz2(); extern void initcPickle(); extern void initcStringIO(); --- 42,54 ---- extern void initthread(); #endif extern void init_codecs(); ! extern void init_csv(); extern void init_locale(); extern void init_random(); extern void init_sre(); extern void init_symtable(); extern void init_weakref(); extern void initarray(); extern void initbinascii(); extern void initcPickle(); extern void initcStringIO(); *************** *** 64,69 **** extern void initerrno(); extern void initfcntl(); - extern void initfpectl(); - extern void initfpetest(); extern void initimageop(); extern void inititertools(); --- 58,61 ---- *************** *** 71,80 **** extern void initmd5(); extern void initoperator(); - extern void initparser(); extern void initpcre(); - extern void initpwd(); extern void initregex(); extern void initrgbimg(); - extern void initrotor(); extern void initsha(); extern void initstrop(); --- 63,69 ---- *************** *** 83,90 **** extern void inittime(); extern void inittiming(); - extern void initunicodedata(); extern void initxreadlines(); extern void initxxsubtype(); extern void initzipimport(); extern void initzlib(); #ifdef USE_SOCKET --- 72,91 ---- extern void inittime(); extern void inittiming(); extern void initxreadlines(); extern void initxxsubtype(); extern void initzipimport(); + #if !HAVE_DYNAMIC_LOADING + extern void init_curses(); + extern void init_curses_panel(); + extern void init_hotshot(); + extern void init_testcapi(); + extern void initbsddb185(); + extern void initbz2(); + extern void initfpectl(); + extern void initfpetest(); + extern void initparser(); + extern void initpwd(); + extern void initrotor(); + extern void initunicodedata(); extern void initzlib(); #ifdef USE_SOCKET *************** *** 106,124 **** {"thread", initthread}, #endif - #if !HAVE_DYNAMIC_LOADING {"_codecs", init_codecs}, ! {"_curses", init_curses}, ! {"_curses_panel", init_curses_panel}, ! {"_hotshot", init_hotshot}, {"_locale", init_locale}, {"_random", init_random}, {"_sre", init_sre}, {"_symtable", init_symtable}, - {"_testcapi", init_testcapi}, {"_weakref", init_weakref}, {"array", initarray}, {"binascii", initbinascii}, - {"bsddb185", initbsddb185}, - {"bz2", initbz2}, {"cPickle", initcPickle}, {"cStringIO", initcStringIO}, --- 107,119 ---- {"thread", initthread}, #endif {"_codecs", init_codecs}, ! {"_csv", init_codecs}, {"_locale", init_locale}, {"_random", init_random}, {"_sre", init_sre}, {"_symtable", init_symtable}, {"_weakref", init_weakref}, {"array", initarray}, {"binascii", initbinascii}, {"cPickle", initcPickle}, {"cStringIO", initcStringIO}, *************** *** 128,133 **** {"errno", initerrno}, {"fcntl", initfcntl}, - {"fpectl", initfpectl}, - {"fpetest", initfpetest}, {"imageop", initimageop}, {"itertools", inititertools}, --- 123,126 ---- *************** *** 135,144 **** {"md5", initmd5}, {"operator", initoperator}, - {"parser", initparser}, {"pcre", initpcre}, - {"pwd", initpwd}, {"regex", initregex}, {"rgbimg", initrgbimg}, - {"rotor", initrotor}, {"sha", initsha}, {"strop", initstrop}, --- 128,134 ---- *************** *** 147,154 **** {"time", inittime}, {"timing", inittiming}, - {"unicodedata", initunicodedata}, {"xreadlines", initxreadlines}, {"xxsubtype", initxxsubtype}, {"zipimport", initzipimport}, {"zlib", initzlib}, #ifdef USE_SOCKET --- 137,156 ---- {"time", inittime}, {"timing", inittiming}, {"xreadlines", initxreadlines}, {"xxsubtype", initxxsubtype}, {"zipimport", initzipimport}, + #if !HAVE_DYNAMIC_LOADING + {"_curses", init_curses}, + {"_curses_panel", init_curses_panel}, + {"_hotshot", init_hotshot}, + {"_testcapi", init_testcapi}, + {"bsddb185", initbsddb185}, + {"bz2", initbz2}, + {"fpectl", initfpectl}, + {"fpetest", initfpetest}, + {"parser", initparser}, + {"pwd", initpwd}, + {"rotor", initrotor}, + {"unicodedata", initunicodedata}, {"zlib", initzlib}, #ifdef USE_SOCKET Index: README.os2emx =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/README.os2emx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README.os2emx 4 Dec 2002 12:40:49 -0000 1.3 --- README.os2emx 21 Apr 2003 14:33:04 -0000 1.4 *************** *** 12,20 **** - defaults to building with PyMalloc enabled (Python 2.3 default). - the port is now maintained in the Python CVS repository. Python 2.3 incorporates several changes which have resolved the ! longstanding problems the EMX port has had with test_longexp (used ! to be "YOU HAVE BEEN WARNED" item 1). ! Licenses and info about Python and EMX --- 12,25 ---- - defaults to building with PyMalloc enabled (Python 2.3 default). - the port is now maintained in the Python CVS repository. + - most standard modules are now built into the core Python DLL. Python 2.3 incorporates several changes which have resolved the ! longstanding problems the EMX port has had with test_longexp. ! ! Python 2.3 introduces changes to the Berkeley DB support, as a result of ! the PyBSDDB3 module (for the Sleepycat DB 3.3.x/4.0.x/4.1.x library) ! being imported into Python's standard library - see "YOU HAVE BEEN WARNED" ! items 4 & 5 for more information. ! Licenses and info about Python and EMX *************** *** 59,66 **** patches have been included in the Python 2.3 source distribution. ! Andrew Zabolotny implemented a port of Python v1.5.2 using the EMX development tools. His patches against the Python v1.5.2 source distribution have become the core of this port, and without his efforts ! this port wouldn't exist. Andrew's port also appears to have been compiled with his port of gcc 2.95.2 to EMX, which I have but have chosen not to use for the binary distribution of this port (see item 21 --- 64,71 ---- patches have been included in the Python 2.3 source distribution. ! Andy Zabolotny implemented a port of Python v1.5.2 using the EMX development tools. His patches against the Python v1.5.2 source distribution have become the core of this port, and without his efforts ! this port wouldn't exist. Andy's port also appears to have been compiled with his port of gcc 2.95.2 to EMX, which I have but have chosen not to use for the binary distribution of this port (see item 21 *************** *** 79,83 **** - v2.2 on December 24, 2001; - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); ! - v2.2.1 on April 14, 2002. - v2.2.2 on October 24, 2002. --- 84,88 ---- - v2.2 on December 24, 2001; - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); ! - v2.2.1 on April 14, 2002; - v2.2.2 on October 24, 2002. *************** *** 101,112 **** - GNU Readline (Kai Uwe Rommel's port available from Hobbes or LEO, v2.1) - GNU GDBM (Kai Uwe Rommel's port available from Hobbes or LEO, v1.7.3) ! - zlib (Hung-Chi Chu's port available from Hobbes or LEO, v1.1.3) ! - expat (distributed with Python, v1.95.2) - GNU MP (Peter Meerwald's port available from LEO, v2.0.2) - GNU UFC (Kai Uwe Rommel's port available from LEO, v2.0.4) - The zlib module requires the Z.DLL to be installed - see the Installation - section and item 12 of the "YOU HAVE BEEN WARNED" section for more - information. About this port --- 106,114 ---- - GNU Readline (Kai Uwe Rommel's port available from Hobbes or LEO, v2.1) - GNU GDBM (Kai Uwe Rommel's port available from Hobbes or LEO, v1.7.3) ! - zlib (derived from Hung-Chi Chu's port of v1.1.3, v1.1.4) ! - expat (distributed with Python, v1.95.6) - GNU MP (Peter Meerwald's port available from LEO, v2.0.2) - GNU UFC (Kai Uwe Rommel's port available from LEO, v2.0.4) About this port *************** *** 120,124 **** Python.exe is linked as an a.out executable, ie using EMX method E1 to compile & link the executable. This is so that fork() works (see ! "YOU HAVE BEEN WARNED" item 2). Python23.dll is created as a normal OMF DLL, with an OMF import --- 122,126 ---- Python.exe is linked as an a.out executable, ie using EMX method E1 to compile & link the executable. This is so that fork() works (see ! "YOU HAVE BEEN WARNED" item 1). Python23.dll is created as a normal OMF DLL, with an OMF import *************** *** 131,145 **** Modules: ! As far as possible, extension modules have been made dynamically loadable ! when the module is intended to be built this way. I haven't yet changed ! the building of Python's standard modules over to using the DistUtils. ! See "YOU HAVE BEEN WARNED" item 5 for notes about the fcntl module, and ! "YOU HAVE BEEN WARNED" item 14 for notes about the pwd and grp modules. Support for case sensitive module import semantics has been added to match the Windows release. This can be deactivated by setting the PYTHONCASEOK environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED" ! item 16. Optional modules: --- 133,152 ---- Modules: ! With the exception of modules that have a significant code size, or are ! not recommended or desired for normal use, the standard modules are now ! built into the core DLL rather than configured as dynamically loadable ! modules. This is for both reasons of performance (startup time) and ! memory use (lots of small DLLs fragment the address space). ! I haven't yet changed the building of Python's dynamically loadable ! modules over to using the DistUtils. ! ! See "YOU HAVE BEEN WARNED" item 3 for notes about the fcntl module, and ! "YOU HAVE BEEN WARNED" item 10 for notes about the pwd and grp modules. Support for case sensitive module import semantics has been added to match the Windows release. This can be deactivated by setting the PYTHONCASEOK environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED" ! item 12. Optional modules: *************** *** 148,163 **** ported to OS/2, I've built and included them. ! These include ncurses (_curses, _curses_panel), BSD DB (bsddb), ! GNU GDBM (gdbm, dbm), zlib (zlib), GNU Readline (readline), expat ! (pyexpat), GNU MP (mpz) and GNU UFC (crypt). I have built these modules statically linked against the 3rd party ! libraries, with the exception of zlib. Unfortunately my attempts to use ! the dll version of GNU readline have been a dismal failure, in that when ! the dynamically linked readline module is active other modules ! immediately provoke a core dump when imported. Only the BSD DB package (part of the BSD package distributed with EMX) ! needed source modifications to be used for this port, pertaining to use of errno with multithreading. --- 155,173 ---- ported to OS/2, I've built and included them. ! These include ncurses (_curses, _curses_panel), BSD DB (bsddb185), ! GNU GDBM (gdbm, dbm), zlib (zlib), GNU Readline (readline), GNU MP (mpz) ! and GNU UFC (crypt). ! ! Expat is now included in the Python release sourceball, and is always ! built. I have built these modules statically linked against the 3rd party ! libraries. Unfortunately my attempts to use the dll version of GNU ! readline have been a dismal failure, in that when the dynamically ! linked readline module is active other modules immediately provoke a ! core dump when imported. Only the BSD DB package (part of the BSD package distributed with EMX) ! needs source modifications to be used for this port, pertaining to use of errno with multithreading. *************** *** 166,170 **** The _curses_panel module is a potential problem - see "YOU HAVE BEEN ! WARNED" item 17. Upstream source patches: --- 176,180 ---- The _curses_panel module is a potential problem - see "YOU HAVE BEEN ! WARNED" item 13. Upstream source patches: *************** *** 211,217 **** --------- ! This port is packaged into several archives: ! - python-2.3-os2emx-bin-02????.zip (binaries, library modules) ! - python-2.3-os2emx-src-03????.zip (source patches and makefiles) Documentation for the Python language, as well as the Python 2.3 --- 221,232 ---- --------- ! This port is packaged as follows: ! - python-2.3-os2emx-bin-03????.zip (binaries, library modules) ! - python-2.3-os2emx-src-03???? (patches+makefiles for non-Python code) ! ! As all the Python specific patches for the port are now part of the ! Python release tarball, only the patches and makefiles involved in ! building external libraries for optional extensions are included in ! the source archive. Documentation for the Python language, as well as the Python 2.3 *************** *** 227,234 **** package. - If you wish to use the zlib module, you will need to obtain and install - the Z.DLL from Hung-Chi Chu's port of zlib v1.1.3 (zlib113.zip). See also - "YOU HAVE BEEN WARNED" item 12 below. - Unpack this archive, preserving the subdirectories, in the root directory of the drive where you want Python to live. --- 242,245 ---- *************** *** 277,286 **** REGRTEST.CMD batch file. The following tests are known to fail at this time: - - test_longexp (see "YOU HAVE BEEN WARNED" item 1); - test_mhlib (I don't know of any port of MH to OS/2); ! - test_pwd (see "YOU HAVE BEEN WARNED" item 14, probably a bug in my code); - test_grp (as per test_pwd); ! - test_strftime (see "YOU HAVE BEEN WARNED" item 20); ! - test_socketserver (fork() related, see "YOU HAVE BEEN WARNED" item 2). --- 288,401 ---- REGRTEST.CMD batch file. The following tests are known to fail at this time: - test_mhlib (I don't know of any port of MH to OS/2); ! - test_pwd (see "YOU HAVE BEEN WARNED" item 10, probably a bug in my code); - test_grp (as per test_pwd); ! - test_strftime (see "YOU HAVE BEEN WARNED" item 15); ! - test_strptime (see "YOU HAVE BEEN WARNED" item 22); ! - test_whichdb (see "YOU HAVE BEEN WARNED" item 5). ! - test_socketserver (fork() related, see "YOU HAVE BEEN WARNED" item 1). ! ! Note that some of the network related tests expect the loopback interface ! (interface "lo", with IP address 127.0.0.1) to be enabled, which from my ! experience is not the default configuration. Additionally, test_popen2 ! expects the "cat" utility (such as found in ports of the GNU tools) to ! be installed. ! ! ! Building from source ! -------------------- ! ! With the EMX port now checked into Python's CVS repository, the build ! infrastructure is part of the Python release sourceball. ! ! Prerequisites ! ! First and foremost, you need an operational EMX development installation - ! EMX v0.9d with fix04 (the latest at time of writing) & the gcc 2.8.1 ! compiler released by Eberhard Mattes is the recommended setup. ! ! If you have a different version of gcc installed, see "YOU HAVE BEEN ! WARNED" item 16. ! ! Other items of software required:- ! ! - GNU make (I'm using v3.76.1) ! - rm, cp, mkdir from the GNU file utilities package ! - GNU find ! ! Procedure ! ! 0. all changes mentioned apply to files in the PC/os2emx subdirectory ! of the Python release source tree. make is also executed from this ! directory, so change into this directory before proceeding. ! ! 1. decide if you need to change the location of the Python installation. ! If you wish to do this, set the value of the Makefile variable LIB_DIR ! to the directory you wish to use for PYTHONHOME ! (eg /usr/local/lib/python2.3). ! ! If you want Python to find its library without the PYTHONHOME ! environment variable set, set the value of the Makefile variable ! FIXED_PYHOME to "yes" (uncomment the appropriate line). ! ! 2. If you wish the Python executables (python.exe, pythonpm.exe & pgen.exe) ! to be installed in a directory other than the PYTHONHOME directory, set ! the value of the Makefile variable EXE_DIR to the appropriate directory. ! ! 3. If you wish the Python core DLL (python23.dll) to be installed in a ! directory other than the directory in which the Python executables are ! installed (by default, the PYTHONHOME directory), set the value of the ! Makefile variable DLL_DIR to the appropriate directory. This DLL must ! be placed in a directory on the system's LIBPATH, or that gets set ! with BEGINLIBPATH or ENDLIBPATH. ! ! 4. If you have installed any of the libraries that can be used to build ! optional Python modules, set the value of the relevant HAVE_ ! Makefile variable to "yes". The Makefile currently supports: ! ! library Makefile variable ! ........................................ ! zlib (1.1.4) HAVE_ZLIB ! GNU UltraFast Crypt HAVE_UFC ! Tcl/Tk HAVE_TCLTK (not known to work) ! GNU MP HAVE_GMPZ ! GNU Readline HAVE_GREADLINE ! BSD DB (v1.85) HAVE_BSDDB ! ncurses HAVE_NCURSES ! GNU gdbm HAVE_GDBM ! libbz2 HAVE_BZ2 ! ! Please note that you need to check that what you have installed ! is compatible with Python's build options. In particular, the ! BSD DB v1.85 library needs to be rebuilt with a source patch for ! multithread support (doesn't change the library's reentrant status ! but allows it to be linked to Python which is multithreaded). ! Widely available binary packages of other librarys & DLLs are ! not built/linked with multithread support. Beware! ! ! Also note that the Makefile currently expects any libraries to be ! found with the default library search path. You may need to add ! -L switches to the LDFLAGS Makefile variable if you have installed ! libraries in directories not in the default search path (which can ! be controlled by the LIBRARY_PATH environment variable used by EMX). ! ! 5. make ! ! It is usually a good idea to redirect the stdout and stderr streams ! of the make process to log files, so that you can review any messages. ! ! 6. make test ! ! This runs the Python regression tests, and completion is a sign of ! a usable build. You should check the list of skipped modules to ! ensure that any optional modules you selected have been built; ! checking the list of failures against the list of known failures ! elsewhere in this document is also prudent. ! ! 7. make install ! >>>>>> NOT YET COMPLETE <<<<<< ! ! 8. change to a directory outside the Python source tree and start Python. ! Check the version and build date to confirm satisfactory installation. *************** *** 290,308 **** I know about a number of nasties in this port. ! {1. Issue resolved...} ! ! 2. Eberhard Mattes, author of EMX, writes in his documentation that fork() is very inefficient in the OS/2 environment. It also requires that the executable be linked in a.out format rather than OMF. Use the os.exec and/or the os.spawn family of functions where possible. ! {3. Issue resolved...} ! ! 4. In the absence of GNU Readline, terminating the interpreter requires a control-Z (^Z) followed by a carriage return. Jeff Rush documented this problem in his Python 1.5.2 port. With Readline, a control-D (^D) works as per the standard Unix environment. ! 5. EMX only has a partial implementation of fcntl(). The fcntl module in this port supports what EMX supports. If fcntl is important to you, please review the EMX C Library Reference (included in .INF format in the --- 405,419 ---- I know about a number of nasties in this port. ! 1. Eberhard Mattes, author of EMX, writes in his documentation that fork() is very inefficient in the OS/2 environment. It also requires that the executable be linked in a.out format rather than OMF. Use the os.exec and/or the os.spawn family of functions where possible. ! 2. In the absence of GNU Readline, terminating the interpreter requires a control-Z (^Z) followed by a carriage return. Jeff Rush documented this problem in his Python 1.5.2 port. With Readline, a control-D (^D) works as per the standard Unix environment. ! 3. EMX only has a partial implementation of fcntl(). The fcntl module in this port supports what EMX supports. If fcntl is important to you, please review the EMX C Library Reference (included in .INF format in the *************** *** 311,352 **** script to deactivate the exercising of the missing functionality. ! 6. The BSD DB module is linked against DB v1.85. This version is widely ! known to have bugs, although some patches have become available (and are ! incorporated into the included bsddb module). Unless you have problems ! with software licenses which would rule out GDBM (and the dbm module ! because it is linked against the GDBM library) or need it for file format ! compatibility, you may be better off deleting it and relying on GDBM. I ! haven't looked at porting the version of the module supporting the later ! SleepyCat releases of BSD DB, which would also require a port of the ! SleepyCat DB package. ! 7. The readline module has been linked against ncurses rather than the ! termcap library supplied with EMX. ! {8. Workaround implemented} ! 9. I have configured this port to use "/" as the preferred path separator character, rather than "\" ('\\'), in line with the convention supported by EMX. Backslashes are still supported of course, and still appear in unexpected places due to outside sources that don't get normalised. ! 10. While the DistUtils components are now functional, other packaging/binary handling tools and utilities such as those included in the Demo and Tools directories - freeze in particular - are unlikely to work. If you do get them going, I'd like to know about your success. ! 11. I haven't set out to support the [BEGIN|END]LIBPATH functionality supported by one of the earlier ports (Rush's??). If it works let me know. ! 12. There appear to be several versions of Z.DLL floating around - the one ! I have is 45061 bytes and dated January 22, 1999. I have a report that ! another version causes SYS3175s when the zlib module is imported. ! ! 14. As a result of the limitations imposed by EMX's library routines, the standard extension module pwd only synthesises a simple passwd database, and the grp module cannot be supported at all. ! I have written substitutes, in Python naturally, which can process real ! passwd and group files for those applications (such as MailMan) that require more than EMX emulates. I have placed pwd.py and grp.py in Lib/plat-os2emx, which is usually before Lib/lib-dynload (which contains --- 422,479 ---- script to deactivate the exercising of the missing functionality. ! 4. the PyBSDDB3 module has been imported into the Python standard ! library, with the intent of superceding the BSDDB 1.85 module (bsddb). ! As I don't yet have a satisfactory port of Sleepcat's more recent DB ! library (3.3.x/4.0.x/4.1.x), I haven't included a binary of this ! module. I have left the Python part of the PyBSDDB package in this ! distribution for completeness. ! 5. As a consequence of the PyBSDDB3 module being imported, the former ! BSD DB (bsddb) module, linked against the DB v1.85 library from EMX, ! has been renamed bsddb185. The bsddb185 module will not be built by ! default on most platforms, but in the absence of a PyBSDDB3 module I ! have retained it in the EMX port. ! Version 1.85 of the DB library is widely known to have bugs, although ! some patches have become available (and are incorporated into the ! included bsddb185 module). Unless you have problems with software ! licenses which would rule out GDBM (and the dbm module because it is ! linked against the GDBM library) or need it for file format compatibility, ! you may be better off deleting it and relying on GDBM. ! Any code you have which uses the bsddb module can be modified to use the ! renamed module by changing ! ! import bsddb ! ! to ! ! import bsddb185 as bsddb ! ! A side effect of these changes is that the test_whichdb regression test ! fails. ! ! 6. The readline module has been linked against ncurses rather than the ! termcap library supplied with EMX. ! ! 7. I have configured this port to use "/" as the preferred path separator character, rather than "\" ('\\'), in line with the convention supported by EMX. Backslashes are still supported of course, and still appear in unexpected places due to outside sources that don't get normalised. ! 8. While the DistUtils components are now functional, other packaging/binary handling tools and utilities such as those included in the Demo and Tools directories - freeze in particular - are unlikely to work. If you do get them going, I'd like to know about your success. ! 9. I haven't set out to support the [BEGIN|END]LIBPATH functionality supported by one of the earlier ports (Rush's??). If it works let me know. ! 10. As a result of the limitations imposed by EMX's library routines, the standard extension module pwd only synthesises a simple passwd database, and the grp module cannot be supported at all. ! I have written pure Python substitutes for pwd and grp, which can process ! real passwd and group files for those applications (such as MailMan) that require more than EMX emulates. I have placed pwd.py and grp.py in Lib/plat-os2emx, which is usually before Lib/lib-dynload (which contains *************** *** 375,385 **** into why, and hope to have this fixed. ! 15. As of Python 2.1, termios support has mutated. There is no longer a ! platform specific TERMIOS.py containing the symbolic constants - these ! now live in the termios module. EMX's termios routines don't support all ! of the functionality now exposed by the termios module - refer to the EMX ! documentation to find out what is supported. ! 16. The case sensitive import semantics introduced in Python 2.1 for other case insensitive but case preserving file/operating systems (Windows etc), have been incorporated into this port, and are active by default. Setting --- 502,513 ---- into why, and hope to have this fixed. ! Be aware that Python's pwd & group modules are for reading password and ! group information only. ! 11. EMX's termios routines don't support all of the functionality now ! exposed by the termios module - refer to the EMX documentation to find ! out what is supported. ! ! 12. The case sensitive import semantics introduced in Python 2.1 for other case insensitive but case preserving file/operating systems (Windows etc), have been incorporated into this port, and are active by default. Setting *************** *** 387,391 **** previous (case insensitive) semantics. ! 17. Because I am statically linking ncurses, the _curses_panel module has potential problems arising from separate library data areas. To avoid this, I have configured the _curses_.pyd (imported as --- 515,519 ---- previous (case insensitive) semantics. ! 13. Because I am statically linking ncurses, the _curses_panel module has potential problems arising from separate library data areas. To avoid this, I have configured the _curses_.pyd (imported as *************** *** 396,412 **** let me know, and I'll look into an alternative solution. ! 18. I tried enabling the Python Object Allocator (PYMALLOC) code. While ! the port built this way passes the regression test, the Numpy extension ! (I tested v19.0.0) as built with with the port's DistUtils code doesn't ! work. Specifically, attempting to "import Numeric" provokes a core dump. ! Supposedly Numpy v20.1.0 contains a fix for this, but for reason outlined ! in item 1 above, PYMALLOC is not enabled in this release. ! ! 19. sys.platform now reports "os2emx" instead of "os2". os.name still reports "os2". This change was to make it easier to distinguish between ! the VAC++ build (being maintained by Michael Muller) and the EMX build (this port), principally for DistUtils. ! 20. it appears that the %W substitution in the EMX strftime() routine has an off-by-one bug. strftime was listed as passing the regression tests in previous releases, but this fact appears to have been an oversight in --- 524,533 ---- let me know, and I'll look into an alternative solution. ! 14. sys.platform reports "os2emx" instead of "os2". os.name still reports "os2". This change was to make it easier to distinguish between ! the VAC++ build (formerly maintained by Michael Muller) and the EMX build (this port), principally for DistUtils. ! 15. it appears that the %W substitution in the EMX strftime() routine has an off-by-one bug. strftime was listed as passing the regression tests in previous releases, but this fact appears to have been an oversight in *************** *** 415,442 **** ready yet. ! 21. previous releases of my Python ports have used the GCC optimisations ! "-O2 -fomit-frame-pointer". After experimenting with various optimisation ! settings, including deactivating assert()ions, I have concluded that "-O2" ! appears the best compromise for GCC 2.8.1 on my hardware. Curiously, ! deactivating assert() (via defining NDEBUG) _negatively_ impacts ! performance, allbeit only slightly, so I've chosen to leave the assert()s ! active. ! ! I did try using Andrew Zabolotny's (p)gcc 2.95.2 compiler, and in ! general concluded that it produced larger objects that ran slower ! than Mattes' gcc 2.8.1 compiler. ! Pystone ratings varied from just over 2000/s (no optimisation at all) ! to just under 3300/s (gcc 2.8.1, -O2) on my K6/2-300 system, for ! 100,000 iterations per run (rather than the default 10000). ! As a result of the optimisation change, the Python DLL is about 10% ! smaller than in the 2.1 release, and many of the dynamically loadable ! modules are smaller too. ! [2001/08/12] ! 22. As of this release, os.spawnv() and os.spawnve() now expose EMX's ! library routines rather than use the emulation in os.py. In order to make use of some of the features this makes available in --- 536,564 ---- ready yet. ! 16. I have successfully built this port with Andy Zabolotny's ports of ! pgcc 2.95 and gcc 3.2.1, in addition to EM's gcc 2.8.1. To use the ! bsddb185 module with the gcc 3.2.1 build, I had to recompile the DB library ! with gcc 3.2.1 - I don't know why, but trying to import the module built ! against a DB library compiled with gcc 2.8.1 would result in a SYS3175 ! error. ! I have not attempted to compile Python with any version of gcc prior to ! v2.8.1. ! If you compile Python with pgcc 2.95, changing the optimisation from -O2 to ! -O3 is worthwhile. While more aggressive optimisation is supported by gcc, ! a lot of benchmarking indicates that Python's performance is impeded by ! optimisation settings beyond just -O2 (-O3 for pgcc 2.95), at least on my ! hardware (AMD Athlon 1.4GHz, VIA C3 800MHz). ! If you wish to compile Python with gcc 3.2.1, you will need to modify the ! Makefile to compile Modules/_sre.c with either the -Os (recommended) or ! -O options, with the global optimisation set to -O2 or -O3 (not much ! difference between these with this compiler). Alternatively, you could ! change the global optimisation instead with a performance drop of 6-7% ! compared to the special-case approach. ! 17. os.spawnv() and os.spawnve() expose EMX's library routines rather ! than use the emulation in os.py. In order to make use of some of the features this makes available in *************** *** 448,454 **** system's stability. ! 23. pythonpm.exe in previous releases was just python.exe with the ! WINDOWAPI linker option set in the pythonpm.def file. In practice, ! this turns out to do nothing useful. I have written a replacement which wraps the Python DLL in a genuine --- 570,576 ---- system's stability. ! 18. pythonpm.exe used to be just python.exe with the WINDOWAPI linker ! option set in the pythonpm.def file. In practice, this turns out to do ! nothing useful. I have written a replacement which wraps the Python DLL in a genuine *************** *** 486,514 **** Illya Vaes' Tcl/Tk port, which would make it easier. ! [2001/08/14] ! ! 24. os.chdir() now uses EMX's _chdir2(), which supports changing ! both drive and directory at once. Similarly, os.getcwd() now uses ! EMX's _getcwd() which returns drive as well as path. ! ! [2001/12/08] - 2.2 Beta 2 ! ! 25. pyconfig.h (previously known as config.h) is now located in the ! Include subdirectory with all other include files. ! ! [2001/12/16] - 2.2 Release Candidate 1 ! ! [2001/12/08] - 2.2 Final ! ! [2002/03/31] - 2.2.1 Release Candidate 2 ! ! [2002/04/14] - 2.2.1 Final ! [2002/8/18] ! 26. now explicitly set the number of file handles available to a ! Python process to 250. EMX default is 40, which is insufficient for the ! recently checked in security improvments to the tempfile regression ! test (test_tempfile) which tries to create 100 temporary files. This setting can be overridden via the EMXOPT environment variable: --- 608,622 ---- Illya Vaes' Tcl/Tk port, which would make it easier. ! 19. os.chdir() uses EMX's _chdir2(), which supports changing both drive ! and directory at once. Similarly, os.getcwd() uses EMX's _getcwd() ! which returns drive as well as path. ! 20. pyconfig.h is installed in the Include subdirectory with all ! other include files. ! 21. the default build explicitly sets the number of file handles ! available to a Python process to 250. EMX default is 40, which is ! insufficient for the tempfile regression test (test_tempfile) which ! tries to create 100 temporary files. This setting can be overridden via the EMXOPT environment variable: *************** *** 518,521 **** --- 626,634 ---- python.exe - please refer to the EMX documentation for more information. + 22. a pure python strptime module is now part of the Python standard + library, superceding a platform specific extension module. This module + leverages the strftime module, and as a result test_strptime fails + due to the EMX strftime bug in item 20 above. + ... probably other issues that I've not encountered, or don't remember :-( *************** *** 549,555 **** and should be addressed to me at the e-mail addresses below. ! I intend creating a private mailing list for announcements of fixes & ! updates to this port. If you wish to receive such e-mail announcments, ! please send me an e-mail requesting that you be added to this list. Andrew MacIntyre --- 662,668 ---- and should be addressed to me at the e-mail addresses below. ! I have a private mailing list for announcements of fixes & updates to ! this port. If you wish to receive such e-mail announcments, please send ! me an e-mail requesting that you be added to this list. Andrew MacIntyre *************** *** 557,559 **** Web: http://www.andymac.org/ ! 18 August, 2001. --- 670,672 ---- Web: http://www.andymac.org/ ! 18 April, 2003. From aimacintyre@users.sourceforge.net Mon Apr 21 15:28:04 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 21 Apr 2003 07:28:04 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.9,1.10 config.c,1.3,1.4 pyconfig.h,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv26183 Modified Files: Makefile config.c pyconfig.h Log Message: Makefile: - add _csv module to the build list - various cleanups config.c: - various cleanups pyconfig.h: - various cleanups Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 19 Feb 2003 12:42:35 -0000 1.9 --- Makefile 21 Apr 2003 14:27:59 -0000 1.10 *************** *** 28,50 **** #MODE= debug # === Assert() enabled === ! #ASSERTIONS=no ! ASSERTIONS=yes # === Optional modules === # Do you have the InfoZip compression library installed? ! ZLIB= no # Do you have the Ultra Fast Crypt (UFC) library installed? ! UFC= no # Do you have the Tcl/Tk library installed? ! TCLTK= no # Do you have the GNU multiprecision library installed? ! GMPZ= no # Do you have the GNU readline library installed? # NOTE: I'm using a modified version of Kai Uwe Rommel's port that # - is compiled with multithreading enabled # - is linked statically ! # I have had no success trying to use a DLL version, even with ! # the multithreading switch. ! GREADLINE= no # Do you have the BSD DB library (v1.85) as included in the EMXBSD package? # NOTE: this library needs to be recompiled with a structure member --- 28,53 ---- #MODE= debug # === Assert() enabled === ! ASSERTIONS=no ! #ASSERTIONS=yes ! # === Hard-wire installation location === ! FIXED_PYHOME=no ! #FIXED_PYHOME=yes # === Optional modules === # Do you have the InfoZip compression library installed? ! HAVE_ZLIB= no # Do you have the Ultra Fast Crypt (UFC) library installed? ! HAVE_UFC= no # Do you have the Tcl/Tk library installed? ! HAVE_TCLTK= no # Do you have the GNU multiprecision library installed? ! HAVE_GMPZ= no # Do you have the GNU readline library installed? # NOTE: I'm using a modified version of Kai Uwe Rommel's port that # - is compiled with multithreading enabled # - is linked statically ! # I have had no success trying to use a DLL version, even when ! # compiled with multithreading enabled. ! HAVE_GREADLINE= no # Do you have the BSD DB library (v1.85) as included in the EMXBSD package? # NOTE: this library needs to be recompiled with a structure member *************** *** 52,62 **** # (there is a structure member called errno, used for shadowing the # real errno, which conflicts with the errno redefinition of -Zmt) ! BSDDB= no # Do you have the ncurses library installed? EMX's BSD curses aren't enough! ! CURSES= no # Do you have the GDBM library installed? ! GDBM= no # Do you have the BZ2 compression library installed? ! BZ2= no # === The Tools === --- 55,73 ---- # (there is a structure member called errno, used for shadowing the # real errno, which conflicts with the errno redefinition of -Zmt) ! HAVE_BSDDB= no # Do you have the ncurses library installed? EMX's BSD curses aren't enough! ! HAVE_NCURSES= no # Do you have the GDBM library installed? ! HAVE_GDBM= no # Do you have the BZ2 compression library installed? ! HAVE_BZ2= no ! ! # === install locations === ! # default value of PYTHONHOME ! LIB_DIR=C:/Python23 ! # default is to have everything in or under PYTHONHOME ! EXE_DIR=$(LIB_DIR) ! DLL_DIR=$(EXE_DIR) ! # === The Tools === *************** *** 86,89 **** --- 97,103 ---- CFLAGS+= -DNDEBUG endif + ifeq ($(FIXED_PYHOME),yes) + CFLAGS+= -DPREFIX=$(DQUOTE)$(LIB_DIR)$(DQUOTE) + endif # We're using the OMF format since EMX's ld has a obscure bug *************** *** 251,255 **** Modules/signalmodule.c \ Modules/posixmodule.c \ ! Modules/threadmodule.c) SRC.PARSE1= $(addprefix $(TOP), \ Parser/acceler.c \ --- 265,269 ---- Modules/signalmodule.c \ Modules/posixmodule.c \ ! Modules/threadmodule.c SRC.PARSE1= $(addprefix $(TOP), \ Parser/acceler.c \ *************** *** 392,395 **** --- 406,410 ---- cPickle \ cStringI \ + _csv \ _hotshot \ imageop \ *************** *** 411,441 **** # Python external ($(MODULE.EXT)) modules - can be EASY or HARD ! ifeq ($(ZLIB),yes) HARDEXTMODULES+= zlib endif ! ifeq ($(UFC),yes) HARDEXTMODULES+= crypt endif ! ifeq ($(TCLTK),yes) HARDEXTMODULES+= _tkinter CFLAGS+= -DHAS_DIRENT -I/TclTk80/include TK_LIBS+= -L/TclTk80/lib -ltcl80 -ltk80 endif ! ifeq ($(GMPZ),yes) HARDEXTMODULES+= mpz endif ! ifeq ($(GREADLINE),yes) HARDEXTMODULES+= readline endif ! ifeq ($(BSDDB),yes) HARDEXTMODULES+= bsddb185 endif ! ifeq ($(CURSES),yes) HARDEXTMODULES+= _curses _curses_ endif ! ifeq ($(GDBM),yes) HARDEXTMODULES+= gdbm dbm endif ! ifeq ($(BZ2),yes) HARDEXTMODULES+= bz2 endif --- 426,456 ---- # Python external ($(MODULE.EXT)) modules - can be EASY or HARD ! ifeq ($(HAVE_ZLIB),yes) HARDEXTMODULES+= zlib endif ! ifeq ($(HAVE_UFC),yes) HARDEXTMODULES+= crypt endif ! ifeq ($(HAVE_TCLTK),yes) HARDEXTMODULES+= _tkinter CFLAGS+= -DHAS_DIRENT -I/TclTk80/include TK_LIBS+= -L/TclTk80/lib -ltcl80 -ltk80 endif ! ifeq ($(HAVE_GMPZ),yes) HARDEXTMODULES+= mpz endif ! ifeq ($(HAVE_GREADLINE),yes) HARDEXTMODULES+= readline endif ! ifeq ($(HAVE_BSDDB),yes) HARDEXTMODULES+= bsddb185 endif ! ifeq ($(HAVE_NCURSES),yes) HARDEXTMODULES+= _curses _curses_ endif ! ifeq ($(HAVE_GDBM),yes) HARDEXTMODULES+= gdbm dbm endif ! ifeq ($(HAVE_BZ2),yes) HARDEXTMODULES+= bz2 endif *************** *** 526,529 **** --- 541,547 ---- cStringI$(MODULE.EXT): cStringIO$(MODULE.EXT) cp $^ $@ + + _csv$(MODULE.EXT): $(OUT)_csv$O $(OUT)_csv_m.def $(PYTHON.IMPLIB) + $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) _hotshot$(MODULE.EXT): $(OUT)_hotshot$O $(OUT)_hotshot_m.def $(PYTHON.IMPLIB) Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/config.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** config.c 2 Jan 2003 12:40:41 -0000 1.3 --- config.c 21 Apr 2003 14:28:00 -0000 1.4 *************** *** 67,70 **** --- 67,71 ---- extern void initfpetest(); extern void initimageop(); + extern void inititertools(); extern void initmath(); extern void initmd5(); *************** *** 130,133 **** --- 131,135 ---- {"fpetest", initfpetest}, {"imageop", initimageop}, + {"itertools", inititertools}, {"math", initmath}, {"md5", initmd5}, Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/pyconfig.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pyconfig.h 31 Dec 2002 11:24:43 -0000 1.3 --- pyconfig.h 21 Apr 2003 14:28:01 -0000 1.4 *************** *** 2,16 **** #define Py_CONFIG_H ! /* ! config.h. ! At some time in the past, generated automatically by configure. ! Maintained manually for better results. ! */ #define PLATFORM "os2emx" #define COMPILER "[EMX GCC " __VERSION__ "]" ! #define PYOS_OS2 ! #define PYCC_GCC ! #define PREFIX "/usr" /* Debugging */ --- 2,24 ---- #define Py_CONFIG_H ! /* config.h. ! * At some time in the past, generated automatically by/from configure. ! * now maintained manually. ! */ + /* build environment */ #define PLATFORM "os2emx" #define COMPILER "[EMX GCC " __VERSION__ "]" ! #define PYOS_OS2 1 ! #define PYCC_GCC 1 ! ! /* default location(s) */ ! #ifndef PREFIX ! #define PREFIX "" ! #endif ! #ifndef PYTHONPATH ! #define PYTHONPATH "./Lib;./Lib/plat-" PLATFORM \ ! ";./Lib/lib-dynload;./Lib/site-packages" ! #endif /* Debugging */ *************** *** 19,52 **** #endif - /* so that emx socket headers will define IP V4 socket types */ - #define TCPIPV4 - /* Use OS/2 flavour of threads */ ! #define WITH_THREAD ! #define OS2_THREADS ! ! /* Define if you want to read files with foreign newlines. */ ! #define WITH_UNIVERSAL_NEWLINES 1 /* We want sockets */ ! #define USE_SOCKET ! #define socklen_t int /* enable the GC module */ #define WITH_CYCLE_GC 1 /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 /* Unicode related */ ! #define Py_USING_UNICODE ! #define PY_UNICODE_TYPE wchar_t #define Py_UNICODE_SIZE SIZEOF_SHORT ! /* enable the Python object allocator */ ! /*#define WITH_PYMALLOC 1*/ ! ! #define PYTHONPATH ".;./Lib;./Lib/plat-" PLATFORM ";./Lib/lib-dynload;./Lib/site-packages" ! #define HAVE_TTYNAME 1 #define HAVE_WAIT 1 --- 27,57 ---- #endif /* Use OS/2 flavour of threads */ ! #define WITH_THREAD 1 ! #define OS2_THREADS 1 /* We want sockets */ ! #define TCPIPV4 1 ! #define USE_SOCKET 1 ! #define socklen_t int ! ! /* enable the Python object allocator */ ! #define WITH_PYMALLOC 1 /* enable the GC module */ #define WITH_CYCLE_GC 1 + /* Define if you want to read files with foreign newlines. */ + #define WITH_UNIVERSAL_NEWLINES 1 + /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 /* Unicode related */ ! #define Py_USING_UNICODE 1 ! #define PY_UNICODE_TYPE wchar_t #define Py_UNICODE_SIZE SIZEOF_SHORT ! /* system capabilities */ #define HAVE_TTYNAME 1 #define HAVE_WAIT 1 *************** *** 64,109 **** /* if port of GDBM installed, it includes NDBM emulation */ ! #define HAVE_NDBM_H 1 /* need this for spawnv code in posixmodule (cloned from WIN32 def'n) */ typedef long intptr_t; ! /* we don't have tm_zone but do have the external array ! tzname. */ #define HAVE_TZNAME 1 ! /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void ! /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 ! /* Define if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 ! /* Used for BeOS configuration */ ! /* #undef DL_EXPORT_HEADER */ ! #ifdef DL_EXPORT_HEADER ! #include DL_EXPORT_HEADER ! #endif ! ! /* Define this if you have the type long long */ #define HAVE_LONG_LONG 1 ! /* Define if your compiler supports function prototypes */ #define HAVE_PROTOTYPES 1 /* Define if your compiler supports variable length function prototypes ! (e.g. void fprintf(FILE *, char *, ...);) *and* */ #define HAVE_STDARG_PROTOTYPES 1 ! /* Define if malloc(0) returns a NULL pointer */ #define MALLOC_ZERO_RETURNS_NULL 1 ! /* Define to force use of thread-safe errno, h_errno, and other functions */ #define _REENTRANT 1 ! /* Define if you can safely include both and ! (which you can't on SCO ODT 3.0). */ #define SYS_SELECT_WITH_SYS_TIME 1 --- 69,109 ---- /* if port of GDBM installed, it includes NDBM emulation */ ! #define HAVE_NDBM_H 1 /* need this for spawnv code in posixmodule (cloned from WIN32 def'n) */ typedef long intptr_t; ! /* we don't have tm_zone but do have the external array tzname */ #define HAVE_TZNAME 1 ! /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void ! /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 ! /* Define if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 ! /* Define this if you have the type long long. */ #define HAVE_LONG_LONG 1 ! /* Define if your compiler supports function prototypes. */ #define HAVE_PROTOTYPES 1 /* Define if your compiler supports variable length function prototypes ! * (e.g. void fprintf(FILE *, char *, ...);) *and* . ! */ #define HAVE_STDARG_PROTOTYPES 1 ! /* Define if malloc(0) returns a NULL pointer. */ #define MALLOC_ZERO_RETURNS_NULL 1 ! /* Define to force use of thread-safe errno, h_errno, and other functions. */ #define _REENTRANT 1 ! /* Define if you can safely include both and ! * (which you can't on SCO ODT 3.0). ! */ #define SYS_SELECT_WITH_SYS_TIME 1 *************** *** 114,311 **** #define SIZEOF_TIME_T 4 ! /* The number of bytes in a short. */ #define SIZEOF_SHORT 2 ! /* The number of bytes in a int. */ #define SIZEOF_INT 4 ! /* The number of bytes in a long. */ #define SIZEOF_LONG 4 ! /* The number of bytes in a long long. */ #define SIZEOF_LONG_LONG 8 ! /* The number of bytes in a void *. */ #define SIZEOF_VOID_P 4 ! /* Define if you have the alarm function. */ #define HAVE_ALARM 1 ! /* Define if you have the clock function. */ #define HAVE_CLOCK 1 ! /* Define if you have the dup2 function. */ #define HAVE_DUP2 1 ! /* Define if you have the execv function. */ #define HAVE_EXECV 1 ! /* Define if you have the spawnv function. */ #define HAVE_SPAWNV 1 ! /* Define if you have the flock function. */ #define HAVE_FLOCK 1 ! /* Define if you have the fork function. */ #define HAVE_FORK 1 ! /* Define if you have the fsync function. */ #define HAVE_FSYNC 1 ! /* Define if you have the ftime function. */ #define HAVE_FTIME 1 ! /* Define if you have the ftruncate function. */ #define HAVE_FTRUNCATE 1 ! /* Define if you have the getcwd function. */ #define HAVE_GETCWD 1 ! /* Define if you have the getpeername function. */ #define HAVE_GETPEERNAME 1 ! /* Define if you have the getpgrp function. */ #define HAVE_GETPGRP 1 ! /* Define if you have the getpid function. */ #define HAVE_GETPID 1 ! /* Define if you have the getpwent function. */ #define HAVE_GETPWENT 1 ! /* Define if you have the gettimeofday function. */ #define HAVE_GETTIMEOFDAY 1 ! /* Define if you have the getwd function. */ #define HAVE_GETWD 1 ! /* Define if you have the hypot function. */ #define HAVE_HYPOT 1 ! /* Define if you have the kill function. */ #define HAVE_KILL 1 ! /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 ! /* Define if you have the mktime function. */ #define HAVE_MKTIME 1 ! /* Define if you have the pause function. */ #define HAVE_PAUSE 1 ! /* Define if you have the putenv function. */ #define HAVE_PUTENV 1 ! /* Define if you have the select function. */ #define HAVE_SELECT 1 ! /* Define if you have the setgid function. */ #define HAVE_SETGID 1 ! /* Define if you have the setlocale function. */ #define HAVE_SETLOCALE 1 ! /* Define if you have the setpgid function. */ #define HAVE_SETPGID 1 ! /* Define if you have the setuid function. */ #define HAVE_SETUID 1 ! /* Define if you have the setvbuf function. */ #define HAVE_SETVBUF 1 ! /* Define if you have the sigaction function. */ #define HAVE_SIGACTION 1 ! /* Define if you have the strdup function. */ #define HAVE_STRDUP 1 ! /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 ! /* Define if you have the strftime function. */ #define HAVE_STRFTIME 1 ! /* Define if you have the strptime function. */ #define HAVE_STRPTIME 1 ! /* Define if you have the tcgetpgrp function. */ #define HAVE_TCGETPGRP 1 ! /* Define if you have the tcsetpgrp function. */ #define HAVE_TCSETPGRP 1 ! /* Define if you have the times function. */ #define HAVE_TIMES 1 ! /* Define if you have the truncate function. */ #define HAVE_TRUNCATE 1 ! /* Define if you have the uname function. */ #define HAVE_UNAME 1 ! /* Define if you have the waitpid function. */ #define HAVE_WAITPID 1 ! /* Define if you have the header file. */ #define HAVE_DIRENT_H 1 ! /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 ! /* Define if you have the header file. */ #define HAVE_LIMITS_H 1 ! /* Define if you have the header file. */ #define HAVE_LOCALE_H 1 ! /* Define if you have the header file. */ #define HAVE_NCURSES_H 1 ! /* Define if you have the header file. */ #define HAVE_SIGNAL_H 1 ! /* Define if you have the header file. */ #define HAVE_STDARG_H 1 ! /* Define if you have the header file. */ #define HAVE_STDDEF_H 1 ! /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_FILE_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_PARAM_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_SELECT_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_TIME_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_TIMES_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_UN_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_UTSNAME_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_WAIT_H 1 ! /* Define if you have the header file. */ #define HAVE_UNISTD_H 1 ! /* Define if you have the header file. */ #define HAVE_UTIME_H 1 ! /* EMX has an snprintf() */ ! #define HAVE_SNPRINTF #endif /* !Py_CONFIG_H */ --- 114,311 ---- #define SIZEOF_TIME_T 4 ! /* The number of bytes in a short. */ #define SIZEOF_SHORT 2 ! /* The number of bytes in a int. */ #define SIZEOF_INT 4 ! /* The number of bytes in a long. */ #define SIZEOF_LONG 4 ! /* The number of bytes in a long long. */ #define SIZEOF_LONG_LONG 8 ! /* The number of bytes in a void *. */ #define SIZEOF_VOID_P 4 ! /* Define if you have the alarm function. */ #define HAVE_ALARM 1 ! /* Define if you have the clock function. */ #define HAVE_CLOCK 1 ! /* Define if you have the dup2 function. */ #define HAVE_DUP2 1 ! /* Define if you have the execv function. */ #define HAVE_EXECV 1 ! /* Define if you have the spawnv function. */ #define HAVE_SPAWNV 1 ! /* Define if you have the flock function. */ #define HAVE_FLOCK 1 ! /* Define if you have the fork function. */ #define HAVE_FORK 1 ! /* Define if you have the fsync function. */ #define HAVE_FSYNC 1 ! /* Define if you have the ftime function. */ #define HAVE_FTIME 1 ! /* Define if you have the ftruncate function. */ #define HAVE_FTRUNCATE 1 ! /* Define if you have the getcwd function. */ #define HAVE_GETCWD 1 ! /* Define if you have the getpeername function. */ #define HAVE_GETPEERNAME 1 ! /* Define if you have the getpgrp function. */ #define HAVE_GETPGRP 1 ! /* Define if you have the getpid function. */ #define HAVE_GETPID 1 ! /* Define if you have the getpwent function. */ #define HAVE_GETPWENT 1 ! /* Define if you have the gettimeofday function. */ #define HAVE_GETTIMEOFDAY 1 ! /* Define if you have the getwd function. */ #define HAVE_GETWD 1 ! /* Define if you have the hypot function. */ #define HAVE_HYPOT 1 ! /* Define if you have the kill function. */ #define HAVE_KILL 1 ! /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 ! /* Define if you have the mktime function. */ #define HAVE_MKTIME 1 ! /* Define if you have the pause function. */ #define HAVE_PAUSE 1 ! /* Define if you have the putenv function. */ #define HAVE_PUTENV 1 ! /* Define if you have the select function. */ #define HAVE_SELECT 1 ! /* Define if you have the setgid function. */ #define HAVE_SETGID 1 ! /* Define if you have the setlocale function. */ #define HAVE_SETLOCALE 1 ! /* Define if you have the setpgid function. */ #define HAVE_SETPGID 1 ! /* Define if you have the setuid function. */ #define HAVE_SETUID 1 ! /* Define if you have the setvbuf function. */ #define HAVE_SETVBUF 1 ! /* Define if you have the sigaction function. */ #define HAVE_SIGACTION 1 ! /* Define if you have the strdup function. */ #define HAVE_STRDUP 1 ! /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 ! /* Define if you have the strftime function. */ #define HAVE_STRFTIME 1 ! /* Define if you have the strptime function. */ #define HAVE_STRPTIME 1 ! /* Define if you have the tcgetpgrp function. */ #define HAVE_TCGETPGRP 1 ! /* Define if you have the tcsetpgrp function. */ #define HAVE_TCSETPGRP 1 ! /* Define if you have the times function. */ #define HAVE_TIMES 1 ! /* Define if you have the truncate function. */ #define HAVE_TRUNCATE 1 ! /* Define if you have the uname function. */ #define HAVE_UNAME 1 ! /* Define if you have the waitpid function. */ #define HAVE_WAITPID 1 ! /* Define if you have the header file. */ #define HAVE_DIRENT_H 1 ! /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 ! /* Define if you have the header file. */ #define HAVE_LIMITS_H 1 ! /* Define if you have the header file. */ #define HAVE_LOCALE_H 1 ! /* Define if you have the header file. */ #define HAVE_NCURSES_H 1 ! /* Define if you have the header file. */ #define HAVE_SIGNAL_H 1 ! /* Define if you have the header file. */ #define HAVE_STDARG_H 1 ! /* Define if you have the header file. */ #define HAVE_STDDEF_H 1 ! /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_FILE_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_PARAM_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_SELECT_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_TIME_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_TIMES_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_UN_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_UTSNAME_H 1 ! /* Define if you have the header file. */ #define HAVE_SYS_WAIT_H 1 ! /* Define if you have the header file. */ #define HAVE_UNISTD_H 1 ! /* Define if you have the header file. */ #define HAVE_UTIME_H 1 ! /* EMX has an snprintf(). */ ! #define HAVE_SNPRINTF 1 #endif /* !Py_CONFIG_H */ From aimacintyre@users.sourceforge.net Mon Apr 21 15:22:39 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 21 Apr 2003 07:22:39 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.296,2.297 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22099 Modified Files: posixmodule.c Log Message: apply Mark Hammond's PEP 311 changes to the EMX ripoff of the Windows popen[234]() code Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.296 retrieving revision 2.297 diff -C2 -d -r2.296 -r2.297 *** posixmodule.c 21 Apr 2003 14:19:51 -0000 2.296 --- posixmodule.c 21 Apr 2003 14:22:36 -0000 2.297 *************** *** 3557,3578 **** * files to be closed in any order - it is always the close() of the * final handle that will return the exit code. */ - /* RED_FLAG 31-Aug-2000 Tim - * This is always called (today!) between a pair of - * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS - * macros. So the thread running this has no valid thread state, as - * far as Python is concerned. However, this calls some Python API - * functions that cannot be called safely without a valid thread - * state, in particular PyDict_GetItem. - * As a temporary hack (although it may last for years ...), we - * *rely* on not having a valid thread state in this function, in - * order to create our own "from scratch". - * This will deadlock if _PyPclose is ever called by a thread - * holding the global lock. - * (The OS/2 EMX thread support appears to cover the case where the - * lock is already held - AIM Apr01) - */ - static int _PyPclose(FILE *file) { --- 3557,3565 ---- * files to be closed in any order - it is always the close() of the * final handle that will return the exit code. + * + * NOTE: This function is currently called with the GIL released. + * hence we use the GILState API to manage our state. */ static int _PyPclose(FILE *file) { *************** *** 3583,3588 **** int file_count; #ifdef WITH_THREAD ! PyInterpreterState* pInterpreterState; ! PyThreadState* pThreadState; #endif --- 3570,3574 ---- int file_count; #ifdef WITH_THREAD ! PyGILState_STATE state; #endif *************** *** 3593,3620 **** #ifdef WITH_THREAD ! /* Bootstrap a valid thread state into existence. */ ! pInterpreterState = PyInterpreterState_New(); ! if (!pInterpreterState) { ! /* Well, we're hosed now! We don't have a thread ! * state, so can't call a nice error routine, or raise ! * an exception. Just die. ! */ ! Py_FatalError("unable to allocate interpreter state " ! "when closing popen object."); ! return -1; /* unreachable */ ! } ! pThreadState = PyThreadState_New(pInterpreterState); ! if (!pThreadState) { ! Py_FatalError("unable to allocate thread state " ! "when closing popen object."); ! return -1; /* unreachable */ ! } ! /* Grab the global lock. Note that this will deadlock if the ! * current thread already has the lock! (see RED_FLAG comments ! * before this function) ! */ ! PyEval_RestoreThread(pThreadState); #endif - if (_PyPopenProcs) { --- 3579,3584 ---- #ifdef WITH_THREAD ! state = PyGILState_Ensure(); #endif if (_PyPopenProcs) { *************** *** 3679,3693 **** #ifdef WITH_THREAD ! /* Tear down the thread & interpreter states. ! * Note that interpreter state clear & delete functions automatically ! * call the thread clear & delete functions, and indeed insist on ! * doing that themselves. The lock must be held during the clear, but ! * need not be held during the delete. ! */ ! PyInterpreterState_Clear(pInterpreterState); ! PyEval_ReleaseThread(pThreadState); ! PyInterpreterState_Delete(pInterpreterState); #endif - return result; } --- 3643,3648 ---- #ifdef WITH_THREAD ! PyGILState_Release(state); #endif return result; } From aimacintyre@users.sourceforge.net Mon Apr 21 15:19:55 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 21 Apr 2003 07:19:55 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.295,2.296 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv20011 Modified Files: posixmodule.c Log Message: - DosSetExtLIBPATH objects to a NULL pointer, but a pointer to a NULL string does what is expected (ie unset [BEGIN|END]LIBPATH) - set the size of the DosQuerySysInfo buffer correctly; it was safe, but incorrect (allowing a 1 element overrun) Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.295 retrieving revision 2.296 diff -C2 -d -r2.295 -r2.296 *** posixmodule.c 19 Apr 2003 15:41:47 -0000 2.295 --- posixmodule.c 21 Apr 2003 14:19:51 -0000 2.296 *************** *** 5411,5417 **** APIRET rc; - if (strlen(s2) == 0) /* If New Value is an Empty String */ - s2 = NULL; /* Then OS/2 API Wants a NULL to Undefine It */ - rc = DosSetExtLIBPATH(s2, BEGIN_LIBPATH); if (rc != NO_ERROR) --- 5411,5414 ---- *************** *** 5421,5427 **** APIRET rc; - if (strlen(s2) == 0) /* If New Value is an Empty String */ - s2 = NULL; /* Then OS/2 API Wants a NULL to Undefine It */ - rc = DosSetExtLIBPATH(s2, END_LIBPATH); if (rc != NO_ERROR) --- 5418,5421 ---- *************** *** 7266,7270 **** Py_BEGIN_ALLOW_THREADS ! rc = DosQuerySysInfo(1, QSV_MAX, &values[1], sizeof(values)); Py_END_ALLOW_THREADS --- 7260,7264 ---- Py_BEGIN_ALLOW_THREADS ! rc = DosQuerySysInfo(1L, QSV_MAX, &values[1], sizeof(ULONG) * QSV_MAX); Py_END_ALLOW_THREADS From goodger@users.sourceforge.net Mon Apr 21 16:20:18 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 21 Apr 2003 08:20:18 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.237,1.238 pep-0311.txt,1.4,1.5 pep-0261.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv7827 Modified Files: pep-0000.txt pep-0311.txt pep-0261.txt Log Message: PEP 311 & 261 marked Final Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.237 retrieving revision 1.238 diff -C2 -d -r1.237 -r1.238 *** pep-0000.txt 12 Apr 2003 19:45:01 -0000 1.237 --- pep-0000.txt 21 Apr 2003 15:20:11 -0000 1.238 *************** *** 113,117 **** S 309 Built-in Curry Type Harris S 310 Reliable Acquisition/Release Pairs Hudson, Moore - S 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli S 313 Adding Roman Numeral Literals to Python Meyer --- 113,116 ---- *************** *** 148,152 **** SF 255 Simple Generators Schemenauer, et al SF 260 Simplify xrange() GvR ! S 261 Support for "wide" Unicode characters Prescod SF 263 Defining Python Source Code Encodings Lemburg SF 264 Future statements in simulated shells Hudson --- 147,151 ---- SF 255 Simple Generators Schemenauer, et al SF 260 Simplify xrange() GvR ! SF 261 Support for "wide" Unicode characters Prescod SF 263 Defining Python Source Code Encodings Lemburg SF 264 Future statements in simulated shells Hudson *************** *** 155,158 **** --- 154,158 ---- SF 285 Adding a bool type GvR SF 293 Codec Error Handling Callbacks Dörwald + SF 311 Simplified GIL Acquisition for Extensions Hammond Empty PEPs (or containing only an abstract) *************** *** 318,322 **** S 309 Built-in Curry Type Harris S 310 Reliable Acquisition/Release Pairs Hudson, Moore ! S 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli S 313 Adding Roman Numeral Literals to Python Meyer --- 318,322 ---- S 309 Built-in Curry Type Harris S 310 Reliable Acquisition/Release Pairs Hudson, Moore ! SF 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli S 313 Adding Roman Numeral Literals to Python Meyer Index: pep-0311.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0311.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0311.txt 19 Apr 2003 15:46:15 -0000 1.4 --- pep-0311.txt 21 Apr 2003 15:20:13 -0000 1.5 *************** *** 4,8 **** Last-Modified: $Date$ Author: Mark Hammond ! Status: Approved Type: Standards Track Content-Type: text/plain --- 4,8 ---- Last-Modified: $Date$ Author: Mark Hammond ! Status: Final Type: Standards Track Content-Type: text/plain Index: pep-0261.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0261.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0261.txt 11 Sep 2001 09:59:14 -0000 1.4 --- pep-0261.txt 21 Apr 2003 15:20:13 -0000 1.5 *************** *** 2,7 **** Title: Support for "wide" Unicode characters Version: $Revision$ ! Author: paulp@activestate.com (Paul Prescod) ! Status: Draft Type: Standards Track Created: 27-Jun-2001 --- 2,8 ---- Title: Support for "wide" Unicode characters Version: $Revision$ ! Last-Modified: $Date$ ! Author: Paul Prescod ! Status: Final Type: Standards Track Created: 27-Jun-2001 From goodger@users.sourceforge.net Mon Apr 21 16:25:19 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 21 Apr 2003 08:25:19 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.238,1.239 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv12661 Modified Files: pep-0000.txt Log Message: one more place Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.238 retrieving revision 1.239 diff -C2 -d -r1.238 -r1.239 *** pep-0000.txt 21 Apr 2003 15:20:11 -0000 1.238 --- pep-0000.txt 21 Apr 2003 15:25:14 -0000 1.239 *************** *** 269,273 **** SR 259 Omit printing newline after newline GvR SF 260 Simplify xrange() GvR ! S 261 Support for "wide" Unicode characters Prescod SD 262 Database of Installed Python Packages Kuchling SF 263 Defining Python Source Code Encodings Lemburg --- 269,273 ---- SR 259 Omit printing newline after newline GvR SF 260 Simplify xrange() GvR ! SF 261 Support for "wide" Unicode characters Prescod SD 262 Database of Installed Python Packages Kuchling SF 263 Defining Python Source Code Encodings Lemburg From fdrake@users.sourceforge.net Mon Apr 21 16:33:15 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 21 Apr 2003 08:33:15 -0700 Subject: [Python-checkins] python/nondist/peps pep-0205.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv19751 Modified Files: pep-0205.txt Log Message: Remove an XXX comment to reflect final decisions. I really need to review this PEP carefully before it can be marked finished; I suspect there's a bit of creep between reality and the PEP. Index: pep-0205.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0205.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0205.txt 14 Aug 2001 21:58:43 -0000 1.13 --- pep-0205.txt 21 Apr 2003 15:33:10 -0000 1.14 *************** *** 196,206 **** small types. ! XXX -- Need to determine the exact list of standard types which ! should support weak references. This should include instances and ! dictionaries. Whether it should include strings, buffers, lists, ! files, or sockets is debatable. ! ! The implementation has already been added to the Python CVS ! repository. --- 196,206 ---- small types. ! Standard types which support weak references include instances, ! functions, and bound & unbound methods. With the addition of ! class types ("new-style classes") in Python 2.2, types grew ! support for weak references. Instances of class types are weakly ! referencable if they have a base type which is weakly referencable, ! the class not specify __slots__, or a slot is named __weakref__. ! Generators also support weak references. From jhylton@users.sourceforge.net Mon Apr 21 21:26:28 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 21 Apr 2003 13:26:28 -0700 Subject: [Python-checkins] python/dist/src/Objects enumobject.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26969 Modified Files: enumobject.c Log Message: Add a useful docstring to enumerate. Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** enumobject.c 17 Mar 2003 19:46:09 -0000 1.5 --- enumobject.c 21 Apr 2003 20:26:25 -0000 1.6 *************** *** 80,84 **** PyDoc_STRVAR(enum_doc, ! "enumerate(iterable) -> create an enumerating-iterator"); PyTypeObject PyEnum_Type = { --- 80,89 ---- PyDoc_STRVAR(enum_doc, ! "enumerate(iterable) -> iterator for index, value of iterable\n" ! "\n" ! "Return an enumerate object. iterable must be an other object that supports\n" ! "iteration. The enumerate object yields pairs containing a count (from\n" ! "zero) and a value yielded by the iterable argument. enumerate is useful\n" ! "for obtaining an indexed list: (0, seq[0]), (1, seq[1]), (2, seq[2]), ..."); PyTypeObject PyEnum_Type = { From jhylton@users.sourceforge.net Mon Apr 21 23:04:49 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 21 Apr 2003 15:04:49 -0700 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20082 Modified Files: trace.py Log Message: Holistic refactoring. Remove "." in coverage output for lines with comments. Silence complaints in coverage output about unexecuted docstrings. Eliminate use of inspect module in favor of direct access to frame and code objects. We're in a trace function here: Efficiency counts! Remove unused code. Reflow long lines. Remove backwards compatibility for stored trace output from Zooko's experiment to add calledfuncs to the pickled dict. Move code to generate per-file coverage stats to a separate routine. Replace use of parser module with call to compile. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** trace.py 27 Feb 2003 20:14:43 -0000 1.3 --- trace.py 21 Apr 2003 22:04:46 -0000 1.4 *************** *** 43,50 **** # make a report, telling it where you want output r = trace.results() ! r.write_results(show_missing=1) """ ! import sys, os, tempfile, types, copy, operator, inspect, exceptions, marshal try: import cPickle --- 43,58 ---- # make a report, telling it where you want output r = trace.results() ! r.write_results(show_missing=True) """ ! import linecache ! import marshal ! import os ! import re ! import sys ! import token ! import tokenize ! import types ! try: import cPickle *************** *** 53,58 **** import pickle - # DEBUG_MODE=1 # make this true to get printouts which help you understand what's going on - def usage(outfile): outfile.write("""Usage: %s [OPTIONS] [ARGS] --- 61,64 ---- *************** *** 92,95 **** --- 98,106 ---- """ % sys.argv[0]) + PRAGMA_NOCOVER = "#pragma NO COVER" + + # Simple rx to find lines with no code. + rx_blank = re.compile(r'^\s*(#.*)?$') + class Ignore: def __init__(self, modules = None, dirs = None): *************** *** 145,148 **** --- 156,165 ---- return 0 + def modname(path): + """Return a plausible module name for the patch.""" + base = os.path.basename(path) + filename, ext = os.path.splitext(base) + return filename + class CoverageResults: def __init__(self, counts=None, calledfuncs=None, infile=None, *************** *** 159,178 **** self.outfile = outfile if self.infile: ! # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) ! if type(thingie) is types.DictType: ! # backwards compatibility for old trace.py after ! # Zooko touched it but before calledfuncs --Zooko ! # 2001-10-24 self.update(self.__class__(thingie)) ! elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) ! except (IOError, EOFError): ! pass except pickle.UnpicklingError: - # backwards compatibility for old trace.py before - # Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile)))) --- 176,192 ---- self.outfile = outfile if self.infile: ! # Try and merge existing counts file. ! # This code understand a couple of old trace.py formats. try: thingie = pickle.load(open(self.infile, 'r')) ! if isinstance(thingie, dict): self.update(self.__class__(thingie)) ! elif isinstance(thingie, tuple) and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) ! except (IOError, EOFError), err: ! print >> sys.stderr, ("Skipping counts file %r: %s" ! % (self.infile, err)) except pickle.UnpicklingError: self.update(self.__class__(marshal.load(open(self.infile)))) *************** *** 185,198 **** for key in other_counts.keys(): ! if key != 'calledfuncs': ! # backwards compatibility for abortive attempt to ! # stuff calledfuncs into self.counts, by Zooko ! # --Zooko 2001-10-24 ! counts[key] = counts.get(key, 0) + other_counts[key] for key in other_calledfuncs.keys(): calledfuncs[key] = 1 ! def write_results(self, show_missing = 1, summary = 0, coverdir = None): """ @param coverdir --- 199,208 ---- for key in other_counts.keys(): ! counts[key] = counts.get(key, 0) + other_counts[key] for key in other_calledfuncs.keys(): calledfuncs[key] = 1 ! def write_results(self, show_missing=True, summary=False, coverdir=None): """ @param coverdir *************** *** 202,324 **** % (filename, modulename, funcname)) - import re # turn the counts data ("(filename, lineno) = count") into something # accessible on a per-file basis per_file = {} ! for thingie in self.counts.keys(): ! if thingie != "calledfuncs": ! # backwards compatibility for abortive attempt to ! # stuff calledfuncs into self.counts, by Zooko --Zooko ! # 2001-10-24 ! filename, lineno = thingie ! lines_hit = per_file[filename] = per_file.get(filename, {}) ! lines_hit[lineno] = self.counts[(filename, lineno)] ! ! # there are many places where this is insufficient, like a blank ! # line embedded in a multiline string. ! blank = re.compile(r'^\s*(#.*)?$') # accumulate summary info, if needed sums = {} ! # generate file paths for the coverage files we are going to write... ! fnlist = [] ! tfdir = tempfile.gettempdir() ! for key in per_file.keys(): ! filename = key ! # skip some "files" we don't care about... if filename == "": continue ! # are these caused by code compiled using exec or something? ! if filename.startswith(tfdir): ! continue ! ! modulename = inspect.getmodulename(filename) if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] ! if coverdir: ! thiscoverdir = coverdir ! else: ! thiscoverdir = os.path.dirname(os.path.abspath(filename)) ! ! # the code from here to "<<<" is the contents of the `fileutil.make_dirs()' function in the Mojo Nation project. --Zooko 2001-10-14 ! # http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mojonation/evil/common/fileutil.py?rev=HEAD&content-type=text/vnd.viewcvs-markup ! tx = None ! try: ! os.makedirs(thiscoverdir) ! except OSError, x: ! tx = x ! ! if not os.path.isdir(thiscoverdir): ! if tx: ! raise tx ! raise exceptions.IOError, "unknown error prevented creation of directory: %s" % thiscoverdir # careful not to construct an IOError with a 2-tuple, as that has a special meaning... ! # <<< ! ! # build list file name by appending a ".cover" to the module name ! # and sticking it into the specified directory ! if "." in modulename: ! # A module in a package ! finalname = modulename.split(".")[-1] ! listfilename = os.path.join(thiscoverdir, finalname + ".cover") else: ! listfilename = os.path.join(thiscoverdir, modulename + ".cover") ! ! # Get the original lines from the .py file ! try: ! lines = open(filename, 'r').readlines() ! except IOError, err: ! sys.stderr.write("trace: Could not open %s for reading because: %s - skipping\n" % (`filename`, err)) ! continue ! ! try: ! outfile = open(listfilename, 'w') ! except IOError, err: ! sys.stderr.write( ! '%s: Could not open %s for writing because: %s" \ ! "- skipping\n' % ("trace", `listfilename`, err)) ! continue # If desired, get a list of the line numbers which represent # executable content (returned as a dict for better lookup speed) if show_missing: ! executable_linenos = find_executable_linenos(filename) else: ! executable_linenos = {} ! ! n_lines = 0 ! n_hits = 0 ! lines_hit = per_file[key] ! for i in range(len(lines)): ! line = lines[i] ! ! # do the blank/comment match to try to mark more lines ! # (help the reader find stuff that hasn't been covered) ! if lines_hit.has_key(i+1): ! # count precedes the lines that we captured ! outfile.write('%5d: ' % lines_hit[i+1]) ! n_hits = n_hits + 1 ! n_lines = n_lines + 1 ! elif blank.match(line): ! # blank lines and comments are preceded by dots ! outfile.write(' . ') ! else: ! # lines preceded by no marks weren't hit ! # Highlight them if so indicated, unless the line contains ! # '#pragma: NO COVER' (it is possible to embed this into ! # the text as a non-comment; no easy fix) ! if executable_linenos.has_key(i+1) and \ ! lines[i].find(' '.join(['#pragma', 'NO COVER'])) == -1: ! outfile.write('>>>>>> ') ! else: ! outfile.write(' '*7) ! n_lines = n_lines + 1 ! outfile.write(lines[i].expandtabs(8)) ! ! outfile.close() if summary and n_lines: percent = int(100 * n_hits / n_lines) --- 212,253 ---- % (filename, modulename, funcname)) # turn the counts data ("(filename, lineno) = count") into something # accessible on a per-file basis per_file = {} ! for filename, lineno in self.counts.keys(): ! lines_hit = per_file[filename] = per_file.get(filename, {}) ! lines_hit[lineno] = self.counts[(filename, lineno)] # accumulate summary info, if needed sums = {} ! for filename, count in per_file.iteritems(): # skip some "files" we don't care about... if filename == "": continue ! modulename = modname(filename) if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] ! if coverdir is None: ! dir = os.path.dirname(os.path.abspath(filename)) else: ! dir = coverdir ! if not os.path.exists(dir): ! os.makedirs(dir) # If desired, get a list of the line numbers which represent # executable content (returned as a dict for better lookup speed) if show_missing: ! lnotab = find_executable_linenos(filename) else: ! lnotab = {} + source = linecache.getlines(filename) + coverpath = os.path.join(dir, modulename + ".cover") + n_hits, n_lines = self.write_results_file(coverpath, source, + lnotab, count) + if summary and n_lines: percent = int(100 * n_hits / n_lines) *************** *** 339,404 **** open(self.outfile, 'w'), 1) except IOError, err: ! sys.stderr.write("cannot save counts files because %s" % err) ! def _find_LINENO_from_code(code): ! """return the numbers of the lines containing the source code that ! was compiled into code""" linenos = {} line_increments = [ord(c) for c in code.co_lnotab[1::2]] table_length = len(line_increments) lineno = code.co_firstlineno - for li in line_increments: - linenos[lineno] = 1 lineno += li ! linenos[lineno] = 1 return linenos ! def _find_LINENO(code): ! """return all of the lineno information from a code object""" ! import types ! # get all of the lineno information from the code of this scope level ! linenos = _find_LINENO_from_code(code) # and check the constants for references to other code objects for c in code.co_consts: ! if type(c) == types.CodeType: # find another code object, so recurse into it ! linenos.update(_find_LINENO(c)) return linenos ! def find_executable_linenos(filename): ! """return a dict of the line numbers from executable statements in a file """ ! import parser assert filename.endswith('.py') ! ! prog = open(filename).read() ! ast = parser.suite(prog) ! code = parser.compileast(ast, filename) ! ! return _find_LINENO(code) ! ! ### XXX because os.path.commonprefix seems broken by my way of thinking... ! def commonprefix(dirs): ! "Given a list of pathnames, returns the longest common leading component" ! if not dirs: return '' ! n = copy.copy(dirs) ! for i in range(len(n)): ! n[i] = n[i].split(os.sep) ! prefix = n[0] ! for item in n: ! for i in range(len(prefix)): ! if prefix[:i+1] <> item[:i+1]: ! prefix = prefix[:i] ! if i == 0: return '' ! break ! return os.sep.join(prefix) class Trace: --- 268,372 ---- open(self.outfile, 'w'), 1) except IOError, err: ! print >> sys.stderr, "Can't save counts files because %s" % err ! def write_results_file(self, path, lines, lnotab, lines_hit): ! """Return a coverage results file in path.""" ! ! try: ! outfile = open(path, "w") ! except IOError, err: ! print >> sys.stderr, ("trace: Could not open %r for writing: %s" ! "- skipping" % (path, err)) ! return ! ! n_lines = 0 ! n_hits = 0 ! for i, line in enumerate(lines): ! lineno = i + 1 ! # do the blank/comment match to try to mark more lines ! # (help the reader find stuff that hasn't been covered) ! if lineno in lines_hit: ! outfile.write("%5d: " % lines_hit[lineno]) ! n_hits += 1 ! n_lines += 1 ! elif rx_blank.match(line): ! outfile.write(" ") ! else: ! # lines preceded by no marks weren't hit ! # Highlight them if so indicated, unless the line contains ! # #pragma: NO COVER ! if lineno in lnotab and not PRAGMA_NOCOVER in lines[i]: ! outfile.write(">>>>>> ") ! else: ! outfile.write(" ") ! n_lines += 1 ! outfile.write(lines[i].expandtabs(8)) ! outfile.close() ! ! return n_hits, n_lines ! ! def find_lines_from_code(code, strs): ! """Return dict where keys are lines in the line number table.""" linenos = {} line_increments = [ord(c) for c in code.co_lnotab[1::2]] table_length = len(line_increments) + docstring = False lineno = code.co_firstlineno for li in line_increments: lineno += li ! if lineno not in strs: ! linenos[lineno] = 1 return linenos ! def find_lines(code, strs): ! """Return lineno dict for all code objects reachable from code.""" # get all of the lineno information from the code of this scope level ! linenos = find_lines_from_code(code, strs) # and check the constants for references to other code objects for c in code.co_consts: ! if isinstance(c, types.CodeType): # find another code object, so recurse into it ! linenos.update(find_lines(c, strs)) return linenos ! def find_strings(filename): ! """Return a dict of possible docstring positions. + The dict maps line numbers to strings. There is an entry for + line that contains only a string or a part of a triple-quoted + string. """ ! d = {} ! # If the first token is a string, then it's the module docstring. ! # Add this special case so that the test in the loop passes. ! prev_ttype = token.INDENT ! f = open(filename) ! for ttype, tstr, start, end, line in tokenize.generate_tokens(f.readline): ! if ttype == token.STRING: ! if prev_ttype == token.INDENT: ! sline, scol = start ! eline, ecol = end ! for i in range(sline, eline + 1): ! d[i] = 1 ! prev_ttype = ttype ! f.close() ! return d + def find_executable_linenos(filename): + """Return dict where keys are line numbers in the line number table.""" assert filename.endswith('.py') ! try: ! prog = open(filename).read() ! except IOError, err: ! print >> sys.stderr, ("Not printing coverage data for %r: %s" ! % (filename, err)) ! return {} ! code = compile(prog, filename, "exec") ! strs = find_strings(filename) ! return find_lines(code, strs) class Trace: *************** *** 479,503 **** def globaltrace_countfuncs(self, frame, why, arg): ! """ ! Handles `call' events (why == 'call') and adds the (filename, modulename, funcname,) to the self._calledfuncs dict. """ if why == 'call': ! filename, lineno, funcname, context, lineindex = \ ! inspect.getframeinfo(frame, 0) if filename: ! modulename = inspect.getmodulename(filename) else: modulename = None ! self._calledfuncs[(filename, modulename, funcname,)] = 1 def globaltrace_lt(self, frame, why, arg): ! """ ! Handles `call' events (why == 'call') and if the code block being entered is to be ignored then it returns `None', else it returns `self.localtrace'. """ if why == 'call': ! filename, lineno, funcname, context, lineindex = \ ! inspect.getframeinfo(frame, 0) if filename: ! modulename = inspect.getmodulename(filename) if modulename is not None: ignore_it = self.ignore.names(filename, modulename) --- 447,475 ---- def globaltrace_countfuncs(self, frame, why, arg): ! """Handler for call events. ! ! Adds (filename, modulename, funcname) to the self._calledfuncs dict. """ if why == 'call': ! code = frame.f_code ! filename = code.co_filename ! funcname = code.co_name if filename: ! modulename = modname(filename) else: modulename = None ! self._calledfuncs[(filename, modulename, funcname)] = 1 def globaltrace_lt(self, frame, why, arg): ! """Handler for call events. ! ! If the code block being entered is to be ignored, returns `None', ! else returns self.localtrace. """ if why == 'call': ! code = frame.f_code ! filename = code.co_filename if filename: ! modulename = modname(filename) if modulename is not None: ignore_it = self.ignore.names(filename, modulename) *************** *** 505,578 **** if self.trace: print (" --- modulename: %s, funcname: %s" ! % (modulename, funcname)) return self.localtrace else: - # XXX why no filename? return None def localtrace_trace_and_count(self, frame, why, arg): ! if why == 'line': # record the file name and line number of every trace ! # XXX I wish inspect offered me an optimized ! # `getfilename(frame)' to use in place of the presumably ! # heavier `getframeinfo()'. --Zooko 2001-10-14 ! ! filename, lineno, funcname, context, lineindex = \ ! inspect.getframeinfo(frame, 1) key = filename, lineno self.counts[key] = self.counts.get(key, 0) + 1 ! # XXX not convinced that this memoizing is a performance ! # win -- I don't know enough about Python guts to tell. ! # --Zooko 2001-10-14 ! ! bname = self.pathtobasename.get(filename) ! if bname is None: ! ! # Using setdefault faster than two separate lines? ! # --Zooko 2001-10-14 ! bname = self.pathtobasename.setdefault(filename, ! os.path.basename(filename)) ! try: ! print "%s(%d): %s" % (bname, lineno, context[lineindex]), ! except IndexError: ! # Uh.. sometimes getframeinfo gives me a context of ! # length 1 and a lineindex of -2. Oh well. ! pass return self.localtrace def localtrace_trace(self, frame, why, arg): ! if why == 'line': ! # XXX shouldn't do the count increment when arg is ! # exception? But be careful to return self.localtrace ! # when arg is exception! ? --Zooko 2001-10-14 ! ! # record the file name and line number of every trace XXX ! # I wish inspect offered me an optimized ! # `getfilename(frame)' to use in place of the presumably ! # heavier `getframeinfo()'. --Zooko 2001-10-14 ! filename, lineno, funcname, context, lineindex = \ ! inspect.getframeinfo(frame) ! # XXX not convinced that this memoizing is a performance ! # win -- I don't know enough about Python guts to tell. ! # --Zooko 2001-10-14 ! bname = self.pathtobasename.get(filename) ! if bname is None: ! # Using setdefault faster than two separate lines? ! # --Zooko 2001-10-14 ! bname = self.pathtobasename.setdefault(filename, os.path.basename(filename)) ! if context is not None: ! try: ! print "%s(%d): %s" % (bname, lineno, context[lineindex]), ! except IndexError: ! # Uh.. sometimes getframeinfo gives me a context of length 1 and a lineindex of -2. Oh well. ! pass ! else: ! print "%s(???): ???" % bname return self.localtrace def localtrace_count(self, frame, why, arg): ! if why == 'line': filename = frame.f_code.co_filename lineno = frame.f_lineno --- 477,511 ---- if self.trace: print (" --- modulename: %s, funcname: %s" ! % (modulename, code.co_name)) return self.localtrace else: return None def localtrace_trace_and_count(self, frame, why, arg): ! if why == "line": # record the file name and line number of every trace ! filename = frame.f_code.co_filename ! lineno = frame.f_lineno key = filename, lineno self.counts[key] = self.counts.get(key, 0) + 1 ! bname = os.path.basename(filename) ! print "%s(%d): %s" % (bname, lineno, ! linecache.getline(filename, lineno)), return self.localtrace def localtrace_trace(self, frame, why, arg): ! if why == "line": ! # record the file name and line number of every trace ! filename = frame.f_code.co_filename ! lineno = frame.f_lineno ! bname = os.path.basename(filename) ! print "%s(%d): %s" % (bname, lineno, ! linecache.getline(filename, lineno)), return self.localtrace def localtrace_count(self, frame, why, arg): ! if why == "line": filename = frame.f_code.co_filename lineno = frame.f_lineno *************** *** 691,695 **** if not count and not trace and not report and not listfuncs: ! _err_exit("must specify one of --trace, --count, --report or --listfuncs") if report and no_report: --- 624,629 ---- if not count and not trace and not report and not listfuncs: ! _err_exit("must specify one of --trace, --count, --report or " ! "--listfuncs") if report and no_report: *************** *** 717,721 **** t.run('execfile(' + `progname` + ')') except IOError, err: ! _err_exit("Cannot run file %s because: %s" % (`sys.argv[0]`, err)) except SystemExit: pass --- 651,655 ---- t.run('execfile(' + `progname` + ')') except IOError, err: ! _err_exit("Cannot run file %r because: %s" % (sys.argv[0], err)) except SystemExit: pass From jhylton@users.sourceforge.net Mon Apr 21 23:49:20 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 21 Apr 2003 15:49:20 -0700 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4719 Modified Files: trace.py Log Message: Add helper function to get module name taking packages into account. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** trace.py 21 Apr 2003 22:04:46 -0000 1.4 --- trace.py 21 Apr 2003 22:49:17 -0000 1.5 *************** *** 158,165 **** --- 158,184 ---- def modname(path): """Return a plausible module name for the patch.""" + base = os.path.basename(path) filename, ext = os.path.splitext(base) return filename + def fullmodname(path): + """Return a plausible module name for the patch.""" + + # If the file 'path' is part of a package, then the filename isn't + # enough to uniquely identify it. Try to do the right thing by + # looking in sys.path for the longest matching prefix. We'll + # assume that the rest is the package name. + + longest = "" + for dir in sys.path: + if path.startswith(dir) and path[len(dir)] == os.path.sep: + if len(dir) > len(longest): + longest = dir + + base = path[len(longest) + 1:].replace("/", ".") + filename, ext = os.path.splitext(base) + return filename + class CoverageResults: def __init__(self, counts=None, calledfuncs=None, infile=None, *************** *** 226,230 **** if filename == "": continue ! modulename = modname(filename) if filename.endswith(".pyc") or filename.endswith(".pyo"): --- 245,249 ---- if filename == "": continue ! modulename = fullmodname(filename) if filename.endswith(".pyc") or filename.endswith(".pyo"): *************** *** 471,474 **** --- 490,495 ---- filename = code.co_filename if filename: + # XXX modname() doesn't work right for packages, so + # the ignore support won't work right for packages modulename = modname(filename) if modulename is not None: From nnorwitz@users.sourceforge.net Tue Apr 22 02:29:01 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 21 Apr 2003 18:29:01 -0700 Subject: [Python-checkins] python/dist/src/Modules _testcapimodule.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv27510/Modules Modified Files: _testcapimodule.c Log Message: Get test_capi & test_getargs2 to pass on alphas * UINT_MAX -> ULONG_MAX since we are dealing with longs * ParseTuple needs &int for 'i' and &long for 'l' There may be a better way to do this, but this works. Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** _testcapimodule.c 19 Apr 2003 15:41:47 -0000 1.22 --- _testcapimodule.c 22 Apr 2003 01:28:57 -0000 1.23 *************** *** 320,324 **** PyObject *ob, *result = NULL, *argtuple; char *fmt; - long value = 0; if (!PyArg_ParseTuple(args, "sO", &fmt, &ob)) --- 320,323 ---- *************** *** 327,332 **** Py_INCREF(ob); PyTuple_SET_ITEM(argtuple, 0, ob); ! if (PyArg_ParseTuple(argtuple, fmt, &value)) ! result = PyLong_FromLong(value); Py_DECREF(argtuple); return result; --- 326,345 ---- Py_INCREF(ob); PyTuple_SET_ITEM(argtuple, 0, ob); ! /* It's necessary to distinguish between ints and longs, since ! sizeof(int) != sizeof(long) on some (64 bit) platforms. ! value must be an int for: PyArg_ParseTuple(t, 'i', &value) ! value must be an long for: PyArg_ParseTuple(t, 'l', &value) ! */ ! if (*fmt == 'i') { ! int value; ! if (PyArg_ParseTuple(argtuple, fmt, &value)) ! result = PyLong_FromLong(value); ! } else if (*fmt == 'l') { ! long value; ! if (PyArg_ParseTuple(argtuple, fmt, &value)) ! result = PyLong_FromLong(value); ! } else { ! PyErr_SetString(PyExc_TypeError, "format was not i or l"); ! } Py_DECREF(argtuple); return result; *************** *** 385,389 **** return NULL; ! /* a number larger than UINT_MAX even on 64-bit platforms */ num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) --- 398,402 ---- return NULL; ! /* a number larger than ULONG_MAX even on 64-bit platforms */ num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) *************** *** 391,395 **** value = PyInt_AsUnsignedLongMask(num); ! if (value != UINT_MAX) return raiseTestError("test_k_code", "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); --- 404,408 ---- value = PyInt_AsUnsignedLongMask(num); ! if (value != ULONG_MAX) return raiseTestError("test_k_code", "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); *************** *** 400,404 **** if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0) return NULL; ! if (value != UINT_MAX) return raiseTestError("test_k_code", "k code returned wrong value for long 0xFFF...FFF"); --- 413,417 ---- if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0) return NULL; ! if (value != ULONG_MAX) return raiseTestError("test_k_code", "k code returned wrong value for long 0xFFF...FFF"); From aimacintyre@users.sourceforge.net Tue Apr 22 04:21:46 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 21 Apr 2003 20:21:46 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx dlfcn.c,1.1,1.2 dlfcn.h,1.1,1.2 dllentry.c,1.3,1.4 getpathp.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv7070 Modified Files: dlfcn.c dlfcn.h dllentry.c getpathp.c Log Message: minor cleanups and whitespace normalisation Index: dlfcn.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/dlfcn.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dlfcn.c 17 Feb 2002 05:23:30 -0000 1.1 --- dlfcn.c 22 Apr 2003 03:21:42 -0000 1.2 *************** *** 30,37 **** ******************************************************************/ ! /* ! This library implements dlopen() - functions for OS/2 using ! DosLoadModule() and company. ! */ #define INCL_DOS --- 30,36 ---- ******************************************************************/ ! /* This library implements dlopen() - Unix-like dynamic linking ! * emulation functions for OS/2 using DosLoadModule() and company. ! */ #define INCL_DOS *************** *** 47,52 **** #include - /*-------------------------------------- Unix-like dynamic linking emulation -*/ - typedef struct _track_rec { char *name; --- 46,49 ---- *************** *** 56,61 **** } tDLLchain, *DLLchain; ! static DLLchain dlload = NULL; /* A simple chained list of DLL names */ ! static char dlerr [256]; /* last error text string */ static void *last_id; --- 53,58 ---- } tDLLchain, *DLLchain; ! static DLLchain dlload = NULL; /* A simple chained list of DLL names */ ! static char dlerr [256]; /* last error text string */ static void *last_id; *************** *** 66,76 **** for (tmp = dlload; tmp; tmp = tmp->next) if (id == tmp->id) ! return (tmp); ! return (NULL); } /* load a dynamic-link library and return handle */ ! void *dlopen (char *filename, int flags) { HMODULE hm; --- 63,73 ---- for (tmp = dlload; tmp; tmp = tmp->next) if (id == tmp->id) ! return tmp; ! return NULL; } /* load a dynamic-link library and return handle */ ! void *dlopen(char *filename, int flags) { HMODULE hm; *************** *** 86,93 **** if (!tmp) { ! tmp = (DLLchain)malloc (sizeof (tDLLchain)); if (!tmp) goto nomem; ! tmp->name = strdup (filename); tmp->next = dlload; set_chain = 1; --- 83,90 ---- if (!tmp) { ! tmp = (DLLchain) malloc(sizeof(tDLLchain)); if (!tmp) goto nomem; ! tmp->name = strdup(filename); tmp->next = dlload; set_chain = 1; *************** *** 98,109 **** case NO_ERROR: tmp->handle = hm; ! if (set_chain) { ! do { last_id++; ! } while ((last_id == 0) || (find_id(last_id))); tmp->id = last_id; dlload = tmp; } ! return (tmp->id); case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: --- 95,107 ---- case NO_ERROR: tmp->handle = hm; ! if (set_chain) ! { ! do last_id++; ! while ((last_id == 0) || (find_id(last_id))); tmp->id = last_id; dlload = tmp; } ! return tmp->id; case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: *************** *** 146,160 **** break; } ! snprintf (dlerr, sizeof (dlerr), errtxt, &err, rc); ! if (tmp) { if (tmp->name) free(tmp->name); ! free (tmp); } ! return (0); } /* return a pointer to the `symbol' in DLL */ ! void *dlsym (void *handle, char *symbol) { int rc = 0; --- 144,159 ---- break; } ! snprintf(dlerr, sizeof(dlerr), errtxt, &err, rc); ! if (tmp) ! { if (tmp->name) free(tmp->name); ! free(tmp); } ! return 0; } /* return a pointer to the `symbol' in DLL */ ! void *dlsym(void *handle, char *symbol) { int rc = 0; *************** *** 162,166 **** char *errtxt; int symord = 0; ! DLLchain tmp = find_id (handle); if (!tmp) --- 161,165 ---- char *errtxt; int symord = 0; ! DLLchain tmp = find_id(handle); if (!tmp) *************** *** 168,177 **** if (*symbol == '#') ! symord = atoi (symbol + 1); switch (rc = DosQueryProcAddr(tmp->handle, symord, symbol, &addr)) { case NO_ERROR: ! return ((void *)addr); case ERROR_INVALID_HANDLE: inv_handle: --- 167,176 ---- if (*symbol == '#') ! symord = atoi(symbol + 1); switch (rc = DosQueryProcAddr(tmp->handle, symord, symbol, &addr)) { case NO_ERROR: ! return (void *)addr; case ERROR_INVALID_HANDLE: inv_handle: *************** *** 186,218 **** break; } ! snprintf (dlerr, sizeof (dlerr), errtxt, symbol, rc); ! return (NULL); } /* free dynamicaly-linked library */ ! int dlclose (void *handle) { int rc; ! DLLchain tmp = find_id (handle); if (!tmp) goto inv_handle; ! switch (rc = DosFreeModule (tmp->handle)) { case NO_ERROR: ! free (tmp->name); dlload = tmp->next; ! free (tmp); ! return (0); case ERROR_INVALID_HANDLE: inv_handle: strcpy(dlerr, "invalid module handle"); ! return (-1); case ERROR_INVALID_ACCESS: ! strcpy (dlerr, "access denied"); ! return (-1); default: ! return (-1); } } --- 185,217 ---- break; } ! snprintf(dlerr, sizeof(dlerr), errtxt, symbol, rc); ! return NULL; } /* free dynamicaly-linked library */ ! int dlclose(void *handle) { int rc; ! DLLchain tmp = find_id(handle); if (!tmp) goto inv_handle; ! switch (rc = DosFreeModule(tmp->handle)) { case NO_ERROR: ! free(tmp->name); dlload = tmp->next; ! free(tmp); ! return 0; case ERROR_INVALID_HANDLE: inv_handle: strcpy(dlerr, "invalid module handle"); ! return -1; case ERROR_INVALID_ACCESS: ! strcpy(dlerr, "access denied"); ! return -1; default: ! return -1; } } *************** *** 221,224 **** char *dlerror() { ! return (dlerr); } --- 220,223 ---- char *dlerror() { ! return dlerr; } Index: dlfcn.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/dlfcn.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dlfcn.h 17 Feb 2002 05:23:30 -0000 1.1 --- dlfcn.h 22 Apr 2003 03:21:42 -0000 1.2 *************** *** 30,48 **** ******************************************************************/ ! /* ! This library implements dlopen() - functions for OS/2 using ! DosLoadModule() and company. ! */ #ifndef _DLFCN_H #define _DLFCN_H - /*-------------------------------------- Unix-like dynamic linking emulation -*/ /* load a dynamic-link library and return handle */ ! void *dlopen (char *filename, int flags); /* return a pointer to the `symbol' in DLL */ ! void *dlsym (void *handle, char *symbol); /* free dynamicaly-linked library */ ! int dlclose (void *handle); /* return a string describing last occured dl error */ char *dlerror(void); --- 30,49 ---- ******************************************************************/ ! /* This library implements dlopen() - Unix-like dynamic linking ! * emulation functions for OS/2 using DosLoadModule() and company. ! */ #ifndef _DLFCN_H #define _DLFCN_H /* load a dynamic-link library and return handle */ ! void *dlopen(char *filename, int flags); ! /* return a pointer to the `symbol' in DLL */ ! void *dlsym(void *handle, char *symbol); ! /* free dynamicaly-linked library */ ! int dlclose(void *handle); ! /* return a string describing last occured dl error */ char *dlerror(void); Index: dllentry.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/dllentry.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dllentry.c 31 Dec 2002 11:23:50 -0000 1.3 --- dllentry.c 22 Apr 2003 03:21:42 -0000 1.4 *************** *** 1,39 **** /* ! This is the entry point for Python DLL(s). ! It also provides an getenv() function that works from within DLLs. ! */ #define NULL 0 ! /* Make references to imported symbols to pull them from static library */ ! #define REF(s) extern void s (); void *____ref_##s = &s; ! REF (Py_Main); #include ! extern int _CRT_init (void); ! extern void _CRT_term (void); ! extern void __ctordtorInit (void); ! extern void __ctordtorTerm (void); ! unsigned long _DLL_InitTerm (unsigned long mod_handle, unsigned long flag) { switch (flag) { case 0: ! if (_CRT_init ()) return 0; ! __ctordtorInit (); /* Ignore fatal signals */ ! signal (SIGSEGV, SIG_IGN); ! signal (SIGFPE, SIG_IGN); return 1; case 1: ! __ctordtorTerm (); ! _CRT_term (); return 1; --- 1,38 ---- /* ! * This is the entry point for the Python 2.3 core DLL. ! */ #define NULL 0 ! #define REF(s) extern void s(); void *____ref_##s = &s; ! /* Make references to imported symbols to pull them from static library */ ! REF(Py_Main); #include ! extern int _CRT_init(void); ! extern void _CRT_term(void); ! extern void __ctordtorInit(void); ! extern void __ctordtorTerm(void); ! unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag) { switch (flag) { case 0: ! if (_CRT_init()) return 0; ! __ctordtorInit(); /* Ignore fatal signals */ ! signal(SIGSEGV, SIG_IGN); ! signal(SIGFPE, SIG_IGN); return 1; case 1: ! __ctordtorTerm(); ! _CRT_term(); return 1; Index: getpathp.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/getpathp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** getpathp.c 2 Jan 2003 12:41:58 -0000 1.2 --- getpathp.c 22 Apr 2003 03:21:42 -0000 1.3 *************** *** 95,101 **** } ! /* assumes 'dir' null terminated in bounds. Never writes ! beyond existing terminator. ! */ static void reduce(char *dir) --- 95,101 ---- } ! /* assumes 'dir' null terminated in bounds. ! * Never writes beyond existing terminator. ! */ static void reduce(char *dir) *************** *** 114,122 **** } ! /* Assumes 'filename' MAXPATHLEN+1 bytes long - ! may extend 'filename' by one character. ! */ static int ! ismodule(char *filename) /* Is module -- check for .pyc/.pyo too */ { if (exists(filename)) --- 114,123 ---- } ! /* Is module (check for .pyc/.pyo too) ! * Assumes 'filename' MAXPATHLEN+1 bytes long - ! * may extend 'filename' by one character. ! */ static int ! ismodule(char *filename) { if (exists(filename)) *************** *** 152,158 **** /* gotlandmark only called by search_for_prefix, which ensures ! 'prefix' is null terminated in bounds. join() ensures ! 'landmark' can not overflow prefix if too long. ! */ static int gotlandmark(char *landmark) --- 153,159 ---- /* gotlandmark only called by search_for_prefix, which ensures ! * 'prefix' is null terminated in bounds. join() ensures ! * 'landmark' can not overflow prefix if too long. ! */ static int gotlandmark(char *landmark) *************** *** 168,172 **** /* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd. ! assumption provided by only caller, calculate_path() */ static int search_for_prefix(char *argv0_path, char *landmark) --- 169,174 ---- /* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd. ! * assumption provided by only caller, calculate_path() ! */ static int search_for_prefix(char *argv0_path, char *landmark) *************** *** 284,294 **** /* We need to construct a path from the following parts. ! (1) the PYTHONPATH environment variable, if set; ! (2) the zip archive file path; ! (3) the PYTHONPATH config macro, with the leading "." ! of each component replaced with pythonhome, if set; ! (4) the directory containing the executable (argv0_path). ! The length calculation calculates #3 first. ! */ /* Calculate size of return buffer */ --- 286,296 ---- /* We need to construct a path from the following parts. ! * (1) the PYTHONPATH environment variable, if set; ! * (2) the zip archive file path; ! * (3) the PYTHONPATH config macro, with the leading "." ! * of each component replaced with pythonhome, if set; ! * (4) the directory containing the executable (argv0_path). ! * The length calculation calculates #3 first. ! */ /* Calculate size of return buffer */ From rhettinger@users.sourceforge.net Tue Apr 22 07:49:11 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 21 Apr 2003 23:49:11 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.737,1.738 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv4294/Misc Modified Files: NEWS Log Message: Improved the bytecode optimizer. * Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.737 retrieving revision 1.738 diff -C2 -d -r1.737 -r1.738 *** NEWS 19 Apr 2003 20:59:03 -0000 1.737 --- NEWS 22 Apr 2003 06:49:08 -0000 1.738 *************** *** 295,298 **** --- 295,305 ---- will be backported to Python 2.2.3 a well. (SF #660455) + - Added several bytecode optimizations. Provides speed-ups to + inverted in/is tests, inverted jumps, while 1 loops, and jumps to + unconditional jumps. + + - Added a new opcode, NOP, which is used in some of the bytecode + transformations. + - int(s, base) sometimes sign-folds hex and oct constants; it only does this when base is 0 and s.strip() starts with a '0'. When the From rhettinger@users.sourceforge.net Tue Apr 22 07:49:11 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 21 Apr 2003 23:49:11 -0700 Subject: [Python-checkins] python/dist/src/Include opcode.h,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv4294/Include Modified Files: opcode.h Log Message: Improved the bytecode optimizer. * Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure. Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** opcode.h 30 Aug 2002 13:09:49 -0000 2.41 --- opcode.h 22 Apr 2003 06:49:09 -0000 2.42 *************** *** 15,18 **** --- 15,20 ---- #define ROT_FOUR 5 + #define NOP 9 + #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 From rhettinger@users.sourceforge.net Tue Apr 22 07:49:13 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 21 Apr 2003 23:49:13 -0700 Subject: [Python-checkins] python/dist/src/Lib opcode.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4294/Lib Modified Files: opcode.py Log Message: Improved the bytecode optimizer. * Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure. Index: opcode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/opcode.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opcode.py 27 Feb 2003 21:27:52 -0000 1.1 --- opcode.py 22 Apr 2003 06:49:11 -0000 1.2 *************** *** 50,53 **** --- 50,55 ---- def_op('ROT_FOUR', 5) + def_op('NOP', 9) + def_op('UNARY_POSITIVE', 10) def_op('UNARY_NEGATIVE', 11) From rhettinger@users.sourceforge.net Tue Apr 22 07:49:13 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 21 Apr 2003 23:49:13 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.359,2.360 compile.c,2.279,2.280 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv4294/Python Modified Files: ceval.c compile.c Log Message: Improved the bytecode optimizer. * Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.359 retrieving revision 2.360 diff -C2 -d -r2.359 -r2.360 *** ceval.c 19 Apr 2003 15:41:48 -0000 2.359 --- ceval.c 22 Apr 2003 06:49:09 -0000 2.360 *************** *** 874,877 **** --- 874,880 ---- /* case STOP_CODE: this is an error! */ + case NOP: + goto fast_next_opcode; + case LOAD_FAST: x = GETLOCAL(oparg); Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.279 retrieving revision 2.280 diff -C2 -d -r2.279 -r2.280 *** compile.c 15 Apr 2003 10:35:07 -0000 2.279 --- compile.c 22 Apr 2003 06:49:10 -0000 2.280 *************** *** 329,332 **** --- 329,369 ---- #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3)) #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 + #define CODESIZE(op) (HAS_ARG(op) ? 3 : 1) + #define ISBASICBLOCK(blocks, start, bytes) (blocks[start]==blocks[start+bytes-1]) + + static unsigned int * + markblocks(unsigned char *code, int len) + { + unsigned int *blocks = PyMem_Malloc(len*sizeof(int)); + int i,j, opcode, oldblock, newblock, blockcnt = 0; + + if (blocks == NULL) + return NULL; + memset(blocks, 0, len*sizeof(int)); + for (i=0 ; i a is not b + not a in b --> a not in b + not a is not b --> a is b + not a not in b --> a in b */ + case COMPARE_OP: + j = GETARG(codestr, i); + if (codestr[i+3] != UNARY_NOT || j < 6 || \ + j > 9 || !ISBASICBLOCK(blocks,i,4)) + continue; + SETARG(codestr, i, (j^1)); + codestr[i+3] = NOP; + break; + /* Replace jumps to unconditional jumps */ case FOR_ITER: *************** *** 403,407 **** case SETUP_FINALLY: tgt = GETJUMPTGT(codestr, i); ! if (!UNCONDITIONAL_JUMP(codestr[tgt])) continue; tgttgt = GETJUMPTGT(codestr, tgt); --- 476,480 ---- case SETUP_FINALLY: tgt = GETJUMPTGT(codestr, i); ! if (!UNCONDITIONAL_JUMP(codestr[tgt])) continue; tgttgt = GETJUMPTGT(codestr, tgt); *************** *** 423,426 **** --- 496,500 ---- code = PyString_FromStringAndSize(codestr, codelen); PyMem_Free(codestr); + PyMem_Free(blocks); return code; From aleax@users.sourceforge.net Tue Apr 22 09:12:36 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Tue, 22 Apr 2003 01:12:36 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.288,2.289 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Python Modified Files: bltinmodule.c Log Message: Adding new built-in function sum, with docs and tests. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.288 retrieving revision 2.289 diff -C2 -d -r2.288 -r2.289 *** bltinmodule.c 15 Apr 2003 12:43:26 -0000 2.288 --- bltinmodule.c 22 Apr 2003 08:12:33 -0000 2.289 *************** *** 1799,1802 **** --- 1799,1862 ---- With an argument, equivalent to object.__dict__."); + + static PyObject* + builtin_sum(PyObject *self, PyObject *args) + { + PyObject *seq; + PyObject *result = NULL; + PyObject *temp, *item, *iter; + + if (!PyArg_ParseTuple(args, "O|O:sum", &seq, &result)) + return NULL; + + iter = PyObject_GetIter(seq); + if (iter == NULL) + return NULL; + + if (result == NULL) { + result = PyInt_FromLong(0); + if (result == NULL) { + Py_DECREF(iter); + return NULL; + } + } else { + /* reject string values for 'start' parameter */ + if (PyObject_TypeCheck(result, &PyBaseString_Type)) { + PyErr_SetString(PyExc_TypeError, + "can't sum strings [use ''.join(seq) instead]"); + Py_DECREF(result); + Py_DECREF(iter); + return NULL; + } + } + + for(;;) { + item = PyIter_Next(iter); + if (item == NULL) { + /* error, or end-of-sequence */ + if (PyErr_Occurred()) { + Py_DECREF(result); + result = NULL; + } + break; + } + temp = PyNumber_Add(result, item); + Py_DECREF(result); + Py_DECREF(item); + result = temp; + if (result == NULL) + break; + } + Py_DECREF(iter); + return result; + } + + PyDoc_STRVAR(sum_doc, + "sum(sequence, start=0) -> value\n\ + \n\ + Returns the sum of a sequence of numbers (NOT strings) plus the value\n\ + of parameter 'start'. When the sequence is empty, returns start."); + + static PyObject * builtin_isinstance(PyObject *self, PyObject *args) *************** *** 2002,2005 **** --- 2062,2066 ---- {"round", builtin_round, METH_VARARGS, round_doc}, {"setattr", builtin_setattr, METH_VARARGS, setattr_doc}, + {"sum", builtin_sum, METH_VARARGS, sum_doc}, #ifdef Py_USING_UNICODE {"unichr", builtin_unichr, METH_VARARGS, unichr_doc}, From aleax@users.sourceforge.net Tue Apr 22 09:13:00 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Tue, 22 Apr 2003 01:13:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.128,1.129 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Doc/lib Modified Files: libfuncs.tex Log Message: Adding new built-in function sum, with docs and tests. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** libfuncs.tex 31 Jan 2003 17:19:05 -0000 1.128 --- libfuncs.tex 22 Apr 2003 08:12:27 -0000 1.129 *************** *** 898,901 **** --- 898,909 ---- \end{funcdesc} + \begin{funcdesc}{sum}{sequence\optional{start=0}} + Sums up the items of a \var{sequence}, from left to right, and returns + the total. The \var{sequence}'s items are normally numbers, and are + not allowed to be strings. The fast, correct way to join up a + sequence of strings is by calling \code{''.join(\var{sequence})}. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{super}{type\optional{object-or-type}} Return the superclass of \var{type}. If the second argument is omitted From aleax@users.sourceforge.net Tue Apr 22 09:13:01 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Tue, 22 Apr 2003 01:13:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.178,1.179 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Doc/tut Modified Files: tut.tex Log Message: Adding new built-in function sum, with docs and tests. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** tut.tex 12 Mar 2003 04:46:52 -0000 1.178 --- tut.tex 22 Apr 2003 08:12:28 -0000 1.179 *************** *** 1820,1823 **** --- 1820,1826 ---- \end{verbatim} + Don't use this example's definition of \code{sum}: since summing numbers + is such a common need, a built-in function \code{sum(\var{sequence})} is + already provided, and works exactly like this\versionadded{2,3}. \subsection{List Comprehensions} *************** *** 2503,2507 **** 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'round', ! 'setattr', 'slice', 'staticmethod', 'str', 'string', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip'] \end{verbatim} --- 2506,2510 ---- 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'round', ! 'setattr', 'slice', 'staticmethod', 'str', 'string', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip'] \end{verbatim} From aleax@users.sourceforge.net Tue Apr 22 09:13:03 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Tue, 22 Apr 2003 01:13:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Lib/test Modified Files: test_builtin.py Log Message: Adding new built-in function sum, with docs and tests. Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_builtin.py 15 Apr 2003 18:59:28 -0000 1.17 --- test_builtin.py 22 Apr 2003 08:12:30 -0000 1.18 *************** *** 1100,1103 **** --- 1100,1124 ---- self.assertEqual(str(a), '{0: {...}}') + def test_sum(self): + self.assertEqual(sum([]), 0) + self.assertEqual(sum(range(2,8)), 27) + self.assertEqual(sum(iter(range(2,8))), 27) + self.assertEqual(sum(Squares(10)), 285) + self.assertEqual(sum(iter(Squares(10))), 285) + self.assertEqual(sum([[1], [2], [3]], []), [1, 2, 3]) + + self.assertRaises(TypeError, sum) + self.assertRaises(TypeError, sum, 42) + self.assertRaises(TypeError, sum, ['a', 'b', 'c']) + self.assertRaises(TypeError, sum, ['a', 'b', 'c'], '') + self.assertRaises(TypeError, sum, [[1], [2], [3]]) + self.assertRaises(TypeError, sum, [{2:3}]) + self.assertRaises(TypeError, sum, [{2:3}]*2, {2:3}) + + class BadSeq: + def __getitem__(self, index): + raise ValueError + self.assertRaises(ValueError, sum, BadSeq()) + def test_tuple(self): self.assertEqual(tuple(()), ()) From aleax@users.sourceforge.net Tue Apr 22 09:13:05 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Tue, 22 Apr 2003 01:13:05 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.738,1.739 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Misc Modified Files: NEWS Log Message: Adding new built-in function sum, with docs and tests. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.738 retrieving revision 1.739 diff -C2 -d -r1.738 -r1.739 *** NEWS 22 Apr 2003 06:49:08 -0000 1.738 --- NEWS 22 Apr 2003 08:12:31 -0000 1.739 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - New builtin function sum(seq, start=0) returns the sum of all the + items in iterable object seq, plus start (items are normally numbers, + and cannot be strings). + - bool() called without arguments now returns False rather than raising an exception. This is consistent with calling the From python@rcn.com Tue Apr 22 10:13:00 2003 From: python@rcn.com (Raymond Hettinger) Date: Tue, 22 Apr 2003 05:13:00 -0400 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.288,2.289 References: Message-ID: <000201c308af$fa849dc0$b011a044@oemcomputer> > Update of /cvsroot/python/python/dist/src/Python > In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Python > > Modified Files: > bltinmodule.c > Log Message: > Adding new built-in function sum, with docs and tests. The ref counts for "result" may be hosed. The passed-in reference is borrowed, but the one created by PyInt_FromLong() is a new reference. If one of the decrefs hits the borrowed reference, the ref count may go negative. Raymond Hettinger From aleax@users.sourceforge.net Tue Apr 22 10:24:52 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Tue, 22 Apr 2003 02:24:52 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.289,2.290 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv23424/Python Modified Files: bltinmodule.c Log Message: fixed a potential refcount bug (thanks Raymond!). Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.289 retrieving revision 2.290 diff -C2 -d -r2.289 -r2.290 *** bltinmodule.c 22 Apr 2003 08:12:33 -0000 2.289 --- bltinmodule.c 22 Apr 2003 09:24:48 -0000 2.290 *************** *** 1825,1832 **** PyErr_SetString(PyExc_TypeError, "can't sum strings [use ''.join(seq) instead]"); - Py_DECREF(result); Py_DECREF(iter); return NULL; } } --- 1825,1832 ---- PyErr_SetString(PyExc_TypeError, "can't sum strings [use ''.join(seq) instead]"); Py_DECREF(iter); return NULL; } + Py_INCREF(result); } From aleax@aleax.it Tue Apr 22 10:25:18 2003 From: aleax@aleax.it (Alex Martelli) Date: Tue, 22 Apr 2003 11:25:18 +0200 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.288,2.289 In-Reply-To: <000201c308af$fa849dc0$b011a044@oemcomputer> References: <000201c308af$fa849dc0$b011a044@oemcomputer> Message-ID: <200304221125.18945.aleax@aleax.it> On Tuesday 22 April 2003 11:13 am, Raymond Hettinger wrote: > > Update of /cvsroot/python/python/dist/src/Python > > In directory sc8-pr-cvs1:/tmp/cvs-serv22004/src/Python > > > > Modified Files: > > bltinmodule.c > > Log Message: > > Adding new built-in function sum, with docs and tests. > > The ref counts for "result" may be hosed. > The passed-in reference is borrowed, but the one > created by PyInt_FromLong() is a new reference. > If one of the decrefs hits the borrowed reference, > the ref count may go negative. Absolutely true, thanks! Fixed it and committed the fix. Alex From doerwalter@users.sourceforge.net Tue Apr 22 12:06:05 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 22 Apr 2003 04:06:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pwd.py,1.14,1.15 test_grp.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv32340/Lib/test Modified Files: test_pwd.py test_grp.py Log Message: Change test_pwd and test_grp so they can handle duplicate user and group names. This should fix SF bug #724771. Index: test_pwd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_pwd.py 15 Apr 2003 15:39:08 -0000 1.14 --- test_pwd.py 22 Apr 2003 11:05:56 -0000 1.15 *************** *** 8,11 **** --- 8,12 ---- def test_values(self): entries = pwd.getpwall() + entriesbyname = {} entriesbyuid = {} *************** *** 27,31 **** self.assert_(isinstance(e.pw_shell, basestring)) - self.assertEqual(pwd.getpwnam(e.pw_name), e) # The following won't work, because of duplicate entries # for one uid --- 28,31 ---- *************** *** 33,36 **** --- 33,37 ---- # instead of this collect all entries for one uid # and check afterwards + entriesbyname.setdefault(e.pw_name, []).append(e) entriesbyuid.setdefault(e.pw_uid, []).append(e) *************** *** 38,41 **** --- 39,43 ---- # for each uid is among those from getpwall() for this uid for e in entries: + self.assert_(pwd.getpwnam(e.pw_name) in entriesbyname[e.pw_name]) self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid]) Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_grp.py 15 Apr 2003 16:08:01 -0000 1.13 --- test_grp.py 22 Apr 2003 11:05:57 -0000 1.14 *************** *** 10,13 **** --- 10,14 ---- def test_values(self): entries = grp.getgrall() + entriesbyname = {} entriesbygid = {} *************** *** 23,32 **** self.assert_(isinstance(e.gr_mem, list)) - self.assertEqual(grp.getgrnam(e.gr_name), e) # The following won't work, because of duplicate entries # for one gid # self.assertEqual(grp.getgrgid(e.gr_gid), e) ! # instead of this collect all entries for one gid # and check afterwards entriesbygid.setdefault(e.gr_gid, []).append(e) --- 24,33 ---- self.assert_(isinstance(e.gr_mem, list)) # The following won't work, because of duplicate entries # for one gid # self.assertEqual(grp.getgrgid(e.gr_gid), e) ! # instead of this collect all entries for one gid/name # and check afterwards + entriesbyname.setdefault(e.gr_name, []).append(e) entriesbygid.setdefault(e.gr_gid, []).append(e) *************** *** 35,38 **** --- 36,40 ---- for e in entries: self.assert_(grp.getgrgid(e.gr_gid) in entriesbygid[e.gr_gid]) + self.assert_(grp.getgrnam(e.gr_name) in entriesbyname[e.gr_name]) def test_errors(self): From mhammond@users.sourceforge.net Tue Apr 22 12:18:03 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue, 22 Apr 2003 04:18:03 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.192,2.193 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv4217 Modified Files: pythonrun.c Log Message: PyGILState cleanup was too early - destructors called via module cleanup may use the API. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.192 retrieving revision 2.193 diff -C2 -d -r2.192 -r2.193 *** pythonrun.c 19 Apr 2003 18:47:02 -0000 2.192 --- pythonrun.c 22 Apr 2003 11:18:00 -0000 2.193 *************** *** 255,263 **** initialized = 0; - /* Cleanup auto-thread-state */ - #ifdef WITH_THREAD - _PyGILState_Fini(); - #endif /* WITH_THREAD */ - /* Get current thread state and interpreter pointer */ tstate = PyThreadState_Get(); --- 255,258 ---- *************** *** 310,313 **** --- 305,313 ---- */ _PyExc_Fini(); + + /* Cleanup auto-thread-state */ + #ifdef WITH_THREAD + _PyGILState_Fini(); + #endif /* WITH_THREAD */ /* Clear interpreter state */ From jackjansen@users.sourceforge.net Tue Apr 22 14:53:36 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 22 Apr 2003 06:53:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv2673 Modified Files: PackageManager.py Log Message: Hiding packages was done incorrectly. Fixed. Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PackageManager.py 16 Apr 2003 12:40:21 -0000 1.8 --- PackageManager.py 22 Apr 2003 13:53:33 -0000 1.9 *************** *** 49,57 **** USER_INSTALL_DIR = os.path.join(os.environ.get('HOME', ''), ! 'Library', ! 'Python', ! sys.version[:3], ! 'site-packages') ! class PackageManagerMain(Wapplication.Application): --- 49,57 ---- USER_INSTALL_DIR = os.path.join(os.environ.get('HOME', ''), ! 'Library', ! 'Python', ! sys.version[:3], ! 'site-packages') ! class PackageManagerMain(Wapplication.Application): *************** *** 205,209 **** rv = window.close() # ignore any errors while quitting except: ! rv = 0 # (otherwise, we can get stuck!) if rv and rv > 0: return --- 205,209 ---- rv = window.close() # ignore any errors while quitting except: ! rv = 0 # (otherwise, we can get stuck!) if rv and rv > 0: return *************** *** 271,280 **** def getbrowserdata(self, show_hidden=1): ! self.packages = self.pimpdb.list() rv = [] for pkg in self.packages: name = pkg.fullname() - if name[0] == '(' and name[-1] == ')' and not show_hidden: - continue status, _ = pkg.installed() description = pkg.description() --- 271,287 ---- def getbrowserdata(self, show_hidden=1): ! packages = self.pimpdb.list() ! if show_hidden: ! self.packages = packages ! else: ! self.packages = [] ! for pkg in packages: ! name = pkg.fullname() ! if name[0] == '(' and name[-1] == ')' and not show_hidden: ! continue ! self.packages.append(pkg) rv = [] for pkg in self.packages: name = pkg.fullname() status, _ = pkg.installed() description = pkg.description() From jackjansen@users.sourceforge.net Tue Apr 22 14:55:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 22 Apr 2003 06:55:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/win _Winmodule.c,1.17,1.18 winedit.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory sc8-pr-cvs1:/tmp/cvs-serv3696 Modified Files: _Winmodule.c winedit.py Log Message: Allow setting the auto dispose flag on window objects. Index: _Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/_Winmodule.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** _Winmodule.c 23 Dec 2002 23:16:25 -0000 1.17 --- _Winmodule.c 22 Apr 2003 13:55:22 -0000 1.18 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 2301,2304 **** --- 2301,2322 ---- } + static PyObject *WinObj_AutoDispose(WindowObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + + int onoff, old = 0; + if (!PyArg_ParseTuple(_args, "i", &onoff)) + return NULL; + if ( _self->ob_freeit ) + old = 1; + if ( onoff ) + _self->ob_freeit = PyMac_AutoDisposeWindow; + else + _self->ob_freeit = NULL; + _res = Py_BuildValue("i", old); + return _res; + + } + static PyMethodDef WinObj_methods[] = { {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, *************** *** 2541,2544 **** --- 2559,2564 ---- {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, PyDoc_STR("() -> None")}, + {"AutoDispose", (PyCFunction)WinObj_AutoDispose, 1, + PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")}, {NULL, NULL, 0} }; Index: winedit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winedit.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** winedit.py 12 Dec 2002 10:31:53 -0000 1.10 --- winedit.py 22 Apr 2003 13:55:23 -0000 1.11 *************** *** 49,52 **** --- 49,71 ---- methods.append(f) + # + # A method to set the auto-dispose flag + # + AutoDispose_body = """ + int onoff, old = 0; + if (!PyArg_ParseTuple(_args, "i", &onoff)) + return NULL; + if ( _self->ob_freeit ) + old = 1; + if ( onoff ) + _self->ob_freeit = PyMac_AutoDisposeWindow; + else + _self->ob_freeit = NULL; + _res = Py_BuildValue("i", old); + return _res; + """ + f = ManualGenerator("AutoDispose", AutoDispose_body) + f.docstring = lambda: "(int)->int. Automatically DisposeHandle the object on Python object cleanup" + methods.append(f) From jackjansen@users.sourceforge.net Tue Apr 22 14:56:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 22 Apr 2003 06:56:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv4035 Modified Files: pimp.py Log Message: Only return a warning message about not all files being unpacked if there were indeed files that weren't unpacked. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pimp.py 16 Apr 2003 12:15:34 -0000 1.17 --- pimp.py 22 Apr 2003 13:56:19 -0000 1.18 *************** *** 132,136 **** if skip: names = [member.name for member in skip if member.name[-1] != '/'] ! return "Not all files were unpacked: %s" % " ".join(names) ARCHIVE_FORMATS = [ --- 132,137 ---- if skip: names = [member.name for member in skip if member.name[-1] != '/'] ! if names: ! return "Not all files were unpacked: %s" % " ".join(names) ARCHIVE_FORMATS = [ From fdrake@users.sourceforge.net Tue Apr 22 15:30:58 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 22 Apr 2003 07:30:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.179,1.180 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv21917 Modified Files: tut.tex Log Message: Fix some markup nits. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.179 retrieving revision 1.180 diff -C2 -d -r1.179 -r1.180 *** tut.tex 22 Apr 2003 08:12:28 -0000 1.179 --- tut.tex 22 Apr 2003 14:30:53 -0000 1.180 *************** *** 1820,1826 **** \end{verbatim} ! Don't use this example's definition of \code{sum}: since summing numbers ! is such a common need, a built-in function \code{sum(\var{sequence})} is ! already provided, and works exactly like this\versionadded{2,3}. \subsection{List Comprehensions} --- 1820,1828 ---- \end{verbatim} ! Don't use this example's definition of \function{sum()}: since summing ! numbers is such a common need, a built-in function ! \code{sum(\var{sequence})} is already provided, and works exactly like ! this. ! \versionadded{2.3} \subsection{List Comprehensions} From jackjansen@users.sourceforge.net Tue Apr 22 15:33:52 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 22 Apr 2003 07:33:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac buildtools.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv23205 Modified Files: buildtools.py Log Message: If not icon file is specified use the default Python Applet icons. Fixes 719303. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/buildtools.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** buildtools.py 9 Apr 2003 13:25:42 -0000 1.9 --- buildtools.py 22 Apr 2003 14:33:48 -0000 1.10 *************** *** 290,293 **** --- 290,297 ---- else: plistname = None + if not icnsname: + dft_icnsname = os.path.join(sys.prefix, 'Resources/Python.app/Contents/Resources/PythonApplet.icns') + if os.path.exists(dft_icnsname): + icnsname = dft_icnsname if not os.path.exists(rsrcname): rsrcname = None From fdrake@users.sourceforge.net Tue Apr 22 15:52:11 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 22 Apr 2003 07:52:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv32576 Modified Files: libfuncs.tex Log Message: - explain the start argument to sum() - various adjustments to sum() markup and explanation Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** libfuncs.tex 22 Apr 2003 08:12:27 -0000 1.129 --- libfuncs.tex 22 Apr 2003 14:52:08 -0000 1.130 *************** *** 898,906 **** \end{funcdesc} ! \begin{funcdesc}{sum}{sequence\optional{start=0}} ! Sums up the items of a \var{sequence}, from left to right, and returns ! the total. The \var{sequence}'s items are normally numbers, and are ! not allowed to be strings. The fast, correct way to join up a ! sequence of strings is by calling \code{''.join(\var{sequence})}. \versionadded{2.3} \end{funcdesc} --- 898,907 ---- \end{funcdesc} ! \begin{funcdesc}{sum}{sequence\optional{, start}} ! Sums \var{start} and the items of a \var{sequence}, from left to ! right, and returns the total. \var{start} defaults to \code{0}. ! The \var{sequence}'s items are normally numbers, and are not allowed ! to be strings. The fast, correct way to concatenate sequence of ! strings is by calling \code{''.join(\var{sequence})}. \versionadded{2.3} \end{funcdesc} From jhylton@users.sourceforge.net Tue Apr 22 16:35:54 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 22 Apr 2003 08:35:54 -0700 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25282 Modified Files: trace.py Log Message: Only produce a dotted module name when writing output to a separate directory. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** trace.py 21 Apr 2003 22:49:17 -0000 1.5 --- trace.py 22 Apr 2003 15:35:51 -0000 1.6 *************** *** 164,168 **** def fullmodname(path): ! """Return a plausible module name for the patch.""" # If the file 'path' is part of a package, then the filename isn't --- 164,168 ---- def fullmodname(path): ! """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't *************** *** 245,249 **** if filename == "": continue - modulename = fullmodname(filename) if filename.endswith(".pyc") or filename.endswith(".pyo"): --- 245,248 ---- *************** *** 252,259 **** --- 251,260 ---- if coverdir is None: dir = os.path.dirname(os.path.abspath(filename)) + modulename = modname(filename) else: dir = coverdir if not os.path.exists(dir): os.makedirs(dir) + modulename = fullmodname(filename) # If desired, get a list of the line numbers which represent From niemeyer@users.sourceforge.net Tue Apr 22 16:39:24 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 22 Apr 2003 08:39:24 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.91,2.92 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26197/Modules Modified Files: _sre.c Log Message: Made MAX_UNTIL/MIN_UNTIL code more coherent about mark protection, accordingly to further discussions with Greg Chapman in patch #712900. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -d -r2.91 -r2.92 *** _sre.c 20 Apr 2003 07:35:44 -0000 2.91 --- _sre.c 22 Apr 2003 15:39:09 -0000 2.92 *************** *** 1162,1165 **** --- 1162,1166 ---- state->repeat = rp; state->ptr = ptr; + LASTMARK_RESTORE(); return 0; *************** *** 1172,1175 **** --- 1173,1178 ---- return SRE_ERROR_STATE; + state->ptr = ptr; + count = rp->count + 1; *************** *** 1177,1181 **** rp->pattern)); ! state->ptr = ptr; if (count < rp->pattern[1]) { --- 1180,1184 ---- rp->pattern)); ! LASTMARK_SAVE(); if (count < rp->pattern[1]) { *************** *** 1188,1196 **** rp->count = count-1; state->ptr = ptr; return 0; } - LASTMARK_SAVE(); - /* see if the tail matches */ state->repeat = rp->prev; --- 1191,1198 ---- rp->count = count-1; state->ptr = ptr; + LASTMARK_RESTORE(); return 0; } /* see if the tail matches */ state->repeat = rp->prev; *************** *** 1203,1207 **** LASTMARK_RESTORE(); - if (count >= rp->pattern[2] && rp->pattern[2] != 65535) return 0; --- 1205,1208 ---- *************** *** 1214,1217 **** --- 1215,1219 ---- rp->count = count - 1; state->ptr = ptr; + LASTMARK_RESTORE(); return 0; From fdrake@users.sourceforge.net Tue Apr 22 19:15:09 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 22 Apr 2003 11:15:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_normalization.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24728 Modified Files: test_normalization.py Log Message: Do a little more searching for the data file for the test: this allows using a build directory just inside the source directory and saving just one copy of the test data in the source tree, rather than having a copy in each build directory. Index: test_normalization.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_normalization.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_normalization.py 24 Nov 2002 19:19:09 -0000 1.5 --- test_normalization.py 22 Apr 2003 18:15:05 -0000 1.6 *************** *** 5,9 **** TESTDATAFILE = "NormalizationTest.txt" ! skip_expected = not os.path.exists(TESTDATAFILE) class RangeError: --- 5,20 ---- TESTDATAFILE = "NormalizationTest.txt" ! ! # This search allows using a build directory just inside the source ! # directory, and saving just one copy of the test data in the source ! # tree, rather than having a copy in each build directory. ! # There might be a better way to do this. ! ! for path in [os.path.curdir, os.path.pardir]: ! fn = os.path.join(path, TESTDATAFILE) ! skip_expected = not os.path.exists(fn) ! if not skip_expected: ! TESTDATAFILE = fn ! break class RangeError: From fdrake@users.sourceforge.net Tue Apr 22 19:54:57 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 22 Apr 2003 11:54:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtempfile.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14014 Modified Files: libtempfile.tex Log Message: markup corrections Index: libtempfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtempfile.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** libtempfile.tex 21 Nov 2002 16:32:11 -0000 1.20 --- libtempfile.tex 22 Apr 2003 18:54:53 -0000 1.21 *************** *** 14,20 **** In version 2.3 of Python, this module was overhauled for enhanced security. It now provides three new functions, ! \function{NamedTemporaryFile}, \function{mkstemp}, and ! \function{mkdtemp}, which should eliminate all remaining need to use ! the insecure \function{mktemp} function. Temporary file names created by this module no longer contain the process ID; instead a string of six random characters is used. --- 14,20 ---- In version 2.3 of Python, this module was overhauled for enhanced security. It now provides three new functions, ! \function{NamedTemporaryFile()}, \function{mkstemp()}, and ! \function{mkdtemp()}, which should eliminate all remaining need to use ! the insecure \function{mktemp()} function. Temporary file names created by this module no longer contain the process ID; instead a string of six random characters is used. *************** *** 40,45 **** for the file is removed immediately after the file is created. Other platforms do not support this; your code should not rely on a ! \class{TemporaryFile} having or not having a visible name in the file ! system. The \var{mode} parameter defaults to \code{'w+b'} so that the file --- 40,45 ---- for the file is removed immediately after the file is created. Other platforms do not support this; your code should not rely on a ! temporary file created using this function having or not having a ! visible name in the file system. The \var{mode} parameter defaults to \code{'w+b'} so that the file *************** *** 50,54 **** The \var{dir}, \var{prefix} and \var{suffix} parameters are passed to ! \function{mkstemp}. \end{funcdesc} --- 50,54 ---- The \var{dir}, \var{prefix} and \var{suffix} parameters are passed to ! \function{mkstemp()}. \end{funcdesc} *************** *** 58,62 **** \optional{, prefix} \optional{, dir}} ! This function operates exactly as \function{TemporaryFile} does, except that the file is guaranteed to have a visible name in the file system (on \UNIX, the directory entry is not unlinked). That name can --- 58,62 ---- \optional{, prefix} \optional{, dir}} ! This function operates exactly as \function{TemporaryFile()} does, except that the file is guaranteed to have a visible name in the file system (on \UNIX, the directory entry is not unlinked). That name can *************** *** 75,88 **** are no race conditions in the file's creation, assuming that the platform properly implements the \constant{O_EXCL} flag for ! \function{os.open}. The file is readable and writable only by the creating user ID. If the platform uses permission bits to indicate whether a file is executable, the file is executable by no one. The file descriptor is not inherited by child processes. ! Unlike \function{TemporaryFile}, the user of \function{mkstemp} is responsible for deleting the temporary file when done with it. If \var{suffix} is specified, the file name will end with that suffix, ! otherwise there will be no suffix. \function{mkstemp} does not put a dot between the file name and the suffix; if you need one, put it at the beginning of \var{suffix}. --- 75,88 ---- are no race conditions in the file's creation, assuming that the platform properly implements the \constant{O_EXCL} flag for ! \function{os.open()}. The file is readable and writable only by the creating user ID. If the platform uses permission bits to indicate whether a file is executable, the file is executable by no one. The file descriptor is not inherited by child processes. ! Unlike \function{TemporaryFile()}, the user of \function{mkstemp()} is responsible for deleting the temporary file when done with it. If \var{suffix} is specified, the file name will end with that suffix, ! otherwise there will be no suffix. \function{mkstemp()} does not put a dot between the file name and the suffix; if you need one, put it at the beginning of \var{suffix}. *************** *** 98,103 **** no difference. ! \function{mkstemp} returns a tuple containing an OS-level handle to ! an open file (as would be returned by \function{os.open}) and the absolute pathname of that file, in that order. \versionadded{2.3} --- 98,103 ---- no difference. ! \function{mkstemp()} returns a tuple containing an OS-level handle to ! an open file (as would be returned by \function{os.open()}) and the absolute pathname of that file, in that order. \versionadded{2.3} *************** *** 112,122 **** creating user ID. ! The user of \function{mkdtemp} is responsible for deleting the temporary directory and its contents when done with it. The \var{prefix}, \var{suffix}, and \var{dir} arguments are the same ! as for \function{mkstemp}. ! \function{mkdtemp} returns the absolute pathname of the new directory. \versionadded{2.3} \end{funcdesc} --- 112,122 ---- creating user ID. ! The user of \function{mkdtemp()} is responsible for deleting the temporary directory and its contents when done with it. The \var{prefix}, \var{suffix}, and \var{dir} arguments are the same ! as for \function{mkstemp()}. ! \function{mkdtemp()} returns the absolute pathname of the new directory. \versionadded{2.3} \end{funcdesc} *************** *** 128,132 **** Return an absolute pathname of a file that did not exist at the time the call is made. The \var{prefix}, \var{suffix}, and \var{dir} ! arguments are the same as for \function{mkstemp}. \warning{Use of this function may introduce a security hole in your --- 128,132 ---- Return an absolute pathname of a file that did not exist at the time the call is made. The \var{prefix}, \var{suffix}, and \var{dir} ! arguments are the same as for \function{mkstemp()}. \warning{Use of this function may introduce a security hole in your From jackjansen@users.sourceforge.net Tue Apr 22 23:03:16 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 22 Apr 2003 15:03:16 -0700 Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5126 Modified Files: tarfile.py Log Message: Fix by Lars Gustaebel for bug 721871: don't get upset if the prefix field contains garbage after the first NUL character. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tarfile.py 11 Apr 2003 03:05:56 -0000 1.7 --- tarfile.py 22 Apr 2003 22:03:11 -0000 1.8 *************** *** 672,687 **** except ValueError: tarinfo.devmajor = tarinfo.devmajor = 0 # The prefix field is used for filenames > 100 in # the POSIX standard. ! # name = prefix + "/" + name ! prefix = buf[345:500] ! while prefix and prefix[-1] == NUL: ! prefix = prefix[:-1] ! if len(prefix.split(NUL)) == 1: ! tarinfo.prefix = prefix ! tarinfo.name = normpath(os.path.join(tarinfo.prefix, tarinfo.name)) ! else: ! tarinfo.prefix = buf[345:500] # Directory names should have a '/' at the end. --- 672,682 ---- except ValueError: tarinfo.devmajor = tarinfo.devmajor = 0 + tarinfo.prefix = buf[345:500] # The prefix field is used for filenames > 100 in # the POSIX standard. ! # name = prefix + '/' + name ! if tarinfo.type != GNUTYPE_SPARSE: ! tarinfo.name = normpath(os.path.join(nts(tarinfo.prefix), tarinfo.name)) # Directory names should have a '/' at the end. From mhammond@users.sourceforge.net Wed Apr 23 00:13:30 2003 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue, 22 Apr 2003 16:13:30 -0700 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv32672/Modules Modified Files: _bsddb.c Log Message: Update to the new PyGILState APIs to simplify and correct thread-state management. Old code still #ifdef'd out - I may remove this in a sec, but for now, let's get it in and things passing the tests again! Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _bsddb.c 31 Mar 2003 19:51:29 -0000 1.11 --- _bsddb.c 22 Apr 2003 23:13:27 -0000 1.12 *************** *** 96,100 **** --- 96,112 ---- #define MYDB_END_ALLOW_THREADS Py_END_ALLOW_THREADS; + /* For 2.3, use the PyGILState_ calls */ + #if (PY_VERSION_HEX >= 0x02030000) + #define MYDB_USE_GILSTATE + #endif + /* and these are for calling C --> Python */ + #if defined(MYDB_USE_GILSTATE) + #define MYDB_BEGIN_BLOCK_THREADS \ + PyGILState_STATE __savestate = PyGILState_Ensure(); + #define MYDB_END_BLOCK_THREADS \ + PyGILState_Release(__savestate); + #else /* MYDB_USE_GILSTATE */ + /* Pre GILState API - do it the long old way */ static PyInterpreterState* _db_interpreterState = NULL; #define MYDB_BEGIN_BLOCK_THREADS { \ *************** *** 111,117 **** PyThreadState_Delete(newState); \ } #else ! #define MYDB_BEGIN_ALLOW_THREADS #define MYDB_END_ALLOW_THREADS --- 123,130 ---- PyThreadState_Delete(newState); \ } + #endif /* MYDB_USE_GILSTATE */ #else ! /* Compiled without threads - avoid all this cruft */ #define MYDB_BEGIN_ALLOW_THREADS #define MYDB_END_ALLOW_THREADS *************** *** 4250,4254 **** ! #ifdef WITH_THREAD /* Save the current interpreter, so callbacks can do the right thing. */ _db_interpreterState = PyThreadState_Get()->interp; --- 4263,4267 ---- ! #if defined(WITH_THREAD) && !defined(MYDB_USE_GILSTATE) /* Save the current interpreter, so callbacks can do the right thing. */ _db_interpreterState = PyThreadState_Get()->interp; From rhettinger@users.sourceforge.net Wed Apr 23 01:09:45 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 22 Apr 2003 17:09:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20534 Modified Files: libitertools.tex Log Message: Add comment on performance. Fix missing right parenthesis. Add three examples. Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libitertools.tex 23 Feb 2003 04:40:07 -0000 1.6 --- libitertools.tex 23 Apr 2003 00:09:42 -0000 1.7 *************** *** 28,31 **** --- 28,37 ---- to form \code{imap(f, count())} and produce an equivalent result. + Likewise, the functional tools are designed to work well with the + high-speed functions provided by the \refmodule{operator} module. + + The module author welcomes suggestions for other basic building blocks + to be added to future versions of the module. + Whether cast in pure python form or C code, tools that use iterators are more memory efficient (and faster) than their list based counterparts. *************** *** 34,39 **** computer equivalent of ``inventory''. ! The module author welcomes suggestions for other basic building blocks ! to be added to future versions of the module. \begin{seealso} --- 40,46 ---- computer equivalent of ``inventory''. ! The performance advantage of iterators becomes more acute as the number ! of elements increases -- at some point, lists grow large enough to ! to severely impact memory cache performance and start running slowly. \begin{seealso} *************** *** 106,110 **** Note, this is the only member of the toolkit that may require significant auxiliary storage (depending on the length of the ! iterable. \end{funcdesc} --- 113,117 ---- Note, this is the only member of the toolkit that may require significant auxiliary storage (depending on the length of the ! iterable). \end{funcdesc} *************** *** 355,358 **** --- 362,376 ---- ... "s -> (s0,s1), (s1,s2), (s2, s3), ..." ... return izip(seq, islice(seq,1,len(seq))) + + >>> def padnone(seq): + ... "Returns the sequence elements and then returns None indefinitely" + ... return chain(seq, repeat(None)) + + >>> def ncycles(seq, n): + ... "Returns the sequence elements n times" + ... return chain(*repeat(seq, n)) + + >>> def dotproduct(vec1, vec2): + ... return sum(imap(operator.mul, vec1, vec2)) \end{verbatim} From rhettinger@users.sourceforge.net Wed Apr 23 01:14:21 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 22 Apr 2003 17:14:21 -0700 Subject: [Python-checkins] python/dist/src/Modules _randommodule.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22265 Modified Files: _randommodule.c Log Message: PyObject_IsTrue() can return an error condition. Adding code to handle it properly. Index: _randommodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_randommodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _randommodule.c 16 Apr 2003 18:40:04 -0000 1.4 --- _randommodule.c 23 Apr 2003 00:14:18 -0000 1.5 *************** *** 214,217 **** --- 214,218 ---- unsigned long keymax; /* # of allocated slots in key */ unsigned long keyused; /* # of used slots in key */ + int err; PyObject *arg = NULL; *************** *** 262,270 **** if (thirtytwo == NULL) goto Done; ! while (PyObject_IsTrue(n)) { PyObject *newn; PyObject *pychunk; unsigned long chunk; pychunk = PyNumber_And(n, masklower); if (pychunk == NULL) --- 263,273 ---- if (thirtytwo == NULL) goto Done; ! while ((err=PyObject_IsTrue(n))) { PyObject *newn; PyObject *pychunk; unsigned long chunk; + if (err == -1) + goto Done; pychunk = PyNumber_And(n, masklower); if (pychunk == NULL) From tim_one@users.sourceforge.net Wed Apr 23 03:39:18 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 22 Apr 2003 19:39:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.116,1.117 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9192/python/Doc/lib Modified Files: libos.tex Log Message: Enable os.fsync() for Windows, mapping it to MS's _commit() there. The docs here are best-guess: the MS docs I could find weren't clear, and some even claimed _commit() has no effect on Win32 systems (which is easily shown to be false just by trying it). Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** libos.tex 20 Mar 2003 17:39:38 -0000 1.116 --- libos.tex 23 Apr 2003 02:39:16 -0000 1.117 *************** *** 450,454 **** \begin{funcdesc}{fsync}{fd} Force write of file with filedescriptor \var{fd} to disk. ! Availability: \UNIX. \end{funcdesc} --- 450,460 ---- \begin{funcdesc}{fsync}{fd} Force write of file with filedescriptor \var{fd} to disk. ! ! On Windows this calls the MS \cfunction{_commit()} function. If you're ! starting with a Python file object \var{f}, first do ! \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, ! to ensure that all internal buffers associated with \var{f} are written ! to disk. ! Availability: \UNIX, and Windows starting in 2.3. \end{funcdesc} *************** *** 922,926 **** \member{st_mtime}, \member{st_ctime}. ! More items may be added at the end by some implementations. The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information --- 928,932 ---- \member{st_mtime}, \member{st_ctime}. ! More items may be added at the end by some implementations. The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information From tim_one@users.sourceforge.net Wed Apr 23 03:39:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 22 Apr 2003 19:39:19 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.739,1.740 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9192/python/Misc Modified Files: NEWS Log Message: Enable os.fsync() for Windows, mapping it to MS's _commit() there. The docs here are best-guess: the MS docs I could find weren't clear, and some even claimed _commit() has no effect on Win32 systems (which is easily shown to be false just by trying it). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.739 retrieving revision 1.740 diff -C2 -d -r1.739 -r1.740 *** NEWS 22 Apr 2003 08:12:31 -0000 1.739 --- NEWS 23 Apr 2003 02:39:16 -0000 1.740 *************** *** 233,236 **** --- 233,239 ---- ------- + - os.fsync() now exists on Windows, and calls the Microsoft _commit() + function. + - New function winsound.MessageBeep() wraps the Win32 API MessageBeep(). From tim_one@users.sourceforge.net Wed Apr 23 03:39:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 22 Apr 2003 19:39:20 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.297,2.298 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9192/python/Modules Modified Files: posixmodule.c Log Message: Enable os.fsync() for Windows, mapping it to MS's _commit() there. The docs here are best-guess: the MS docs I could find weren't clear, and some even claimed _commit() has no effect on Win32 systems (which is easily shown to be false just by trying it). Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.297 retrieving revision 2.298 diff -C2 -d -r2.297 -r2.298 *** posixmodule.c 21 Apr 2003 14:22:36 -0000 2.297 --- posixmodule.c 23 Apr 2003 02:39:17 -0000 2.298 *************** *** 113,116 **** --- 113,118 ---- #define HAVE_SYSTEM 1 #define HAVE_CWAIT 1 + #define HAVE_FSYNC 1 + #define fsync _commit #else #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) *************** *** 302,306 **** #endif ! #if defined(MAJOR_IN_MKDEV) #include #else --- 304,308 ---- #endif ! #if defined(MAJOR_IN_MKDEV) #include #else *************** *** 326,330 **** #if defined(__VMS) /* add some values to provide a similar environment like POSIX */ ! static void vms_add_posix_env(PyObject *d) --- 328,332 ---- #if defined(__VMS) /* add some values to provide a similar environment like POSIX */ ! static void vms_add_posix_env(PyObject *d) *************** *** 517,522 **** PyUnicode_GET_SIZE(obj)); } ! return PyUnicode_FromEncodedObject(obj, ! Py_FileSystemDefaultEncoding, "strict"); } --- 519,524 ---- PyUnicode_GET_SIZE(obj)); } ! return PyUnicode_FromEncodedObject(obj, ! Py_FileSystemDefaultEncoding, "strict"); } *************** *** 622,631 **** #ifdef Py_WIN_WIDE_FILENAMES ! static int unicode_file_names(void) { static int canusewide = -1; if (canusewide == -1) { ! /* As per doc for ::GetVersion(), this is the correct test for the Windows NT family. */ canusewide = (GetVersion() < 0x80000000) ? 1 : 0; --- 624,633 ---- #ifdef Py_WIN_WIDE_FILENAMES ! static int unicode_file_names(void) { static int canusewide = -1; if (canusewide == -1) { ! /* As per doc for ::GetVersion(), this is the correct test for the Windows NT family. */ canusewide = (GetVersion() < 0x80000000) ? 1 : 0; *************** *** 634,638 **** } #endif ! static PyObject * posix_1str(PyObject *args, char *format, int (*func)(const char*), --- 636,640 ---- } #endif ! static PyObject * posix_1str(PyObject *args, char *format, int (*func)(const char*), *************** *** 679,683 **** static PyObject * ! posix_2str(PyObject *args, char *format, int (*func)(const char *, const char *), --- 681,685 ---- static PyObject * ! posix_2str(PyObject *args, char *format, int (*func)(const char *, const char *), *************** *** 972,976 **** static PyObject * ! posix_do_stat(PyObject *self, PyObject *args, char *format, #ifdef __VMS --- 974,978 ---- static PyObject * ! posix_do_stat(PyObject *self, PyObject *args, char *format, #ifdef __VMS *************** *** 1182,1186 **** return posix_1str(args, "et:chdir", _chdir2, NULL, NULL); #elif defined(__VMS) ! return posix_1str(args, "et:chdir", (int (*)(const char *))chdir, NULL, NULL); #else --- 1184,1188 ---- return posix_1str(args, "et:chdir", _chdir2, NULL, NULL); #elif defined(__VMS) ! return posix_1str(args, "et:chdir", (int (*)(const char *))chdir, NULL, NULL); #else *************** *** 1315,1319 **** res = lchown(path, (uid_t) uid, (gid_t) gid); Py_END_ALLOW_THREADS ! if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); --- 1317,1321 ---- res = lchown(path, (uid_t) uid, (gid_t) gid); Py_END_ALLOW_THREADS ! if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); *************** *** 1647,1651 **** w = PyUnicode_FromEncodedObject(v, ! Py_FileSystemDefaultEncoding, "strict"); if (w != NULL) { --- 1649,1653 ---- w = PyUnicode_FromEncodedObject(v, ! Py_FileSystemDefaultEncoding, "strict"); if (w != NULL) { *************** *** 1693,1697 **** Py_UNICODE woutbuf[MAX_PATH*2]; Py_UNICODE *wtemp; ! if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po), sizeof(woutbuf)/sizeof(woutbuf[0]), woutbuf, &wtemp)) --- 1695,1699 ---- Py_UNICODE woutbuf[MAX_PATH*2]; Py_UNICODE *wtemp; ! if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po), sizeof(woutbuf)/sizeof(woutbuf[0]), woutbuf, &wtemp)) *************** *** 3186,3190 **** * Variation on os2emx.popen2 * ! * The result of this function is 2 pipes - the processes stdin, * and stdout+stderr combined as a single pipe. */ --- 3188,3192 ---- * Variation on os2emx.popen2 * ! * The result of this function is 2 pipes - the processes stdin, * and stdout+stderr combined as a single pipe. */ *************** *** 3520,3524 **** } } ! /* * Clean up our localized references for the dictionary keys --- 3522,3526 ---- } } ! /* * Clean up our localized references for the dictionary keys *************** *** 3937,3941 **** cmdstring); /* Not passing CREATE_NEW_CONSOLE has been known to ! cause random failures on win9x. Specifically a dialog: "Your program accessed mem currently in use at xxx" --- 3939,3943 ---- cmdstring); /* Not passing CREATE_NEW_CONSOLE has been known to ! cause random failures on win9x. Specifically a dialog: "Your program accessed mem currently in use at xxx" From tim.one@comcast.net Wed Apr 23 04:02:14 2003 From: tim.one@comcast.net (Tim Peters) Date: Tue, 22 Apr 2003 23:02:14 -0400 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.297,2.298 In-Reply-To: Message-ID: > Modified Files: > posixmodule.c > Log Message: > Enable os.fsync() for Windows, mapping it to MS's _commit() there. The > docs here are best-guess: the MS docs I could find weren't clear, and > some even claimed _commit() has no effect on Win32 systems (which is > easily shown to be false just by trying it). Oops! This was the only part of the patch to posixmodule.c that did anything: > *************** > *** 113,116 **** > --- 113,118 ---- > #define HAVE_SYSTEM 1 > #define HAVE_CWAIT 1 > + #define HAVE_FSYNC 1 > + #define fsync _commit > #else > #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) All the rest was accidental trimming of trailing whitespace. From nnorwitz@users.sourceforge.net Wed Apr 23 04:49:45 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 22 Apr 2003 20:49:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,1.8,1.9 handlers.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1:/tmp/cvs-serv32209/Lib/logging Modified Files: __init__.py handlers.py Log Message: SF patch #725904, Minor changes to logging from module author (Vinay Sajip) - upgrade to version 0.4.8 Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 2 Mar 2003 20:47:28 -0000 1.8 --- __init__.py 23 Apr 2003 03:49:43 -0000 1.9 *************** *** 36,53 **** __author__ = "Vinay Sajip " ! __status__ = "alpha" __version__ = "0.4.8" ! __date__ = "16 February 2003" #--------------------------------------------------------------------------- # Miscellaneous module data #--------------------------------------------------------------------------- - - # - # _verinfo is used for when behaviour needs to be adjusted to the version - # of Python - # - - _verinfo = getattr(sys, "version_info", None) # --- 36,46 ---- __author__ = "Vinay Sajip " ! __status__ = "beta" __version__ = "0.4.8" ! __date__ = "22 April 2003" #--------------------------------------------------------------------------- # Miscellaneous module data #--------------------------------------------------------------------------- # Index: handlers.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/handlers.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** handlers.py 18 Feb 2003 14:20:07 -0000 1.5 --- handlers.py 23 Apr 2003 03:49:43 -0000 1.6 *************** *** 27,31 **** """ ! import sys, logging, socket, types, os, string, cPickle, struct from SocketServer import ThreadingTCPServer, StreamRequestHandler --- 27,31 ---- """ ! import sys, logging, socket, types, os, string, cPickle, struct, time from SocketServer import ThreadingTCPServer, StreamRequestHandler *************** *** 146,151 **** network is busy. """ ! v = logging._verinfo ! if v and (v[0] >= 2) and (v[1] >= 2): self.sock.sendall(s) else: --- 146,150 ---- network is busy. """ ! if hasattr(self.sock, "sendall"): self.sock.sendall(s) else: *************** *** 449,452 **** --- 448,466 ---- return self.subject + weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] + + monthname = [None, + 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + + def date_time(self): + """Return the current date and time formatted for a MIME header.""" + year, month, day, hh, mm, ss, wd, y, z = time.gmtime(time.time()) + s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( + self.weekdayname[wd], + day, self.monthname[month], year, + hh, mm, ss) + return s + def emit(self, record): """ *************** *** 462,470 **** smtp = smtplib.SMTP(self.mailhost, port) msg = self.format(record) ! msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % ( self.fromaddr, string.join(self.toaddrs, ","), ! self.getSubject(record), msg ! ) smtp.sendmail(self.fromaddr, self.toaddrs, msg) smtp.quit() --- 476,484 ---- smtp = smtplib.SMTP(self.mailhost, port) msg = self.format(record) ! msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % ( self.fromaddr, string.join(self.toaddrs, ","), ! self.getSubject(record), ! self.date_time(), msg) smtp.sendmail(self.fromaddr, self.toaddrs, msg) smtp.quit() *************** *** 588,591 **** --- 602,613 ---- self.method = method + def mapLogRecord(self, record): + """ + Default implementation of mapping the log record into a dict + that is send as the CGI data. Overwrite in your class. + Contributed by Franz Glasner. + """ + return record.__dict__ + def emit(self, record): """ *************** *** 598,602 **** h = httplib.HTTP(self.host) url = self.url ! data = urllib.urlencode(record.__dict__) if self.method == "GET": if (string.find(url, '?') >= 0): --- 620,624 ---- h = httplib.HTTP(self.host) url = self.url ! data = urllib.urlencode(self.mapLogRecord(record)) if self.method == "GET": if (string.find(url, '?') >= 0): From gvanrossum@users.sourceforge.net Wed Apr 23 13:07:27 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 23 Apr 2003 05:07:27 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.228,2.229 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv3459 Modified Files: typeobject.c Log Message: Improve the message about metatype/metaclass conflicts. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.228 retrieving revision 2.229 diff -C2 -d -r2.228 -r2.229 *** typeobject.c 16 Apr 2003 20:01:36 -0000 2.228 --- typeobject.c 23 Apr 2003 12:07:22 -0000 2.229 *************** *** 1581,1585 **** } PyErr_SetString(PyExc_TypeError, ! "metatype conflict among bases"); return NULL; } --- 1581,1588 ---- } PyErr_SetString(PyExc_TypeError, ! "metaclass conflict: " ! "the metaclass of a derived class " ! "must be a (non-strict) subclass " ! "of the metaclasses of all its bases"); return NULL; } From aleax@users.sourceforge.net Wed Apr 23 14:00:49 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Wed, 23 Apr 2003 06:00:49 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.290,2.291 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28336/Python Modified Files: bltinmodule.c Log Message: complete and clarify some error messages for range() Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.290 retrieving revision 2.291 diff -C2 -d -r2.290 -r2.291 *** bltinmodule.c 22 Apr 2003 09:24:48 -0000 2.290 --- bltinmodule.c 23 Apr 2003 13:00:44 -0000 2.291 *************** *** 1369,1373 **** if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { PyErr_Format(PyExc_TypeError, ! "integer start argument expected, got %s.", ilow->ob_type->tp_name); goto Fail; --- 1369,1373 ---- if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { PyErr_Format(PyExc_TypeError, ! "range() integer start argument expected, got %s.", ilow->ob_type->tp_name); goto Fail; *************** *** 1376,1380 **** if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { PyErr_Format(PyExc_TypeError, ! "integer end argument expected, got %s.", ihigh->ob_type->tp_name); goto Fail; --- 1376,1380 ---- if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { PyErr_Format(PyExc_TypeError, ! "range() integer end argument expected, got %s.", ihigh->ob_type->tp_name); goto Fail; *************** *** 1383,1387 **** if (!PyInt_Check(istep) && !PyLong_Check(istep)) { PyErr_Format(PyExc_TypeError, ! "integer step argument expected, got %s.", istep->ob_type->tp_name); goto Fail; --- 1383,1387 ---- if (!PyInt_Check(istep) && !PyLong_Check(istep)) { PyErr_Format(PyExc_TypeError, ! "range() integer step argument expected, got %s.", istep->ob_type->tp_name); goto Fail; *************** *** 1392,1396 **** if (cmp_result == 0) { PyErr_SetString(PyExc_ValueError, ! "range() arg 3 must not be zero"); goto Fail; } --- 1392,1396 ---- if (cmp_result == 0) { PyErr_SetString(PyExc_ValueError, ! "range() step argument must not be zero"); goto Fail; } *************** *** 1508,1512 **** if (istep == 0) { PyErr_SetString(PyExc_ValueError, ! "range() arg 3 must not be zero"); return NULL; } --- 1508,1512 ---- if (istep == 0) { PyErr_SetString(PyExc_ValueError, ! "range() step argument must not be zero"); return NULL; } From nnorwitz@users.sourceforge.net Wed Apr 23 14:12:24 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 23 Apr 2003 06:12:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1:/tmp/cvs-serv1150/Lib/logging Modified Files: __init__.py Log Message: Fix SF bug #723801, logging.setLoggerClass() doesn't support new-style classes Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 23 Apr 2003 03:49:43 -0000 1.9 --- __init__.py 23 Apr 2003 13:12:19 -0000 1.10 *************** *** 726,731 **** """ if klass != Logger: - if type(klass) != types.ClassType: - raise TypeError, "setLoggerClass is expecting a class" if not issubclass(klass, Logger): raise TypeError, "logger not derived from logging.Logger: " + \ --- 726,729 ---- From aleax@users.sourceforge.net Wed Apr 23 14:34:38 2003 From: aleax@users.sourceforge.net (aleax@users.sourceforge.net) Date: Wed, 23 Apr 2003 06:34:38 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.291,2.292 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv12968/Python Modified Files: bltinmodule.c Log Message: some more error-message enhancements Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.291 retrieving revision 2.292 diff -C2 -d -r2.291 -r2.292 *** bltinmodule.c 23 Apr 2003 13:00:44 -0000 2.291 --- bltinmodule.c 23 Apr 2003 13:34:35 -0000 2.292 *************** *** 86,90 **** if (!PySequence_Check(alist)) { PyErr_Format(PyExc_TypeError, ! "apply() arg 2 expect sequence, found %s", alist->ob_type->tp_name); return NULL; --- 86,90 ---- if (!PySequence_Check(alist)) { PyErr_Format(PyExc_TypeError, ! "apply() arg 2 expected sequence, found %s", alist->ob_type->tp_name); return NULL; *************** *** 369,373 **** if ((size_t)length != strlen(str)) { PyErr_SetString(PyExc_TypeError, ! "expected string without null bytes"); return NULL; } --- 369,373 ---- if ((size_t)length != strlen(str)) { PyErr_SetString(PyExc_TypeError, ! "compile() expected string without null bytes"); return NULL; } *************** *** 645,649 **** if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, ! "attribute name must be string"); return NULL; } --- 645,649 ---- if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, ! "getattr(): attribute name must be string"); return NULL; } *************** *** 701,705 **** if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, ! "attribute name must be string"); return NULL; } --- 701,705 ---- if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, ! "hasattr(): attribute name must be string"); return NULL; } *************** *** 1557,1565 **** if (fin == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "lost sys.stdin"); return NULL; } if (fout == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); return NULL; } --- 1557,1565 ---- if (fin == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "[raw_]input: lost sys.stdin"); return NULL; } if (fout == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "[raw_]input: lost sys.stdout"); return NULL; } *************** *** 1602,1606 **** if (len > INT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "input too long"); result = NULL; } --- 1602,1606 ---- if (len > INT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "[raw_]input: input too long"); result = NULL; } *************** *** 1777,1781 **** if (!PyErr_Occurred()) PyErr_SetString(PyExc_SystemError, ! "no locals!?"); } else --- 1777,1781 ---- if (!PyErr_Occurred()) PyErr_SetString(PyExc_SystemError, ! "vars(): no locals!?"); } else *************** *** 1824,1828 **** if (PyObject_TypeCheck(result, &PyBaseString_Type)) { PyErr_SetString(PyExc_TypeError, ! "can't sum strings [use ''.join(seq) instead]"); Py_DECREF(iter); return NULL; --- 1824,1828 ---- if (PyObject_TypeCheck(result, &PyBaseString_Type)) { PyErr_SetString(PyExc_TypeError, ! "sum() can't sum strings [use ''.join(seq) instead]"); Py_DECREF(iter); return NULL; *************** *** 2178,2182 **** item = tuple->ob_type->tp_as_sequence->sq_item(tuple, i); } else { ! PyErr_SetString(PyExc_TypeError, "unsubscriptable object"); goto Fail_1; } --- 2178,2182 ---- item = tuple->ob_type->tp_as_sequence->sq_item(tuple, i); } else { ! PyErr_SetString(PyExc_TypeError, "filter(): unsubscriptable tuple"); goto Fail_1; } From fdrake@users.sourceforge.net Wed Apr 23 16:05:04 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 23 Apr 2003 08:05:04 -0700 Subject: [Python-checkins] python/dist/src/Doc .cvsignore,1.22,1.23 Makefile,1.251,1.252 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv21284 Modified Files: .cvsignore Makefile Log Message: Update the package list whenever we build distfiles. This is used on www.python.org. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/.cvsignore,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** .cvsignore 18 Jul 2001 21:04:35 -0000 1.22 --- .cvsignore 23 Apr 2003 15:04:52 -0000 1.23 *************** *** 3,4 **** --- 3,5 ---- *.zip *.tar + pkglist.html Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.251 retrieving revision 1.252 diff -C2 -d -r1.251 -r1.252 *** Makefile 18 Feb 2003 22:11:57 -0000 1.251 --- Makefile 23 Apr 2003 15:04:52 -0000 1.252 *************** *** 657,660 **** --- 657,661 ---- distfiles: paperdist edist $(TOOLSDIR)/mksourcepkg --all $(RELEASE) + $(TOOLSDIR)/mkpkglist >pkglist.html From rhettinger@users.sourceforge.net Wed Apr 23 18:27:03 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 10:27:03 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28766 Modified Files: arraymodule.c Log Message: SF Patch 685051: fix for 680789: reprs in arraymodule (contributed by logistix; substantially reworked by rhettinger). To create a representation of non-string arrays, array_repr() was starting with a base Python string object and repeatedly using += to concatenate the representation of individual objects. Logistix had the idea to convert to an intermediate tuple form and then join it all at once. I took advantage of existing tools and formed a list with array_tolist() and got its representation through PyObject_Repr(v) which already has a fast implementation for lists. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -d -r2.86 -r2.87 *** arraymodule.c 17 Mar 2003 19:46:07 -0000 2.86 --- arraymodule.c 23 Apr 2003 17:27:00 -0000 2.87 *************** *** 1457,1462 **** { char buf[256], typecode; ! PyObject *s, *t, *comma, *v; ! int i, len; len = a->ob_size; --- 1457,1462 ---- { char buf[256], typecode; ! PyObject *s, *t, *v = NULL; ! int len; len = a->ob_size; *************** *** 1466,1500 **** return PyString_FromString(buf); } ! ! if (typecode == 'c' || typecode == 'u') { ! PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); ! s = PyString_FromString(buf); ! #ifdef Py_USING_UNICODE ! if (typecode == 'c') ! #endif ! v = array_tostring(a, NULL); #ifdef Py_USING_UNICODE ! else ! v = array_tounicode(a, NULL); #endif ! t = PyObject_Repr(v); ! Py_XDECREF(v); ! PyString_ConcatAndDel(&s, t); ! PyString_ConcatAndDel(&s, PyString_FromString(")")); ! return s; ! } ! PyOS_snprintf(buf, sizeof(buf), "array('%c', [", typecode); s = PyString_FromString(buf); ! comma = PyString_FromString(", "); ! for (i = 0; i < len && !PyErr_Occurred(); i++) { ! if (i > 0) ! PyString_Concat(&s, comma); ! v = (a->ob_descr->getitem)(a, i); ! t = PyObject_Repr(v); ! Py_XDECREF(v); ! PyString_ConcatAndDel(&s, t); ! } ! Py_XDECREF(comma); ! PyString_ConcatAndDel(&s, PyString_FromString("])")); return s; } --- 1466,1485 ---- return PyString_FromString(buf); } ! ! if (typecode == 'c') ! v = array_tostring(a, NULL); #ifdef Py_USING_UNICODE ! else if (typecode == 'u') ! v = array_tounicode(a, NULL); #endif ! else ! v = array_tolist(a, NULL); ! t = PyObject_Repr(v); ! Py_XDECREF(v); ! ! PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); s = PyString_FromString(buf); ! PyString_ConcatAndDel(&s, t); ! PyString_ConcatAndDel(&s, PyString_FromString(")")); return s; } From rhettinger@users.sourceforge.net Wed Apr 23 19:59:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 11:59:58 -0700 Subject: [Python-checkins] python/dist/src/Lib netrc.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9877 Modified Files: netrc.py Log Message: SF 557704: netrc module can't handle all passwords Expanded the range of allowable characters to include ascii punctuation. Allows resource files to have a larger character set for passwords. (Idea contributed by Bram Moolenaar.) Index: netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/netrc.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** netrc.py 1 Jun 2002 16:07:16 -0000 1.16 --- netrc.py 23 Apr 2003 18:59:54 -0000 1.17 *************** *** 31,36 **** self.macros = {} lexer = shlex.shlex(fp) ! # Allows @ in hostnames. Not a big deal... ! lexer.wordchars = lexer.wordchars + '.-@' while 1: # Look for a machine, default, or macdef top-level keyword --- 31,35 ---- self.macros = {} lexer = shlex.shlex(fp) ! lexer.wordchars += r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" while 1: # Look for a machine, default, or macdef top-level keyword From rhettinger@users.sourceforge.net Wed Apr 23 20:06:14 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:06:14 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.740,1.741 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13703 Modified Files: NEWS Log Message: SF patch 557704: netrc module can't handle all passwords Revised netrc.py to include the additional ascii punctuation characters. Omitted the other logic changes. See Lib/netrc.py 1.17. Since this is more of a feature request than a bug, including in Py2.3 but not recommending for backporting. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.740 retrieving revision 1.741 diff -C2 -d -r1.740 -r1.741 *** NEWS 23 Apr 2003 02:39:16 -0000 1.740 --- NEWS 23 Apr 2003 19:06:08 -0000 1.741 *************** *** 128,131 **** --- 128,133 ---- ------- + - netrc now allows Ascii punctuation characters in passwords. + - shelve now supports the optional writeback argument, and exposes pickle protocol versions. From theller@users.sourceforge.net Wed Apr 23 20:27:40 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:27:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv25303 Modified Files: utilities.tex Log Message: Document the new format codes B, H, I, k, K. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** utilities.tex 29 Mar 2003 10:04:54 -0000 1.9 --- utilities.tex 23 Apr 2003 19:27:35 -0000 1.10 *************** *** 488,504 **** --- 488,526 ---- Convert a Python integer to a tiny int, stored in a C \ctype{char}. + \item[\samp{B} (integer) {[unsigned char]}] + Convert a Python integer to a tiny int without overflow checking, + stored in a C \ctype{unsigned char}. \versionadded{2.3} + \item[\samp{h} (integer) {[short int]}] Convert a Python integer to a C \ctype{short int}. + \item[\samp{H} (integer) {[unsigned short int]}] + Convert a Python integer to a C \ctype{unsigned short int}, without + overflow checking. \versionadded{2.3} + \item[\samp{i} (integer) {[int]}] Convert a Python integer to a plain C \ctype{int}. + \item[\samp{I} (integer) {[unsigned int]}] + Convert a Python integer to a C \ctype{unsigned int}, without + overflow checking. \versionadded{2.3} + \item[\samp{l} (integer) {[long int]}] Convert a Python integer to a C \ctype{long int}. + \item[\samp{k} (integer) {[unsigned long]}] + Convert a Python integer to a C \ctype{unsigned long} without + overflow checking. \versionadded{2.3} + \item[\samp{L} (integer) {[PY_LONG_LONG]}] Convert a Python integer to a C \ctype{long long}. This format is only available on platforms that support \ctype{long long} (or \ctype{_int64} on Windows). + + \item[\samp{K} (integer) {[unsigned PY_LONG_LONG]}] + Convert a Python integer to a C \ctype{unsigned long long} + without overflow checking. This format is only available on + platforms that support \ctype{unsigned long long} (or + \ctype{unsigned _int64} on Windows). \versionadded{2.3} \item[\samp{c} (string of length 1) {[char]}] From theller@users.sourceforge.net Wed Apr 23 20:35:33 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:35:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.741,1.742 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29113 Modified Files: NEWS Log Message: Mention the new getargs.c format codes. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.741 retrieving revision 1.742 diff -C2 -d -r1.741 -r1.742 *** NEWS 23 Apr 2003 19:06:08 -0000 1.741 --- NEWS 23 Apr 2003 19:35:25 -0000 1.742 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - New format codes B, H, I, k and K have been implemented for + PyArg_ParseTuple and PyBuild_Value. + - New builtin function sum(seq, start=0) returns the sum of all the items in iterable object seq, plus start (items are normally numbers, From rhettinger@users.sourceforge.net Wed Apr 23 20:37:46 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:37:46 -0700 Subject: [Python-checkins] python/dist/src/Lib netrc.py,1.12.22.1,1.12.22.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30010 Modified Files: Tag: release22-maint netrc.py Log Message: Backport 1.17 adding punctuation as allowable characters Index: netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/netrc.py,v retrieving revision 1.12.22.1 retrieving revision 1.12.22.2 diff -C2 -d -r1.12.22.1 -r1.12.22.2 *** netrc.py 25 Mar 2002 13:22:14 -0000 1.12.22.1 --- netrc.py 23 Apr 2003 19:37:42 -0000 1.12.22.2 *************** *** 28,33 **** self.macros = {} lexer = shlex.shlex(fp) ! # Allows @ in hostnames. Not a big deal... ! lexer.wordchars = lexer.wordchars + '.-@' while 1: # Look for a machine, default, or macdef top-level keyword --- 28,32 ---- self.macros = {} lexer = shlex.shlex(fp) ! lexer.wordchars += r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" while 1: # Look for a machine, default, or macdef top-level keyword From tim_one@users.sourceforge.net Wed Apr 23 20:47:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:47:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.117,1.118 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2211/python/Doc/lib Modified Files: libos.tex Log Message: Clarified new fsync() docs. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** libos.tex 23 Apr 2003 02:39:16 -0000 1.117 --- libos.tex 23 Apr 2003 19:47:14 -0000 1.118 *************** *** 449,460 **** \begin{funcdesc}{fsync}{fd} ! Force write of file with filedescriptor \var{fd} to disk. ! On Windows this calls the MS \cfunction{_commit()} function. If you're ! starting with a Python file object \var{f}, first do \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, to ensure that all internal buffers associated with \var{f} are written to disk. ! Availability: \UNIX, and Windows starting in 2.3. \end{funcdesc} --- 449,461 ---- \begin{funcdesc}{fsync}{fd} ! Force write of file with filedescriptor \var{fd} to disk. On \UNIX, ! this calls the native \cfunction{fsync()} function; on Windows, the ! MS \cfunction{_commit()} function. ! If you're starting with a Python file object \var{f}, first do \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, to ensure that all internal buffers associated with \var{f} are written to disk. ! Availability: \UNIX, and Windows starting in 2.2.3. \end{funcdesc} From doerwalter@users.sourceforge.net Wed Apr 23 20:50:27 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:50:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grp.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv3929/Lib/test Modified Files: test_grp.py Log Message: Max OS X returns "*" as the password in grp.getgrall() and "" in grep.getgrgid(). Adjust the test to work around this problem. This should fix SF bug #724771. Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_grp.py 22 Apr 2003 11:05:57 -0000 1.14 --- test_grp.py 23 Apr 2003 19:50:24 -0000 1.15 *************** *** 5,40 **** from test import test_support - class GroupDatabaseTestCase(unittest.TestCase): def test_values(self): entries = grp.getgrall() - entriesbyname = {} entriesbygid = {} ! for e in entries: ! self.assertEqual(len(e), 4) ! self.assertEqual(e[0], e.gr_name) ! self.assert_(isinstance(e.gr_name, basestring)) ! self.assertEqual(e[1], e.gr_passwd) ! self.assert_(isinstance(e.gr_passwd, basestring)) ! self.assertEqual(e[2], e.gr_gid) ! self.assert_(isinstance(e.gr_gid, int)) ! self.assertEqual(e[3], e.gr_mem) ! self.assert_(isinstance(e.gr_mem, list)) ! # The following won't work, because of duplicate entries ! # for one gid ! # self.assertEqual(grp.getgrgid(e.gr_gid), e) ! # instead of this collect all entries for one gid/name ! # and check afterwards ! entriesbyname.setdefault(e.gr_name, []).append(e) entriesbygid.setdefault(e.gr_gid, []).append(e) - # check whether the entry returned by getgrgid() - # for each uid is among those from getgrall() for this uid for e in entries: ! self.assert_(grp.getgrgid(e.gr_gid) in entriesbygid[e.gr_gid]) ! self.assert_(grp.getgrnam(e.gr_name) in entriesbyname[e.gr_name]) def test_errors(self): --- 5,55 ---- from test import test_support class GroupDatabaseTestCase(unittest.TestCase): + def check_value(self, value): + # check that a grp tuple has the entries and + # attributes promised by the docs + self.assertEqual(len(value), 4) + self.assertEqual(value[0], value.gr_name) + self.assert_(isinstance(value.gr_name, basestring)) + self.assertEqual(value[1], value.gr_passwd) + self.assert_(isinstance(value.gr_passwd, basestring)) + self.assertEqual(value[2], value.gr_gid) + self.assert_(isinstance(value.gr_gid, int)) + self.assertEqual(value[3], value.gr_mem) + self.assert_(isinstance(value.gr_mem, list)) + + def valueseq(self, value1, value2): + # are two grp tuples equal (don't compare passwords) + return value1.gr_name==value2.gr_name and \ + value1.gr_gid==value2.gr_gid and value1.gr_mem==value2.gr_mem + def test_values(self): entries = grp.getgrall() entriesbygid = {} + entriesbyname = {} ! # we can't use the same strategy as in test_pwd, because ! # we can't compare gr_passwd (Mac OS X returns ! # "*" in getgrall() and "" in getgrgid()) ! for e in entries: ! self.check_value(e) entriesbygid.setdefault(e.gr_gid, []).append(e) + entriesbyname.setdefault(e.gr_name, []).append(e) for e in entries: ! e2 = grp.getgrgid(e.gr_gid) ! self.check_value(e2) ! # make sure that at least one of the entries ! # for this gid compares equal to e2 ! self.assert_(max([self.valueseq(e2, x) \ ! for x in entriesbygid[e.gr_gid]])) ! e2 = grp.getgrnam(e.gr_name) ! self.check_value(e2) ! # make sure that at least one of the entries ! # for this name compares equal to e2 ! self.assert_(max([self.valueseq(e2, x) \ ! for x in entriesbyname[e.gr_name]])) def test_errors(self): From theller@users.sourceforge.net Wed Apr 23 20:51:09 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Wed, 23 Apr 2003 12:51:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv4406 Modified Files: concrete.tex Log Message: Document the new functions PyInt_AsUnsignedLongMask(), PyInt_AsUnsignedLongLongMask(), PyLong_AsUnsignedLongMask(), PyLong_AsUnsignedLongLongMask(). Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** concrete.tex 30 Mar 2003 16:40:42 -0000 1.22 --- concrete.tex 23 Apr 2003 19:51:05 -0000 1.23 *************** *** 169,172 **** --- 169,186 ---- \end{cfuncdesc} + \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongMask}{PyObject *io} + Will first attempt to cast the object to a \ctype{PyIntObject} or + \ctypes{PyLongObject}, if it is not already one, and then return its + value as unsigned long. This function does not check for overflow. + \versionadded{2.3} + \end{cfuncdesc} + + \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongLongMask}{PyObject *io} + Will first attempt to cast the object to a \ctype{PyIntObject} or + \ctypes{PyLongObject}, if it is not already one, and then return its + value as unsigned long long, without checking for overflow. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{long}{PyInt_GetMax}{} Returns the system's idea of the largest integer it can handle *************** *** 292,295 **** --- 306,321 ---- negative. \versionadded{2.2} + \end{cfuncdesc} + + \begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLongMask}{PyObject *io} + Return a C \ctype{unsigned long} from a Python long integer, without + checking for overflow. + \versionadded{2.3} + \end{cfuncdesc} + + \begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLongLongMask}{PyObject *io} + Return a C \ctype{unsigned long long} from a Python long integer, without + checking for overflow. + \versionadded{2.3} \end{cfuncdesc} From tim_one@users.sourceforge.net Wed Apr 23 21:14:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:14:17 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.216.4.9,2.216.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14722/Modules Modified Files: Tag: release22-maint posixmodule.c Log Message: fsync(): Implemented for Windows, via calling MS _commit. This counts as "a bug" because there's no other way in core Python to ensure that bytes written are actually on disk. At least ZODB wants this guarantee, for robustness against crashes. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.216.4.9 retrieving revision 2.216.4.10 diff -C2 -d -r2.216.4.9 -r2.216.4.10 *** posixmodule.c 11 Feb 2003 23:19:32 -0000 2.216.4.9 --- posixmodule.c 23 Apr 2003 20:14:12 -0000 2.216.4.10 *************** *** 73,76 **** --- 73,78 ---- #ifdef _MSC_VER /* Microsoft compiler */ #define HAVE_GETCWD 1 + #define HAVE_FSYNC 1 + #define fsync _commit #ifdef MS_WIN32 #define HAVE_SPAWNV 1 From tim_one@users.sourceforge.net Wed Apr 23 21:14:45 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:14:45 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.73,1.337.2.4.2.74 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14722/Misc Modified Files: Tag: release22-maint NEWS Log Message: fsync(): Implemented for Windows, via calling MS _commit. This counts as "a bug" because there's no other way in core Python to ensure that bytes written are actually on disk. At least ZODB wants this guarantee, for robustness against crashes. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.73 retrieving revision 1.337.2.4.2.74 diff -C2 -d -r1.337.2.4.2.73 -r1.337.2.4.2.74 *** NEWS 11 Apr 2003 18:21:03 -0000 1.337.2.4.2.73 --- NEWS 23 Apr 2003 20:14:07 -0000 1.337.2.4.2.74 *************** *** 3,6 **** --- 3,10 ---- ============================ + - Implemented os.fsync() for Windows, where it calls the MS _commit() + function. Before, there was no way in core Python to ensure file + writes actually showed up on disk when necessary. + - Make all the strip, lstrip, rstrip functions/methods on string/unicode/UserString consistent by adding and/or From tim_one@users.sourceforge.net Wed Apr 23 21:14:39 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:14:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.74.2.1.2.13,1.74.2.1.2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14722/Doc/lib Modified Files: Tag: release22-maint libos.tex Log Message: fsync(): Implemented for Windows, via calling MS _commit. This counts as "a bug" because there's no other way in core Python to ensure that bytes written are actually on disk. At least ZODB wants this guarantee, for robustness against crashes. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.13 retrieving revision 1.74.2.1.2.14 diff -C2 -d -r1.74.2.1.2.13 -r1.74.2.1.2.14 *** libos.tex 20 Mar 2003 17:42:48 -0000 1.74.2.1.2.13 --- libos.tex 23 Apr 2003 20:14:06 -0000 1.74.2.1.2.14 *************** *** 434,439 **** \begin{funcdesc}{fsync}{fd} ! Force write of file with filedescriptor \var{fd} to disk. ! Availability: \UNIX. \end{funcdesc} --- 434,446 ---- \begin{funcdesc}{fsync}{fd} ! Force write of file with filedescriptor \var{fd} to disk. On \UNIX, ! this calls the native \cfunction{fsync()} function; on Windows, the ! MS \cfunction{_commit()} function. ! ! If you're starting with a Python file object \var{f}, first do ! \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, ! to ensure that all internal buffers associated with \var{f} are written ! to disk. ! Availability: \UNIX, and Windows starting in 2.2.3. \end{funcdesc} From montanaro@users.sourceforge.net Wed Apr 23 21:22:15 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:22:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libnetrc.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20287 Modified Files: libnetrc.tex Log Message: added note about character set limitations in passwords. Index: libnetrc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnetrc.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libnetrc.tex 6 Mar 2001 06:55:18 -0000 1.8 --- libnetrc.tex 23 Apr 2003 20:22:12 -0000 1.9 *************** *** 60,61 **** --- 60,68 ---- Dictionary mapping macro names to string lists. \end{memberdesc} + + \note{Versions of this module before 2.2.3 and 2.3 are very limited to a + subset of the ASCII character set for passwords. Starting with 2.2.3 and + 2.3, ASCII punctuation is allowed in passwords. However, note that spaces + and non-printable characters are not allowed in passwords. This is a + limitation of the way the .netrc file is parsed and should be removed in the + future.} From montanaro@users.sourceforge.net Wed Apr 23 21:35:18 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:35:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libnetrc.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28526 Modified Files: libnetrc.tex Log Message: clarify - restrict version mention to the trunk version Index: libnetrc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnetrc.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libnetrc.tex 23 Apr 2003 20:22:12 -0000 1.9 --- libnetrc.tex 23 Apr 2003 20:35:14 -0000 1.10 *************** *** 61,68 **** \end{memberdesc} ! \note{Versions of this module before 2.2.3 and 2.3 are very limited to a ! subset of the ASCII character set for passwords. Starting with 2.2.3 and ! 2.3, ASCII punctuation is allowed in passwords. However, note that spaces ! and non-printable characters are not allowed in passwords. This is a ! limitation of the way the .netrc file is parsed and should be removed in the ! future.} --- 61,68 ---- \end{memberdesc} ! \note{Passwords are limited to a subset of the ASCII character set. ! Versions of this module prior to 2.3 were extremely limited. Starting with ! 2.3, all ASCII punctuation is allowed in passwords. However, note that ! whitespace and non-printable characters are not allowed in passwords. This ! is a limitation of the way the .netrc file is parsed and may be removed in ! the future.} From montanaro@users.sourceforge.net Wed Apr 23 21:36:21 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:36:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libnetrc.tex,1.8,1.8.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29057 Modified Files: Tag: release22-maint libnetrc.tex Log Message: backport note about password limitations Index: libnetrc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnetrc.tex,v retrieving revision 1.8 retrieving revision 1.8.22.1 diff -C2 -d -r1.8 -r1.8.22.1 *** libnetrc.tex 6 Mar 2001 06:55:18 -0000 1.8 --- libnetrc.tex 23 Apr 2003 20:36:18 -0000 1.8.22.1 *************** *** 60,61 **** --- 60,68 ---- Dictionary mapping macro names to string lists. \end{memberdesc} + + \note{Passwords are limited to a subset of the ASCII character set. + Versions of this module prior to 2.2.3 were extremely limited. Starting + with 2.2.3, all ASCII punctuation is allowed in passwords. However, note + that whitespace and non-printable characters are not allowed in passwords. + This is a limitation of the way the .netrc file is parsed and may be removed + in the future.} From fdrake@users.sourceforge.net Wed Apr 23 21:38:45 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 23 Apr 2003 13:38:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv31173 Modified Files: concrete.tex Log Message: fix some markup errors Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** concrete.tex 23 Apr 2003 19:51:05 -0000 1.23 --- concrete.tex 23 Apr 2003 20:38:41 -0000 1.24 *************** *** 171,175 **** \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongMask}{PyObject *io} Will first attempt to cast the object to a \ctype{PyIntObject} or ! \ctypes{PyLongObject}, if it is not already one, and then return its value as unsigned long. This function does not check for overflow. \versionadded{2.3} --- 171,175 ---- \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongMask}{PyObject *io} Will first attempt to cast the object to a \ctype{PyIntObject} or ! \ctype{PyLongObject}, if it is not already one, and then return its value as unsigned long. This function does not check for overflow. \versionadded{2.3} *************** *** 178,182 **** \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongLongMask}{PyObject *io} Will first attempt to cast the object to a \ctype{PyIntObject} or ! \ctypes{PyLongObject}, if it is not already one, and then return its value as unsigned long long, without checking for overflow. \versionadded{2.3} --- 178,182 ---- \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongLongMask}{PyObject *io} Will first attempt to cast the object to a \ctype{PyIntObject} or ! \ctype{PyLongObject}, if it is not already one, and then return its value as unsigned long long, without checking for overflow. \versionadded{2.3} From bcannon@users.sourceforge.net Thu Apr 24 03:31:17 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 23 Apr 2003 19:31:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib.tex,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29940/Doc/lib Modified Files: liburllib.tex Log Message: Fixed docs for urlretrieve() to match code in the case of opening a local file. Also some typos and removed trailing whitespace on the lines. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** liburllib.tex 9 Mar 2003 05:33:32 -0000 1.45 --- liburllib.tex 24 Apr 2003 02:31:14 -0000 1.46 *************** *** 62,66 **** \var{data} argument may be given to specify a \code{POST} request (normally the request type is \code{GET}). The \var{data} argument ! must in standard \mimetype{application/x-www-form-urlencoded} format; see the \function{urlencode()} function below. --- 62,66 ---- \var{data} argument may be given to specify a \code{POST} request (normally the request type is \code{GET}). The \var{data} argument ! must be in standard \mimetype{application/x-www-form-urlencoded} format; see the \function{urlencode()} function below. *************** *** 79,83 **** \end{verbatim} ! In a Windows environment, if no proxy envvironment variables are set, proxy settings are obtained from the registry's Internet Settings section. --- 79,83 ---- \end{verbatim} ! In a Windows environment, if no proxy environment variables are set, proxy settings are obtained from the registry's Internet Settings section. *************** *** 101,105 **** filehandle = urllib.urlopen(some_url, proxies=None) filehandle = urllib.urlopen(some_url) ! \end{verbatim} The \function{urlopen()} function does not support explicit proxy --- 101,105 ---- filehandle = urllib.urlopen(some_url, proxies=None) filehandle = urllib.urlopen(some_url) ! \end{verbatim} The \function{urlopen()} function does not support explicit proxy *************** *** 120,127 **** \code{(\var{filename}, \var{headers})} where \var{filename} is the local file name under which the object can be found, and \var{headers} ! is either \code{None} (for a local object) or whatever the ! \method{info()} method of the object returned by \function{urlopen()} ! returned (for a remote object, possibly cached). Exceptions are the ! same as for \function{urlopen()}. The second argument, if present, specifies the file location to copy --- 120,126 ---- \code{(\var{filename}, \var{headers})} where \var{filename} is the local file name under which the object can be found, and \var{headers} ! is whatever the \method{info()} method of the object returned by ! \function{urlopen()} returned (for a remote object, possibly cached). ! Exceptions are the same as for \function{urlopen()}. The second argument, if present, specifies the file location to copy *************** *** 132,136 **** count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be \code{-1} on older ! FTP servers which do not return a file size in response to a retrieval request. --- 131,135 ---- count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be \code{-1} on older ! FTP servers which do not return a file size in response to a retrieval request. *************** *** 173,177 **** \begin{funcdesc}{quote}{string\optional{, safe}} Replace special characters in \var{string} using the \samp{\%xx} escape. ! Letters, digits, and the characters \character{_,.-} are never quoted. The optional \var{safe} parameter specifies additional characters that should not be quoted --- its default value is \code{'/'}. --- 172,176 ---- \begin{funcdesc}{quote}{string\optional{, safe}} Replace special characters in \var{string} using the \samp{\%xx} escape. ! Letters, digits, and the characters \character{_.-} are never quoted. The optional \var{safe} parameter specifies additional characters that should not be quoted --- its default value is \code{'/'}. *************** *** 183,187 **** Like \function{quote()}, but also replaces spaces by plus signs, as required for quoting HTML form values. Plus signs in the original ! string are escaped unless they are included in \var{safe}. \end{funcdesc} --- 182,187 ---- Like \function{quote()}, but also replaces spaces by plus signs, as required for quoting HTML form values. Plus signs in the original ! string are escaped unless they are included in \var{safe}. It also ! does not have \var{safe} default to \code{'/'}. \end{funcdesc} *************** *** 199,203 **** \begin{funcdesc}{urlencode}{query\optional{, doseq}} Convert a mapping object or a sequence of two-element tuples to a ! ``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} --- 199,203 ---- \begin{funcdesc}{urlencode}{query\optional{, doseq}} Convert a mapping object or a sequence of two-element tuples to a ! ``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} *************** *** 335,342 **** \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}} ! Open \var{fullurl} using the appropriate protocol. This method sets up cache and proxy information, then calls the appropriate open method with its input arguments. If the scheme is not recognized, ! \method{open_unknown()} is called. The \var{data} argument has the same meaning as the \var{data} argument of \function{urlopen()}. \end{methoddesc} --- 335,342 ---- \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}} ! Open \var{fullurl} using the appropriate protocol. This method sets up cache and proxy information, then calls the appropriate open method with its input arguments. If the scheme is not recognized, ! \method{open_unknown()} is called. The \var{data} argument has the same meaning as the \var{data} argument of \function{urlopen()}. \end{methoddesc} From bcannon@users.sourceforge.net Thu Apr 24 03:43:23 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 23 Apr 2003 19:43:23 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv987/Lib Modified Files: urllib.py Log Message: Fix docstring for URLOpener.retrieve() in regards to opening a local file Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** urllib.py 9 Mar 2003 05:33:33 -0000 1.155 --- urllib.py 24 Apr 2003 02:43:20 -0000 1.156 *************** *** 197,201 **** # External interface def retrieve(self, url, filename=None, reporthook=None, data=None): ! """retrieve(url) returns (filename, None) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(toBytes(url)) --- 197,201 ---- # External interface def retrieve(self, url, filename=None, reporthook=None, data=None): ! """retrieve(url) returns (filename, headers) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(toBytes(url)) From bcannon@users.sourceforge.net Thu Apr 24 03:46:37 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 23 Apr 2003 19:46:37 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.135.6.5,1.135.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1714/Lib Modified Files: Tag: release22-maint urllib.py Log Message: Fix documentation errors in regards to urlretrieve() and local files. Also fix typos in urllib lib doc. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.135.6.5 retrieving revision 1.135.6.6 diff -C2 -d -r1.135.6.5 -r1.135.6.6 *** urllib.py 6 Oct 2002 03:24:29 -0000 1.135.6.5 --- urllib.py 24 Apr 2003 02:46:35 -0000 1.135.6.6 *************** *** 194,198 **** # External interface def retrieve(self, url, filename=None, reporthook=None, data=None): ! """retrieve(url) returns (filename, None) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(toBytes(url)) --- 194,198 ---- # External interface def retrieve(self, url, filename=None, reporthook=None, data=None): ! """retrieve(url) returns (filename, headers) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(toBytes(url)) From bcannon@users.sourceforge.net Thu Apr 24 03:46:37 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 23 Apr 2003 19:46:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib.tex,1.40.8.1,1.40.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1714/Doc/lib Modified Files: Tag: release22-maint liburllib.tex Log Message: Fix documentation errors in regards to urlretrieve() and local files. Also fix typos in urllib lib doc. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.40.8.1 retrieving revision 1.40.8.2 diff -C2 -d -r1.40.8.1 -r1.40.8.2 *** liburllib.tex 22 Oct 2002 21:58:39 -0000 1.40.8.1 --- liburllib.tex 24 Apr 2003 02:46:34 -0000 1.40.8.2 *************** *** 61,65 **** \var{data} argument may be given to specify a \code{POST} request (normally the request type is \code{GET}). The \var{data} argument ! must in standard \mimetype{application/x-www-form-urlencoded} format; see the \function{urlencode()} function below. --- 61,65 ---- \var{data} argument may be given to specify a \code{POST} request (normally the request type is \code{GET}). The \var{data} argument ! must be in standard \mimetype{application/x-www-form-urlencoded} format; see the \function{urlencode()} function below. *************** *** 92,99 **** \code{(\var{filename}, \var{headers})} where \var{filename} is the local file name under which the object can be found, and \var{headers} ! is either \code{None} (for a local object) or whatever the ! \method{info()} method of the object returned by \function{urlopen()} ! returned (for a remote object, possibly cached). Exceptions are the ! same as for \function{urlopen()}. The second argument, if present, specifies the file location to copy --- 92,98 ---- \code{(\var{filename}, \var{headers})} where \var{filename} is the local file name under which the object can be found, and \var{headers} ! is whatever the \method{info()} method of the object returned by ! \function{urlopen()} returned (for a remote object, possibly cached). ! Exceptions are the same as for \function{urlopen()}. The second argument, if present, specifies the file location to copy *************** *** 104,108 **** count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be \code{-1} on older ! FTP servers which do not return a file size in response to a retrieval request. --- 103,107 ---- count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be \code{-1} on older ! FTP servers which do not return a file size in response to a retrieval request. *************** *** 145,149 **** \begin{funcdesc}{quote}{string\optional{, safe}} Replace special characters in \var{string} using the \samp{\%xx} escape. ! Letters, digits, and the characters \character{_,.-} are never quoted. The optional \var{safe} parameter specifies additional characters that should not be quoted --- its default value is \code{'/'}. --- 144,148 ---- \begin{funcdesc}{quote}{string\optional{, safe}} Replace special characters in \var{string} using the \samp{\%xx} escape. ! Letters, digits, and the characters \character{_.-} are never quoted. The optional \var{safe} parameter specifies additional characters that should not be quoted --- its default value is \code{'/'}. *************** *** 155,159 **** Like \function{quote()}, but also replaces spaces by plus signs, as required for quoting HTML form values. Plus signs in the original ! string are escaped unless they are included in \var{safe}. \end{funcdesc} --- 154,159 ---- Like \function{quote()}, but also replaces spaces by plus signs, as required for quoting HTML form values. Plus signs in the original ! string are escaped unless they are included in \var{safe}. It also ! does not have \var{safe} default to \code{'/'}. \end{funcdesc} *************** *** 171,175 **** \begin{funcdesc}{urlencode}{query\optional{, doseq}} Convert a mapping object or a sequence of two-element tuples to a ! ``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} --- 171,175 ---- \begin{funcdesc}{urlencode}{query\optional{, doseq}} Convert a mapping object or a sequence of two-element tuples to a ! ``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} *************** *** 301,308 **** \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}} ! Open \var{fullurl} using the appropriate protocol. This method sets up cache and proxy information, then calls the appropriate open method with its input arguments. If the scheme is not recognized, ! \method{open_unknown()} is called. The \var{data} argument has the same meaning as the \var{data} argument of \function{urlopen()}. \end{methoddesc} --- 301,308 ---- \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}} ! Open \var{fullurl} using the appropriate protocol. This method sets up cache and proxy information, then calls the appropriate open method with its input arguments. If the scheme is not recognized, ! \method{open_unknown()} is called. The \var{data} argument has the same meaning as the \var{data} argument of \function{urlopen()}. \end{methoddesc} From rhettinger@users.sourceforge.net Thu Apr 24 06:45:30 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 22:45:30 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.360,2.361 compile.c,2.280,2.281 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20255/Python Modified Files: ceval.c compile.c Log Message: Revert the previous enhancement to the bytecode optimizer. The additional code complexity and new NOP opcode were not worth it. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.360 retrieving revision 2.361 diff -C2 -d -r2.360 -r2.361 *** ceval.c 22 Apr 2003 06:49:09 -0000 2.360 --- ceval.c 24 Apr 2003 05:45:22 -0000 2.361 *************** *** 874,880 **** /* case STOP_CODE: this is an error! */ - case NOP: - goto fast_next_opcode; - case LOAD_FAST: x = GETLOCAL(oparg); --- 874,877 ---- Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.280 retrieving revision 2.281 diff -C2 -d -r2.280 -r2.281 *** compile.c 22 Apr 2003 06:49:10 -0000 2.280 --- compile.c 24 Apr 2003 05:45:23 -0000 2.281 *************** *** 329,369 **** #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3)) #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 - #define CODESIZE(op) (HAS_ARG(op) ? 3 : 1) - #define ISBASICBLOCK(blocks, start, bytes) (blocks[start]==blocks[start+bytes-1]) - - static unsigned int * - markblocks(unsigned char *code, int len) - { - unsigned int *blocks = PyMem_Malloc(len*sizeof(int)); - int i,j, opcode, oldblock, newblock, blockcnt = 0; - - if (blocks == NULL) - return NULL; - memset(blocks, 0, len*sizeof(int)); - for (i=0 ; i a is not b - not a in b --> a not in b - not a is not b --> a is b - not a not in b --> a in b */ - case COMPARE_OP: - j = GETARG(codestr, i); - if (codestr[i+3] != UNARY_NOT || j < 6 || \ - j > 9 || !ISBASICBLOCK(blocks,i,4)) - continue; - SETARG(codestr, i, (j^1)); - codestr[i+3] = NOP; - break; - /* Replace jumps to unconditional jumps */ case FOR_ITER: --- 387,395 ---- codestr[i+1] = ROT_TWO; codestr[i+2] = JUMP_FORWARD; ! SETARG(codestr, i+2, 1); ! codestr[i+5] = DUP_TOP; } break; /* Replace jumps to unconditional jumps */ case FOR_ITER: *************** *** 476,480 **** case SETUP_FINALLY: tgt = GETJUMPTGT(codestr, i); ! if (!UNCONDITIONAL_JUMP(codestr[tgt])) continue; tgttgt = GETJUMPTGT(codestr, tgt); --- 403,407 ---- case SETUP_FINALLY: tgt = GETJUMPTGT(codestr, i); ! if (!UNCONDITIONAL_JUMP(codestr[tgt])) continue; tgttgt = GETJUMPTGT(codestr, tgt); *************** *** 496,500 **** code = PyString_FromStringAndSize(codestr, codelen); PyMem_Free(codestr); - PyMem_Free(blocks); return code; --- 423,426 ---- From rhettinger@users.sourceforge.net Thu Apr 24 06:45:49 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 22:45:49 -0700 Subject: [Python-checkins] python/dist/src/Include opcode.h,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv20255/Include Modified Files: opcode.h Log Message: Revert the previous enhancement to the bytecode optimizer. The additional code complexity and new NOP opcode were not worth it. Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** opcode.h 22 Apr 2003 06:49:09 -0000 2.42 --- opcode.h 24 Apr 2003 05:45:16 -0000 2.43 *************** *** 15,20 **** #define ROT_FOUR 5 - #define NOP 9 - #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 --- 15,18 ---- From rhettinger@users.sourceforge.net Thu Apr 24 06:45:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 22:45:50 -0700 Subject: [Python-checkins] python/dist/src/Lib opcode.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20255/Lib Modified Files: opcode.py Log Message: Revert the previous enhancement to the bytecode optimizer. The additional code complexity and new NOP opcode were not worth it. Index: opcode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/opcode.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opcode.py 22 Apr 2003 06:49:11 -0000 1.2 --- opcode.py 24 Apr 2003 05:45:17 -0000 1.3 *************** *** 50,55 **** def_op('ROT_FOUR', 5) - def_op('NOP', 9) - def_op('UNARY_POSITIVE', 10) def_op('UNARY_NEGATIVE', 11) --- 50,53 ---- From rhettinger@users.sourceforge.net Thu Apr 24 06:45:54 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 23 Apr 2003 22:45:54 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.742,1.743 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20255/Misc Modified Files: NEWS Log Message: Revert the previous enhancement to the bytecode optimizer. The additional code complexity and new NOP opcode were not worth it. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.742 retrieving revision 1.743 diff -C2 -d -r1.742 -r1.743 *** NEWS 23 Apr 2003 19:35:25 -0000 1.742 --- NEWS 24 Apr 2003 05:45:18 -0000 1.743 *************** *** 307,317 **** will be backported to Python 2.2.3 a well. (SF #660455) - - Added several bytecode optimizations. Provides speed-ups to - inverted in/is tests, inverted jumps, while 1 loops, and jumps to - unconditional jumps. - - - Added a new opcode, NOP, which is used in some of the bytecode - transformations. - - int(s, base) sometimes sign-folds hex and oct constants; it only does this when base is 0 and s.strip() starts with a '0'. When the --- 307,310 ---- From rhettinger@users.sourceforge.net Thu Apr 24 11:41:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 24 Apr 2003 03:41:59 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.87,2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7977 Modified Files: arraymodule.c Log Message: SF 686323: Minor array module enhancements Allows use of tuples for the initializer. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -d -r2.87 -r2.88 *** arraymodule.c 23 Apr 2003 17:27:00 -0000 2.87 --- arraymodule.c 24 Apr 2003 10:41:55 -0000 2.88 *************** *** 1733,1737 **** if (!(initial == NULL || PyList_Check(initial) ! || PyString_Check(initial) || (c == 'u' && PyUnicode_Check(initial)))) { PyErr_SetString(PyExc_TypeError, --- 1733,1737 ---- if (!(initial == NULL || PyList_Check(initial) ! || PyString_Check(initial) || PyTuple_Check(initial) || (c == 'u' && PyUnicode_Check(initial)))) { PyErr_SetString(PyExc_TypeError, *************** *** 1743,1750 **** PyObject *a; int len; ! if (initial == NULL || !PyList_Check(initial)) len = 0; else ! len = PyList_Size(initial); a = newarrayobject(type, len, descr); --- 1743,1752 ---- PyObject *a; int len; ! ! if (initial == NULL || !(PyList_Check(initial) ! || PyTuple_Check(initial))) len = 0; else ! len = PySequence_Size(initial); a = newarrayobject(type, len, descr); *************** *** 1756,1760 **** for (i = 0; i < len; i++) { PyObject *v = ! PyList_GetItem(initial, i); if (setarrayitem(a, i, v) != 0) { Py_DECREF(a); --- 1758,1762 ---- for (i = 0; i < len; i++) { PyObject *v = ! PySequence_GetItem(initial, i); if (setarrayitem(a, i, v) != 0) { Py_DECREF(a); From lemburg@users.sourceforge.net Thu Apr 24 12:36:13 2003 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Thu, 24 Apr 2003 04:36:13 -0700 Subject: [Python-checkins] python/dist/src/Lib platform.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28625/Lib Added Files: platform.py Log Message: New module platform.py, submitted by Marc-Andre Lemburg. There's no separate documentation for this module yet - apart from the doc-strings which explain the APIs. --- NEW FILE: platform.py --- #!/usr/bin/env python """ This module tries to retrieve as much platform identifying data as possible. It makes this information available via function APIs. If called from the command line, it prints the platform information concatenated as single string to stdout. The output format is useable as part of a filename. """ # This module is maintained by Marc-Andre Lemburg . # If you find problems, please submit bug reports/patches via the # Python SourceForge Project Page and assign them to "lemburg". # # Note: Please keep this module compatible to Python 1.5.2. # # Still needed: # * more support for WinCE # * support for MS-DOS (PythonDX ?) [...1193 lines suppressed...] else: bits,linkage = architecture(sys.executable) platform = _platform(system,release,machine,processor,bits,linkage) if aliased: _platform_aliased_cache = platform elif terse: pass else: _platform_cache = platform return platform ### Command line interface if __name__ == '__main__': # Default is to print the aliased verbose platform string terse = ('terse' in sys.argv or '--terse' in sys.argv) aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv) print platform(aliased,terse) sys.exit(0) From lemburg@users.sourceforge.net Thu Apr 24 12:36:14 2003 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Thu, 24 Apr 2003 04:36:14 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.743,1.744 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28625/Misc Modified Files: NEWS Log Message: New module platform.py, submitted by Marc-Andre Lemburg. There's no separate documentation for this module yet - apart from the doc-strings which explain the APIs. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.743 retrieving revision 1.744 diff -C2 -d -r1.743 -r1.744 *** NEWS 24 Apr 2003 05:45:18 -0000 1.743 --- NEWS 24 Apr 2003 11:36:11 -0000 1.744 *************** *** 131,134 **** --- 131,137 ---- ------- + - Added new module "platform" which provides a wide range of tools + for querying platform dependent features. + - netrc now allows Ascii punctuation characters in passwords. From lemburg@users.sourceforge.net Thu Apr 24 12:46:38 2003 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Thu, 24 Apr 2003 04:46:38 -0700 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32432 Modified Files: platform.py Log Message: Reformatted a bit to remove the lengthy re.compile() from the function definitions. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** platform.py 24 Apr 2003 11:36:11 -0000 1.1 --- platform.py 24 Apr 2003 11:46:35 -0000 1.2 *************** *** 32,35 **** --- 32,36 ---- # # History: + # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS # 0.8.0 - added sys.version parser and various new access *************** *** 102,106 **** """ ! __version__ = '1.0.0' import sys,string,os,re --- 103,107 ---- """ ! __version__ = '1.0.1' import sys,string,os,re *************** *** 108,121 **** ### Platform specific APIs def libc_ver(executable=sys.executable,lib='',version='', ! chunksize=2048, ! libc_search=re.compile(r'(__libc_init)' ! '|' ! '(GLIBC_([0-9.]+))' ! '|' ! '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)' ! ) ! ): """ Tries to determine the libc version against which the --- 109,121 ---- ### Platform specific APIs + _libc_search = re.compile(r'(__libc_init)' + '|' + '(GLIBC_([0-9.]+))' + '|' + '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)') + def libc_ver(executable=sys.executable,lib='',version='', ! chunksize=2048): """ Tries to determine the libc version against which the *************** *** 136,140 **** pos = 0 while 1: ! m = libc_search.search(binary,pos) if not m: binary = f.read(chunksize) --- 136,140 ---- pos = 0 while 1: ! m = _libc_search.search(binary,pos) if not m: binary = f.read(chunksize) *************** *** 213,221 **** return distname,version,id def dist(distname='',version='',id='', ! supported_dists=('SuSE','debian','redhat','mandrake'), ! release_filename=re.compile(r'(\w+)[-_](release|version)'), ! release_version=re.compile(r'([\d.]+)[^(]*(?:\((.+)\))?')): """ Tries to determine the name of the OS distribution name --- 213,222 ---- return distname,version,id + _release_filename = re.compile(r'(\w+)[-_](release|version)') + _release_version = re.compile(r'([\d.]+)[^(]*(?:\((.+)\))?') + def dist(distname='',version='',id='', ! supported_dists=('SuSE','debian','redhat','mandrake')): """ Tries to determine the name of the OS distribution name *************** *** 235,239 **** return distname,version,id for file in etc: ! m = release_filename.match(file) if m: _distname,dummy = m.groups() --- 236,240 ---- return distname,version,id for file in etc: ! m = _release_filename.match(file) if m: _distname,dummy = m.groups() *************** *** 246,250 **** firstline = f.readline() f.close() ! m = release_version.search(firstline) if m: _version,_id = m.groups() --- 247,251 ---- firstline = f.readline() f.close() ! m = _release_version.search(firstline) if m: _version,_id = m.groups() *************** *** 366,375 **** return version def _syscmd_ver(system='',release='',version='', ! supported_platforms=('win32','win16','dos','os2'), ! ver_output=re.compile(r'(?:([\w ]+) ([\w.]+) ' ! '.*' ! 'Version ([\d.]+))')): """ Tries to figure out the OS version used and returns --- 367,377 ---- return version + _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) ' + '.*' + 'Version ([\d.]+))') + def _syscmd_ver(system='',release='',version='', ! supported_platforms=('win32','win16','dos','os2')): """ Tries to figure out the OS version used and returns *************** *** 408,412 **** # Parse the output info = string.strip(info) ! m = ver_output.match(info) if m: system,release,version = m.groups() --- 410,414 ---- # Parse the output info = string.strip(info) ! m = _ver_output.match(info) if m: system,release,version = m.groups() *************** *** 809,815 **** } ! def architecture(executable=sys.executable,bits='',linkage='', ! split=re.compile(r'[\s,]').split): """ Queries the given executable (defaults to the Python interpreter --- 811,817 ---- } ! _architecture_split = re.compile(r'[\s,]').split ! def architecture(executable=sys.executable,bits='',linkage=''): """ Queries the given executable (defaults to the Python interpreter *************** *** 859,863 **** # Split the output into a list of strings omitting the filename ! fileout = split(output)[1:] if 'executable' not in fileout: --- 861,865 ---- # Split the output into a list of strings omitting the filename ! fileout = _architecture_split(output)[1:] if 'executable' not in fileout: From akuchling@users.sourceforge.net Thu Apr 24 14:15:17 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:15:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv3871 Modified Files: pep-0004.txt Log Message: Use today's date for rotor deprecation; two grammar tweaks Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0004.txt 24 Apr 2003 13:13:33 -0000 1.8 --- pep-0004.txt 24 Apr 2003 13:15:11 -0000 1.9 *************** *** 87,91 **** Module name: audioop ! Rationale: The module is not actively being used, no mentioning of it was found on deja.com on Oct-1-2000. Date: 1-Oct-2000 --- 87,91 ---- Module name: audioop ! Rationale: The module is not actively being used, no mention of it was found on deja.com on Oct-1-2000. Date: 1-Oct-2000 *************** *** 93,97 **** Module name: rgbimgmodule ! Rationale: The module is not actively being used, no mentioning of it was found on deja.com on Oct-1-2000. Date: 1-Oct-2000 --- 93,97 ---- Module name: rgbimgmodule ! Rationale: The module is not actively being used, no mention of it was found on deja.com on Oct-1-2000. Date: 1-Oct-2000 *************** *** 139,143 **** Module name: rotor Rationale: Uses insecure algorithm. ! Date: 03-Feb-2003 Documentation: TBD --- 139,143 ---- Module name: rotor Rationale: Uses insecure algorithm. ! Date: 24-Apr-2003 Documentation: TBD From akuchling@users.sourceforge.net Thu Apr 24 14:17:16 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:17:16 -0700 Subject: [Python-checkins] python/dist/src/Modules rotormodule.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv5029 Modified Files: rotormodule.c Log Message: [Patch #679505] Trigger DeprecationWarning on importing the rotor module Index: rotormodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/rotormodule.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** rotormodule.c 2 Aug 2002 02:27:13 -0000 2.37 --- rotormodule.c 24 Apr 2003 13:17:13 -0000 2.38 *************** *** 621,623 **** --- 621,627 ---- Rotor_Type.ob_type = &PyType_Type; (void)Py_InitModule("rotor", rotor_methods); + if (PyErr_Warn(PyExc_DeprecationWarning, + "the rotor module uses an insecure algorithm " + "and is deprecated") < 0) + return; } From akuchling@users.sourceforge.net Thu Apr 24 14:18:28 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:18:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_rotor.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv5334 Modified Files: test_rotor.py Log Message: [Patch #679505] Silence DeprecationWarning when testing rotor module Index: test_rotor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rotor.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_rotor.py 12 Dec 2000 23:11:42 -0000 1.5 --- test_rotor.py 24 Apr 2003 13:18:25 -0000 1.6 *************** *** 1,2 **** --- 1,8 ---- + import warnings + + warnings.filterwarnings("ignore", + category=DeprecationWarning, + message='.*is deprecated', module=__name__) + import rotor From akuchling@users.sourceforge.net Thu Apr 24 14:19:14 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:19:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librotor.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5623 Modified Files: librotor.tex Log Message: [Patch #679505] Document that this module is deprecated Index: librotor.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librotor.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** librotor.tex 10 Jun 2002 19:42:43 -0000 1.19 --- librotor.tex 24 Apr 2003 13:19:09 -0000 1.20 *************** *** 5,8 **** --- 5,10 ---- \modulesynopsis{Enigma-like encryption and decryption.} + \deprecated{2.3}{The encryption algorithm is insecure.} + This module implements a rotor-based encryption algorithm, contributed by From akuchling@users.sourceforge.net Thu Apr 24 14:13:37 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:13:37 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv2181 Modified Files: pep-0004.txt Log Message: [Patch #679505] Add rotor module to list of deprecated modules Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0004.txt 25 Sep 2002 22:09:30 -0000 1.7 --- pep-0004.txt 24 Apr 2003 13:13:33 -0000 1.8 *************** *** 137,140 **** --- 137,145 ---- Documentation: TBD + Module name: rotor + Rationale: Uses insecure algorithm. + Date: 03-Feb-2003 + Documentation: TBD + Undeprecated modules From akuchling@users.sourceforge.net Thu Apr 24 14:19:59 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:19:59 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.744,1.745 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv6160 Modified Files: NEWS Log Message: [Patch #679505] Document that the rotor module is deprecated Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.744 retrieving revision 1.745 diff -C2 -d -r1.744 -r1.745 *** NEWS 24 Apr 2003 11:36:11 -0000 1.744 --- NEWS 24 Apr 2003 13:19:56 -0000 1.745 *************** *** 123,126 **** --- 123,130 ---- Added chain() and cycle(). + - The rotor module is now deprecated; the encryption algorithm it uses + is not believed to be secure, and including crypto code with Python + has implications for exporting and importing it in various countries. + - The socket module now always uses the _socketobject wrapper class, even on platforms which have dup(2). The makefile() method is built directly From akuchling@users.sourceforge.net Thu Apr 24 14:23:47 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:23:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.141,1.142 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv7926 Modified Files: whatsnew23.tex Log Message: Mention deprecation of rotor module Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** whatsnew23.tex 19 Apr 2003 15:38:47 -0000 1.141 --- whatsnew23.tex 24 Apr 2003 13:23:43 -0000 1.142 *************** *** 1576,1582 **** (Sticking with Python 2.2 or 2.1 will not make your applications any ! safer, because there are known bugs in the \module{rexec} module in those versions. I repeat, if you're using \module{rexec}, stop using it immediately.) \item The \module{shutil} module gained a \function{move(\var{src}, --- 1576,1587 ---- (Sticking with Python 2.2 or 2.1 will not make your applications any ! safer because there are known bugs in the \module{rexec} module in those versions. I repeat, if you're using \module{rexec}, stop using it immediately.) + + \item The \module{rotor} module has been deprecated because the + algorithm it uses for encryption is not believed to be secure. If + you need encryption, use one of the several AES Python modules + that are available separately. \item The \module{shutil} module gained a \function{move(\var{src}, From fdrake@users.sourceforge.net Thu Apr 24 14:47:11 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 24 Apr 2003 06:47:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librotor.tex,1.18.22.1,1.18.22.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20441 Modified Files: Tag: release22-maint librotor.tex Log Message: Include notice that the rotor module will be deprecated in Python 2.3. Index: librotor.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librotor.tex,v retrieving revision 1.18.22.1 retrieving revision 1.18.22.2 diff -C2 -d -r1.18.22.1 -r1.18.22.2 *** librotor.tex 5 Oct 2002 15:14:33 -0000 1.18.22.1 --- librotor.tex 24 Apr 2003 13:47:08 -0000 1.18.22.2 *************** *** 5,8 **** --- 5,10 ---- \modulesynopsis{Enigma-like encryption and decryption.} + \deprecated{2.3}{The encryption algorithm is insecure.} + This module implements a rotor-based encryption algorithm, contributed by From bwarsaw@users.sourceforge.net Thu Apr 24 15:28:11 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 24 Apr 2003 07:28:11 -0700 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv8885 Modified Files: _bsddb.c Log Message: Added a comment about backward compatibility requirements and a link to the PyBSDDB project at SourceForge. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _bsddb.c 22 Apr 2003 23:13:27 -0000 1.12 --- _bsddb.c 24 Apr 2003 14:28:08 -0000 1.13 *************** *** 52,56 **** * * Use the pybsddb-users@lists.sf.net mailing list for all questions. ! * Things can change faster than the header of this file is updated. * * This module contains 5 types: --- 52,64 ---- * * Use the pybsddb-users@lists.sf.net mailing list for all questions. ! * Things can change faster than the header of this file is updated. This ! * file is shared with the PyBSDDB project at SourceForge: ! * ! * http://pybsddb.sf.net ! * ! * This file should remain backward compatible with Python 2.1, but see PEP ! * 291 for the most current backward compatibility requirements: ! * ! * http://www.python.org/peps/pep-0291.html * * This module contains 5 types: From fdrake@users.sourceforge.net Thu Apr 24 16:24:51 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 24 Apr 2003 08:24:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libundoc.tex,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1782 Modified Files: libundoc.tex Log Message: Note the platform module. Index: libundoc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libundoc.tex,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** libundoc.tex 8 Jan 2003 07:21:53 -0000 1.83 --- libundoc.tex 24 Apr 2003 15:24:46 -0000 1.84 *************** *** 34,37 **** --- 34,45 ---- --- Import hook support (for \refmodule{rexec}; may become obsolete). + \item[\module{platform}] + --- This module tries to retrieve as much platform identifying data as + possible. It makes this information available via function APIs. + If called from the command line, it prints the platform information + concatenated as single string to \code{sys.stdout}. The output format + is useable as part of a filename. + \versionadded{2.3} + \item[\module{smtpd}] --- An SMTP daemon implementation which meets the minimum requirements From rhettinger@users.sourceforge.net Thu Apr 24 16:32:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 24 Apr 2003 08:32:15 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.156,1.157 urllib2.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4720/Lib Modified Files: urllib.py urllib2.py Log Message: SF Patch 549151: urllib2 POSTs on redirect (contributed by John J Lee) Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** urllib.py 24 Apr 2003 02:43:20 -0000 1.156 --- urllib.py 24 Apr 2003 15:32:08 -0000 1.157 *************** *** 587,590 **** --- 587,594 ---- return self.http_error_302(url, fp, errcode, errmsg, headers, data) + def http_error_303(self, url, fp, errcode, errmsg, headers, data=None): + """Error 303 -- also relocated (essentially identical to 302).""" + return self.http_error_302(url, fp, errcode, errmsg, headers, data) + def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** urllib2.py 6 Nov 2002 15:40:05 -0000 1.38 --- urllib2.py 24 Apr 2003 15:32:12 -0000 1.39 *************** *** 12,17 **** HTTPHandler performs HTTP GET and POST requests and deals with non-error returns. The HTTPRedirectHandler automatically deals with ! HTTP 301 & 302 redirect errors, and the HTTPDigestAuthHandler deals ! with digest authentication. urlopen(url, data=None) -- basic usage is that same as original --- 12,17 ---- HTTPHandler performs HTTP GET and POST requests and deals with non-error returns. The HTTPRedirectHandler automatically deals with ! HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler ! deals with digest authentication. urlopen(url, data=None) -- basic usage is that same as original *************** *** 208,211 **** --- 208,217 ---- raise AttributeError, attr + def get_method(self): + if self.has_data(): + return "POST" + else: + return "GET" + def add_data(self, data): self.data = data *************** *** 403,406 **** --- 409,432 ---- class HTTPRedirectHandler(BaseHandler): + def redirect_request(self, req, fp, code, msg, headers): + """Return a Request or None in response to a redirect. + + This is called by the http_error_30x methods when a redirection + response is received. If a redirection should take place, return a new + Request to allow http_error_30x to perform the redirect. Otherwise, + raise HTTPError if no-one else should try to handle this url. Return + None if you can't but another Handler might. + + """ + if (code in (301, 302, 303, 307) and req.method() in ("GET", "HEAD") or + code in (302, 303) and req.method() == "POST"): + # Strictly (according to RFC 2616), 302 in response to a POST + # MUST NOT cause a redirection without confirmation from the user + # (of urllib2, in this case). In practice, essentially all clients + # do redirect in this case, so we do the same. + return Request(newurl, headers=req.headers) + else: + raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) + # Implementation note: To avoid the server sending us into an # infinite loop, the request object needs to track what URLs we *************** *** 419,423 **** # request, although that might interact poorly with other # handlers that also use handler-specific request attributes ! new = Request(newurl, req.get_data(), req.headers) new.error_302_dict = {} if hasattr(req, 'error_302_dict'): --- 445,453 ---- # request, although that might interact poorly with other # handlers that also use handler-specific request attributes ! new = self.redirect_request(req, fp, code, msg, headers) ! if new is None: ! return ! ! # loop detection new.error_302_dict = {} if hasattr(req, 'error_302_dict'): *************** *** 436,440 **** return self.parent.open(new) ! http_error_301 = http_error_302 inf_msg = "The HTTP server returned a redirect error that would" \ --- 466,470 ---- return self.parent.open(new) ! http_error_301 = http_error_303 = http_error_307 = http_error_302 inf_msg = "The HTTP server returned a redirect error that would" \ From rhettinger@users.sourceforge.net Thu Apr 24 16:32:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 24 Apr 2003 08:32:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib.tex,1.46,1.47 liburllib2.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4720/Doc/lib Modified Files: liburllib.tex liburllib2.tex Log Message: SF Patch 549151: urllib2 POSTs on redirect (contributed by John J Lee) Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** liburllib.tex 24 Apr 2003 02:31:14 -0000 1.46 --- liburllib.tex 24 Apr 2003 15:32:06 -0000 1.47 *************** *** 255,264 **** \begin{classdesc}{FancyURLopener}{...} \class{FancyURLopener} subclasses \class{URLopener} providing default ! handling for the following HTTP response codes: 301, 302 or 401. For ! 301 and 302 response codes, the \mailheader{Location} header is used to ! fetch the actual URL. For 401 response codes (authentication ! required), basic HTTP authentication is performed. For 301 and 302 response ! codes, recursion is bounded by the value of the \var{maxtries} attribute, ! which defaults 10. The parameters to the constructor are the same as those for --- 255,270 ---- \begin{classdesc}{FancyURLopener}{...} \class{FancyURLopener} subclasses \class{URLopener} providing default ! handling for the following HTTP response codes: 301, 302, 303 and 401. ! For 301, 302 and 303 response codes, the \mailheader{Location} header ! is used to fetch the actual URL. For 401 response codes ! (authentication required), basic HTTP authentication is performed. ! For 301, 302 and 303 response codes, recursion is bounded by the value ! of the \var{maxtries} attribute, which defaults 10. ! ! \note{According to the letter of \rfc{2616}, 301 and 302 responses to ! POST requests must not be automatically redirected without ! confirmation by the user. In reality, browsers do allow automatic ! redirection of these responses, changing the POST to a GET, and ! \module{urllib} reproduces this behaviour.} The parameters to the constructor are the same as those for Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** liburllib2.tex 9 Nov 2001 03:49:29 -0000 1.6 --- liburllib2.tex 24 Apr 2003 15:32:07 -0000 1.7 *************** *** 218,221 **** --- 218,227 ---- \end{methoddesc} + \begin{methoddesc}[Request]{get_method}{} + Return a string indicating the HTTP request method. This is only + meaningful for HTTP requests, and currently always takes one of the + values ("GET", "POST"). + \end{methoddesc} + \begin{methoddesc}[Request]{has_data}{} Return whether the instance has a non-\code{None} data. *************** *** 395,403 **** \end{methoddesc} - \subsection{HTTPRedirectHandler Objects \label{http-redirect-handler}} ! \note{303 redirection is not supported by this version of ! \module{urllib2}.} \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, --- 401,428 ---- \end{methoddesc} \subsection{HTTPRedirectHandler Objects \label{http-redirect-handler}} ! \note{Some HTTP redirections require action from this module's client ! code. If this is the case, \exception{HTTPError} is raised. See ! \rfc{2616} for details of the precise meanings of the various ! redirection codes.} ! ! \begin{methoddesc}[HTTPRedirectHandler]{redirect_request}{req, ! fp, code, msg, hdrs} ! Return a \class{Request} or \code{None} in response to a redirect. ! This is called by the default implementations of the ! \code{http_error_30x()} methods when a redirection is received from ! the server. If a redirection should take place, return a new ! \class{Request} to allow \code{http_error_30x()} to perform the ! redirect. Otherwise, raise \exception{HTTPError} if no other ! \class{Handler} should try to handle this URL, or return \code{None} ! if you can't but another \class{Handler} might. ! ! \note{The default implementation of this method does not strictly ! follow \rfc{2616}: it allows automatic 302 redirection of POST ! requests, because essentially all HTTP clients do this.} ! ! \end{methoddesc} ! \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, *************** *** 405,409 **** Redirect to the \code{Location:} URL. This method is called by the parent \class{OpenerDirector} when getting an HTTP ! permanent-redirect response. \end{methoddesc} --- 430,434 ---- Redirect to the \code{Location:} URL. This method is called by the parent \class{OpenerDirector} when getting an HTTP ! `moved permanently' response. \end{methoddesc} *************** *** 411,417 **** fp, code, msg, hdrs} The same as \method{http_error_301()}, but called for the ! temporary-redirect response. \end{methoddesc} \subsection{ProxyHandler Objects \label{proxy-handler}} --- 436,447 ---- fp, code, msg, hdrs} The same as \method{http_error_301()}, but called for the ! `found' response. \end{methoddesc} + \begin{methoddesc}[HTTPRedirectHandler]{http_error_303}{req, + fp, code, msg, hdrs} + The same as \method{http_error_301()}, but called for the + `see other' redirect response. + \end{methoddesc} \subsection{ProxyHandler Objects \label{proxy-handler}} From rhettinger@users.sourceforge.net Thu Apr 24 16:50:14 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 24 Apr 2003 08:50:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_StringIO.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14170/Lib/test Modified Files: test_StringIO.py Log Message: SF patch 695710: fix bug 678519: cStringIO self iterator (requested by GvR. patch contributed by Michael Stone) Index: test_StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_StringIO.py 23 Jul 2002 19:03:43 -0000 1.14 --- test_StringIO.py 24 Apr 2003 15:50:10 -0000 1.15 *************** *** 59,66 **** eq = self.assertEqual unless = self.failUnless ! it = iter(self._fp) # Does this object support the iteration protocol? ! unless(hasattr(it, '__iter__')) ! unless(hasattr(it, 'next')) i = 0 for line in self._fp: --- 59,66 ---- eq = self.assertEqual unless = self.failUnless ! eq(iter(self._fp), self._fp) # Does this object support the iteration protocol? ! unless(hasattr(self._fp, '__iter__')) ! unless(hasattr(self._fp, 'next')) i = 0 for line in self._fp: From rhettinger@users.sourceforge.net Thu Apr 24 16:50:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 24 Apr 2003 08:50:15 -0700 Subject: [Python-checkins] python/dist/src/Modules cStringIO.c,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14170/Modules Modified Files: cStringIO.c Log Message: SF patch 695710: fix bug 678519: cStringIO self iterator (requested by GvR. patch contributed by Michael Stone) Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** cStringIO.c 3 Jan 2003 08:24:58 -0000 2.39 --- cStringIO.c 24 Apr 2003 15:50:11 -0000 2.40 *************** *** 3,6 **** --- 3,7 ---- #include "import.h" #include "cStringIO.h" + #include "structmember.h" PyDoc_STRVAR(cStringIO_module_documentation, *************** *** 190,194 **** char *output; ! UNLESS (PyArg_ParseTuple(args, "|i:readline", &m)) return NULL; if( (n=IO_creadline((PyObject*)self,&output)) < 0) return NULL; --- 191,196 ---- char *output; ! if (args) ! UNLESS (PyArg_ParseTuple(args, "|i:readline", &m)) return NULL; if( (n=IO_creadline((PyObject*)self,&output)) < 0) return NULL; *************** *** 277,280 **** --- 279,297 ---- } + static PyObject * + IO_iternext(Iobject *self) + { + PyObject *next; + next = IO_readline((IOobject *)self, NULL); + if (!next) + return NULL; + if (!PyString_GET_SIZE(next)) { + Py_DECREF(next); + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + return next; + } + *************** *** 436,439 **** --- 453,462 ---- }; + static PyMemberDef O_memberlist[] = { + {"softspace", T_INT, offsetof(Oobject, softspace), 0, + "flag indicating that a space needs to be printed; used by print"}, + {NULL} /* Sentinel */ + }; + static void O_dealloc(Oobject *self) { *************** *** 443,493 **** } - static PyObject * - O_getattr(Oobject *self, char *name) { - if (strcmp(name, "softspace") == 0) { - return PyInt_FromLong(self->softspace); - } - return Py_FindMethod(O_methods, (PyObject *)self, name); - } - - static int - O_setattr(Oobject *self, char *name, PyObject *value) { - long x; - if (strcmp(name, "softspace") != 0) { - PyErr_SetString(PyExc_AttributeError, name); - return -1; - } - x = PyInt_AsLong(value); - if (x < 0 && PyErr_Occurred()) - return -1; - self->softspace = x; - return 0; - } - PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); static PyTypeObject Otype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cStringIO.StringO", /*tp_name*/ sizeof(Oobject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ /* methods */ (destructor)O_dealloc, /*tp_dealloc*/ ! (printfunc)0, /*tp_print*/ ! (getattrfunc)O_getattr, /*tp_getattr*/ ! (setattrfunc)O_setattr, /*tp_setattr*/ ! (cmpfunc)0, /*tp_compare*/ ! (reprfunc)0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)0, /*tp_hash*/ (ternaryfunc)0, /*tp_call*/ ! (reprfunc)0, /*tp_str*/ ! ! /* Space for future expansion */ ! 0L,0L,0L,0L, ! Otype__doc__ /* Documentation string */ }; --- 466,503 ---- } PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); static PyTypeObject Otype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cStringIO.StringO", /*tp_name*/ sizeof(Oobject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ /* methods */ (destructor)O_dealloc, /*tp_dealloc*/ ! (printfunc)0, /*tp_print*/ ! 0, /*tp_getattr */ ! 0, /*tp_setattr */ ! (cmpfunc)0, /*tp_compare*/ ! (reprfunc)0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)0, /*tp_hash*/ (ternaryfunc)0, /*tp_call*/ ! (reprfunc)0, /*tp_str*/ ! 0, /*tp_getattro */ ! 0, /*tp_setattro */ ! 0, /*tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ ! Otype__doc__, /*tp_doc */ ! 0, /*tp_traverse */ ! 0, /*tp_clear */ ! 0, /*tp_richcompare */ ! 0, /*tp_weaklistoffset */ ! PyObject_SelfIter, /*tp_iter */ ! (iternextfunc)IO_iternext, /*tp_iternext */ ! O_methods, /*tp_methods */ ! O_memberlist /*tp_members */ }; *************** *** 571,596 **** } - static PyObject * - I_getattr(Iobject *self, char *name) { - return Py_FindMethod(I_methods, (PyObject *)self, name); - } - - static PyObject * - I_getiter(Iobject *self) - { - PyObject *myreadline = PyObject_GetAttrString((PyObject*)self, - "readline"); - PyObject *emptystring = PyString_FromString(""); - PyObject *iter = NULL; - if (!myreadline || !emptystring) - goto finally; - - iter = PyCallIter_New(myreadline, emptystring); - finally: - Py_XDECREF(myreadline); - Py_XDECREF(emptystring); - return iter; - } - PyDoc_STRVAR(Itype__doc__, --- 581,584 ---- *************** *** 606,610 **** (destructor)I_dealloc, /*tp_dealloc*/ (printfunc)0, /*tp_print*/ ! (getattrfunc)I_getattr, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ (cmpfunc)0, /*tp_compare*/ --- 594,598 ---- (destructor)I_dealloc, /*tp_dealloc*/ (printfunc)0, /*tp_print*/ ! 0, /* tp_getattr */ (setattrfunc)0, /*tp_setattr*/ (cmpfunc)0, /*tp_compare*/ *************** *** 625,630 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)I_getiter, /* tp_iter */ ! 0, /* tp_iternext */ }; --- 613,619 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ ! (iternextfunc)IO_iternext, /* tp_iternext */ ! I_methods /* tp_methods */ }; *************** *** 708,711 **** --- 697,702 ---- Itype.ob_type=&PyType_Type; Otype.ob_type=&PyType_Type; + if (PyType_Ready(&Otype) < 0) return; + if (PyType_Ready(&Itype) < 0) return; PyDict_SetItemString(d,"cStringIO_CAPI", v = PyCObject_FromVoidPtr(&CAPI,NULL)); From bwarsaw@users.sourceforge.net Thu Apr 24 16:58:50 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 24 Apr 2003 08:58:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv19059 Modified Files: test_email.py Log Message: Get rid of some hard coded tabs Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_email.py 30 Mar 2003 20:47:22 -0000 1.48 --- test_email.py 24 Apr 2003 15:58:47 -0000 1.49 *************** *** 834,842 **** m = '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); ! Wed, 16 Oct 2002 07:41:11 -0700''' msg = email.message_from_string(m) eq(msg.as_string(), '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with ! Microsoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 ''') --- 834,842 ---- m = '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); ! \tWed, 16 Oct 2002 07:41:11 -0700''' msg = email.message_from_string(m) eq(msg.as_string(), '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with ! \tMicrosoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 ''') *************** *** 852,856 **** eq(msg.as_string(), """\ List: List-Unsubscribe: , ! List: List-Unsubscribe: , --- 852,856 ---- eq(msg.as_string(), """\ List: List-Unsubscribe: , ! \t List: List-Unsubscribe: , From tim_one@users.sourceforge.net Thu Apr 24 17:02:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 24 Apr 2003 09:02:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/dom domreg.py,1.2,1.3 pulldom.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory sc8-pr-cvs1:/tmp/cvs-serv21022/Lib/xml/dom Modified Files: domreg.py pulldom.py Log Message: Whitespace normalization. Index: domreg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/domreg.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** domreg.py 26 Jan 2003 09:04:35 -0000 1.2 --- domreg.py 24 Apr 2003 16:02:53 -0000 1.3 *************** *** 27,31 **** or a new one (e.g. if that implementation supports some customization).""" ! registered[name] = factory --- 27,31 ---- or a new one (e.g. if that implementation supports some customization).""" ! registered[name] = factory *************** *** 49,53 **** be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.""" ! import os creator = None --- 49,53 ---- be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.""" ! import os creator = None Index: pulldom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/pulldom.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pulldom.py 30 Jun 2002 07:32:56 -0000 1.25 --- pulldom.py 24 Apr 2003 16:02:53 -0000 1.26 *************** *** 237,241 **** def __iter__(self): return self ! def expandNode(self, node): event = self.getEvent() --- 237,241 ---- def __iter__(self): return self ! def expandNode(self, node): event = self.getEvent() From tim_one@users.sourceforge.net Thu Apr 24 17:02:58 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 24 Apr 2003 09:02:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/sax handler.py,1.9,1.10 saxutils.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1:/tmp/cvs-serv21022/Lib/xml/sax Modified Files: handler.py saxutils.py Log Message: Whitespace normalization. Index: handler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/handler.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** handler.py 30 Jun 2002 07:38:50 -0000 1.9 --- handler.py 24 Apr 2003 16:02:54 -0000 1.10 *************** *** 327,331 **** # read: return the current encoding (possibly established through # auto-detection. ! # initial value: UTF-8 # --- 327,331 ---- # read: return the current encoding (possibly established through # auto-detection. ! # initial value: UTF-8 # Index: saxutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/saxutils.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** saxutils.py 28 Oct 2002 18:09:41 -0000 1.20 --- saxutils.py 24 Apr 2003 16:02:54 -0000 1.21 *************** *** 21,25 **** def escape(data, entities={}): """Escape &, <, and > in a string of data. ! You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be --- 21,25 ---- def escape(data, entities={}): """Escape &, <, and > in a string of data. ! You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be From tim_one@users.sourceforge.net Thu Apr 24 17:03:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 24 Apr 2003 09:03:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/bsddb __init__.py,1.4,1.5 dbobj.py,1.5,1.6 dbshelve.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv21022/Lib/bsddb Modified Files: __init__.py dbobj.py dbshelve.py Log Message: Whitespace normalization. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 28 Jan 2003 17:20:41 -0000 1.4 --- __init__.py 24 Apr 2003 16:02:44 -0000 1.5 *************** *** 44,48 **** del sys.modules[__name__] raise ! # bsddb3 calls it db, but provide _db for backwards compatibility db = _db = _bsddb --- 44,48 ---- del sys.modules[__name__] raise ! # bsddb3 calls it db, but provide _db for backwards compatibility db = _db = _bsddb Index: dbobj.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbobj.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dbobj.py 8 Feb 2003 03:18:33 -0000 1.5 --- dbobj.py 24 Apr 2003 16:02:45 -0000 1.6 *************** *** 193,195 **** def set_encrypt(self, *args, **kwargs): return apply(self._cobj.set_encrypt, args, kwargs) - --- 193,194 ---- Index: dbshelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbshelve.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dbshelve.py 8 Feb 2003 03:18:58 -0000 1.7 --- dbshelve.py 24 Apr 2003 16:02:46 -0000 1.8 *************** *** 297,301 **** #--------------------------------------------------------------------------- - - - --- 297,298 ---- From tim_one@users.sourceforge.net Thu Apr 24 17:03:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 24 Apr 2003 09:03:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/csv __init__.py,1.2,1.3 csv.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv In directory sc8-pr-cvs1:/tmp/cvs-serv21022/Lib/csv Modified Files: __init__.py csv.py Log Message: Whitespace normalization. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 10 Apr 2003 17:16:14 -0000 1.2 --- __init__.py 24 Apr 2003 16:02:46 -0000 1.3 *************** *** 1,2 **** from csv import * - --- 1 ---- Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv/csv.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csv.py 20 Mar 2003 23:29:12 -0000 1.1 --- csv.py 24 Apr 2003 16:02:47 -0000 1.2 *************** *** 117,121 **** if extrasaction.lower() not in ("raise", "ignore"): raise ValueError, \ ! ("extrasaction (%s) must be 'raise' or 'ignore'" % extrasaction) self.extrasaction = extrasaction --- 117,121 ---- if extrasaction.lower() not in ("raise", "ignore"): raise ValueError, \ ! ("extrasaction (%s) must be 'raise' or 'ignore'" % extrasaction) self.extrasaction = extrasaction *************** *** 127,131 **** if k not in self.fieldnames: raise ValueError, "dict contains fields not in fieldnames" ! return [rowdict.get(key, self.restval) for key in self.fieldnames] def writerow(self, rowdict): --- 127,131 ---- if k not in self.fieldnames: raise ValueError, "dict contains fields not in fieldnames" ! return [rowdict.get(key, self.restval) for key in self.fieldnames] def writerow(self, rowdict): From tim_one@users.sourceforge.net Thu Apr 24 17:03:18 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 24 Apr 2003 09:03:18 -0700 Subject: [Python-checkins] python/dist/src/Lib DocXMLRPCServer.py,1.1,1.2 _strptime.py,1.14,1.15 markupbase.py,1.7,1.8 optparse.py,1.3,1.4 platform.py,1.2,1.3 sgmllib.py,1.43,1.44 shelve.py,1.21,1.22 stringprep.py,1.1,1.2 trace.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21022/Lib Modified Files: DocXMLRPCServer.py _strptime.py markupbase.py optparse.py platform.py sgmllib.py shelve.py stringprep.py trace.py Log Message: Whitespace normalization. Index: DocXMLRPCServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/DocXMLRPCServer.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DocXMLRPCServer.py 18 Apr 2003 21:04:38 -0000 1.1 --- DocXMLRPCServer.py 24 Apr 2003 16:02:41 -0000 1.2 *************** *** 23,27 **** class ServerHTMLDoc(pydoc.HTMLDoc): """Class used to generate pydoc HTML document for a server""" ! def markup(self, text, escape=None, funcs={}, classes={}, methods={}): """Mark up some plain text, given a context of symbols to look for. --- 23,27 ---- class ServerHTMLDoc(pydoc.HTMLDoc): """Class used to generate pydoc HTML document for a server""" ! def markup(self, text, escape=None, funcs={}, classes={}, methods={}): """Mark up some plain text, given a context of symbols to look for. *************** *** 64,68 **** results.append(escape(text[here:])) return ''.join(results) ! def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): --- 64,68 ---- results.append(escape(text[here:])) return ''.join(results) ! def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): *************** *** 73,77 **** title = '%s' % (anchor, name) ! if inspect.ismethod(object): args, varargs, varkw, defaults = inspect.getargspec(object.im_func) --- 73,77 ---- title = '%s' % (anchor, name) ! if inspect.ismethod(object): args, varargs, varkw, defaults = inspect.getargspec(object.im_func) *************** *** 97,101 **** else: docstring = pydoc.getdoc(object) ! decl = title + argspec + (note and self.grey( '%s' % note)) --- 97,101 ---- else: docstring = pydoc.getdoc(object) ! decl = title + argspec + (note and self.grey( '%s' % note)) *************** *** 113,120 **** fdict[key] = '#-' + key fdict[value] = fdict[key] ! ! head = '%s' % server_name result = self.heading(head, '#ffffff', '#7799ee') ! doc = self.markup(package_documentation, self.preformat, fdict) doc = doc and '%s' % doc --- 113,120 ---- fdict[key] = '#-' + key fdict[value] = fdict[key] ! ! head = '%s' % server_name result = self.heading(head, '#ffffff', '#7799ee') ! doc = self.markup(package_documentation, self.preformat, fdict) doc = doc and '%s' % doc *************** *** 137,141 **** be constructed directly. """ ! def __init__(self): # setup variables used for HTML documentation --- 137,141 ---- be constructed directly. """ ! def __init__(self): # setup variables used for HTML documentation *************** *** 171,175 **** _methodHelp(method_name) method to provide the help text used in the documentation.""" ! methods = {} --- 171,175 ---- _methodHelp(method_name) method to provide the help text used in the documentation.""" ! methods = {} *************** *** 209,213 **** methods ) ! return documenter.page(self.server_title, documentation) --- 209,213 ---- methods ) ! return documenter.page(self.server_title, documentation) *************** *** 228,232 **** documentation. """ ! response = self.server.generate_html_documentation() self.send_response(200) --- 228,232 ---- documentation. """ ! response = self.server.generate_html_documentation() self.send_response(200) *************** *** 252,256 **** SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests) XMLRPCDocGenerator.__init__(self) ! class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, XMLRPCDocGenerator): --- 252,256 ---- SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests) XMLRPCDocGenerator.__init__(self) ! class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, XMLRPCDocGenerator): *************** *** 282,287 **** Converts an angle in degrees to an angle in radians""" import math ! return deg * math.pi / 180 ! server = DocXMLRPCServer(("localhost", 8000)) --- 282,287 ---- Converts an angle in degrees to an angle in radians""" import math ! return deg * math.pi / 180 ! server = DocXMLRPCServer(("localhost", 8000)) *************** *** 300,302 **** server.register_introspection_functions() ! server.serve_forever() \ No newline at end of file --- 300,302 ---- server.register_introspection_functions() ! server.serve_forever() Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** _strptime.py 19 Apr 2003 04:00:54 -0000 1.14 --- _strptime.py 24 Apr 2003 16:02:41 -0000 1.15 *************** *** 375,382 **** def pattern(self, format): """Return re pattern for the format string. ! Need to make sure that any characters that might be interpreted as regex syntax is escaped. ! """ processed_format = '' --- 375,382 ---- def pattern(self, format): """Return re pattern for the format string. ! Need to make sure that any characters that might be interpreted as regex syntax is escaped. ! """ processed_format = '' *************** *** 529,531 **** else: raise ValueError("value not in list") - --- 529,530 ---- Index: markupbase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/markupbase.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** markupbase.py 30 Mar 2003 14:25:39 -0000 1.7 --- markupbase.py 24 Apr 2003 16:02:42 -0000 1.8 *************** *** 61,70 **** # deployed," this should only be the document type # declaration (""). ! # ISO 8879:1986, however, has more complex # declaration syntax for elements in , including: # --comment-- # [marked section] ! # name in the following list: ENTITY, DOCTYPE, ELEMENT, ! # ATTLIST, NOTATION, SHORTREF, USEMAP, # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM rawdata = self.rawdata --- 61,70 ---- # deployed," this should only be the document type # declaration (""). ! # ISO 8879:1986, however, has more complex # declaration syntax for elements in , including: # --comment-- # [marked section] ! # name in the following list: ENTITY, DOCTYPE, ELEMENT, ! # ATTLIST, NOTATION, SHORTREF, USEMAP, # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM rawdata = self.rawdata *************** *** 152,156 **** self.unknown_decl(rawdata[i+3: j]) return match.end(0) ! # Internal -- parse comment, return length or -1 if not terminated def parse_comment(self, i, report=1): --- 152,156 ---- self.unknown_decl(rawdata[i+3: j]) return match.end(0) ! # Internal -- parse comment, return length or -1 if not terminated def parse_comment(self, i, report=1): Index: optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/optparse.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** optparse.py 21 Apr 2003 02:40:34 -0000 1.3 --- optparse.py 24 Apr 2003 16:02:42 -0000 1.4 *************** *** 1381,1383 **** # classes. make_option = Option - --- 1381,1382 ---- Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** platform.py 24 Apr 2003 11:46:35 -0000 1.2 --- platform.py 24 Apr 2003 16:02:42 -0000 1.3 *************** *** 111,116 **** _libc_search = re.compile(r'(__libc_init)' '|' ! '(GLIBC_([0-9.]+))' ! '|' '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)') --- 111,116 ---- _libc_search = re.compile(r'(__libc_init)' '|' ! '(GLIBC_([0-9.]+))' ! '|' '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)') *************** *** 127,131 **** Note that the function has intimate knowledge of how different libc versions add symbols to the executable is probably only ! useable for executables compiled using gcc. The file is read and scanned in chunks of chunksize bytes. --- 127,131 ---- Note that the function has intimate knowledge of how different libc versions add symbols to the executable is probably only ! useable for executables compiled using gcc. The file is read and scanned in chunks of chunksize bytes. *************** *** 165,169 **** def _dist_try_harder(distname,version,id): ! """ Tries some special tricks to get the distribution information in case the default method fails. --- 165,169 ---- def _dist_try_harder(distname,version,id): ! """ Tries some special tricks to get the distribution information in case the default method fails. *************** *** 377,381 **** """ Tries to figure out the OS version used and returns a tuple (system,release,version). ! It uses the "ver" shell command for this which is known to exists on Windows, DOS and OS/2. XXX Others too ? --- 377,381 ---- """ Tries to figure out the OS version used and returns a tuple (system,release,version). ! It uses the "ver" shell command for this which is known to exists on Windows, DOS and OS/2. XXX Others too ? *************** *** 502,506 **** except: return release,version,csd,ptype ! # Parse values #subversion = _win32_getvalue(keyCurVer, --- 502,506 ---- except: return release,version,csd,ptype ! # Parse values #subversion = _win32_getvalue(keyCurVer, *************** *** 582,586 **** versioninfo = (version,stage,nonrel) if sysa: ! machine = {0x1: '68k', 0x2: 'PowerPC'}.get(sysa,'') return release,versioninfo,machine --- 582,586 ---- versioninfo = (version,stage,nonrel) if sysa: ! machine = {0x1: '68k', 0x2: 'PowerPC'}.get(sysa,'') return release,versioninfo,machine *************** *** 595,599 **** def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')): ! """ Version interface for JPython. --- 595,599 ---- def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')): ! """ Version interface for JPython. *************** *** 624,628 **** os_version = _java_getprop('java.os.version',os_version) osinfo = os_name,os_version,os_arch ! return release,vendor,vminfo,osinfo --- 624,628 ---- os_version = _java_getprop('java.os.version',os_version) osinfo = os_name,os_version,os_arch ! return release,vendor,vminfo,osinfo *************** *** 844,848 **** size = struct.calcsize('l') bits = str(size*8) + 'bit' ! # Get data from the 'file' system command output = _syscmd_file(executable,'') --- 844,848 ---- size = struct.calcsize('l') bits = str(size*8) + 'bit' ! # Get data from the 'file' system command output = _syscmd_file(executable,'') *************** *** 851,855 **** executable == sys.executable: # "file" command did not return anything; we'll try to provide ! # some sensible defaults then... if _default_architecture.has_key(sys.platform): b,l = _default_architecture[sys.platform] --- 851,855 ---- executable == sys.executable: # "file" command did not return anything; we'll try to provide ! # some sensible defaults then... if _default_architecture.has_key(sys.platform): b,l = _default_architecture[sys.platform] *************** *** 862,866 **** # Split the output into a list of strings omitting the filename fileout = _architecture_split(output)[1:] ! if 'executable' not in fileout: # Format not supported --- 862,866 ---- # Split the output into a list of strings omitting the filename fileout = _architecture_split(output)[1:] ! if 'executable' not in fileout: # Format not supported *************** *** 896,900 **** ### Portable uname() interface ! _uname_cache = None --- 896,900 ---- ### Portable uname() interface ! _uname_cache = None *************** *** 935,939 **** if release and version: use_syscmd_ver = 0 ! # Try the 'ver' system command available on some # platforms --- 935,939 ---- if release and version: use_syscmd_ver = 0 ! # Try the 'ver' system command available on some # platforms *************** *** 1141,1145 **** """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). ! The output is intended to be human readable rather than machine parseable. It may look different on different --- 1141,1145 ---- """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). ! The output is intended to be human readable rather than machine parseable. It may look different on different *************** *** 1216,1220 **** bits,linkage = architecture(sys.executable) platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased: _platform_aliased_cache = platform --- 1216,1220 ---- bits,linkage = architecture(sys.executable) platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased: _platform_aliased_cache = platform *************** *** 1229,1233 **** if __name__ == '__main__': # Default is to print the aliased verbose platform string ! terse = ('terse' in sys.argv or '--terse' in sys.argv) aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv) print platform(aliased,terse) --- 1229,1233 ---- if __name__ == '__main__': # Default is to print the aliased verbose platform string ! terse = ('terse' in sys.argv or '--terse' in sys.argv) aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv) print platform(aliased,terse) Index: sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** sgmllib.py 30 Mar 2003 14:25:39 -0000 1.43 --- sgmllib.py 24 Apr 2003 16:02:42 -0000 1.44 *************** *** 145,152 **** continue if rawdata.startswith(" (host, port) - socket.AF_INET, socket.SOCK_STREAM, etc.: constants from + - socket.has_ipv6: boolean value indicating if IPv6 is supported - socket.inet_aton(IP address) -> 32-bit packed IP representation - socket.inet_ntoa(packed IP) -> IP address string *************** *** 63,66 **** --- 64,70 ---- #include "Python.h" + #undef MAX + #define MAX(x, y) ((x) < (y) ? (y) : (x)) + /* Socket object documentation */ PyDoc_STRVAR(sock_doc, *************** *** 2777,2780 **** --- 2781,2878 ---- } + #ifdef HAVE_INET_PTON + + PyDoc_STRVAR(inet_pton_doc, + "inet_pton(af, ip) -> packed IP address string\n\ + \n\ + Convert an IP address from string format to a packed string suitable\n\ + for use with low-level network functions."); + + static PyObject * + socket_inet_pton(PyObject *self, PyObject *args) + { + int af; + char* ip; + int retval; + char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))]; + + if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) { + return NULL; + } + + retval = inet_pton(af, ip, packed); + if (retval < 0) { + PyErr_SetFromErrno(socket_error); + return NULL; + } else if (retval == 0) { + PyErr_SetString(socket_error, + "illegal IP address string passed to inet_pton"); + return NULL; + } else if (af == AF_INET) { + return PyString_FromStringAndSize(packed, + sizeof(struct in_addr)); + } else if (af == AF_INET6) { + return PyString_FromStringAndSize(packed, + sizeof(struct in6_addr)); + } else { + PyErr_SetString(socket_error, "unknown address family"); + return NULL; + } + } + + PyDoc_STRVAR(inet_ntop_doc, + "inet_ntop(af, packed_ip) -> string formatted IP address\n\ + \n\ + Convert a packed IP address of the given family to string format."); + + static PyObject * + socket_inet_ntop(PyObject *self, PyObject *args) + { + int af; + char* packed; + int len; + const char* retval; + char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1]; + + /* Guarantee NUL-termination for PyString_FromString() below */ + memset((void *) &ip[0], '\0', sizeof(ip) + 1); + + if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) { + return NULL; + } + + if (af == AF_INET) { + if (len != sizeof(struct in_addr)) { + PyErr_SetString(PyExc_ValueError, + "invalid length of packed IP address string"); + return NULL; + } + } else if (af == AF_INET6) { + if (len != sizeof(struct in6_addr)) { + PyErr_SetString(PyExc_ValueError, + "invalid length of packed IP address string"); + return NULL; + } + } else { + PyErr_Format(PyExc_ValueError, + "unknown address family %d", af); + return NULL; + } + + retval = inet_ntop(af, packed, ip, sizeof(ip)); + if (!retval) { + PyErr_SetFromErrno(socket_error); + return NULL; + } else { + return PyString_FromString(retval); + } + + /* NOTREACHED */ + PyErr_SetString(PyExc_RuntimeError, "invalid handling of inet_ntop"); + return NULL; + } + + #endif /* HAVE_INET_PTON */ + /* Python interface to getaddrinfo(host, port). */ *************** *** 3036,3039 **** --- 3134,3143 ---- {"inet_ntoa", socket_inet_ntoa, METH_VARARGS, inet_ntoa_doc}, + #ifdef HAVE_INET_PTON + {"inet_pton", socket_inet_pton, + METH_VARARGS, inet_pton_doc}, + {"inet_ntop", socket_inet_ntop, + METH_VARARGS, inet_ntop_doc}, + #endif {"getaddrinfo", socket_getaddrinfo, METH_VARARGS, getaddrinfo_doc}, *************** *** 3179,3183 **** init_socket(void) { ! PyObject *m; if (!os_init()) --- 3283,3287 ---- init_socket(void) { ! PyObject *m, *has_ipv6; if (!os_init()) *************** *** 3215,3218 **** --- 3319,3330 ---- return; + #ifdef ENABLE_IPV6 + has_ipv6 = Py_True; + #else + has_ipv6 = Py_False; + #endif + Py_INCREF(has_ipv6); + PyModule_AddObject(m, "has_ipv6", has_ipv6); + /* Export C API */ if (PyModule_AddObject(m, PySocket_CAPI_NAME, *************** *** 3801,3804 **** --- 3913,3917 ---- /* Simplistic emulation code for inet_pton that only works for IPv4 */ + /* These are not exposed because they do not set errno properly */ int From gvanrossum@users.sourceforge.net Fri Apr 25 06:52:40 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 24 Apr 2003 22:52:40 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.747,1.748 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28103 Modified Files: NEWS Log Message: Move socket news to 2.3b1 section! And mention has_ipv6. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.747 retrieving revision 1.748 diff -C2 -d -r1.747 -r1.748 *** NEWS 25 Apr 2003 05:48:32 -0000 1.747 --- NEWS 25 Apr 2003 05:52:37 -0000 1.748 *************** *** 84,87 **** --- 84,92 ---- ----------------- + - The socket module now provides the functions inet_pton and inet_ntop + for converting between string and packed representation of IP + addresses. There is also a new module variable, has_ipv6, which is + True iff the current Python has IPv6 support. See SF patch #658327. + - Tkinter wrappers around Tcl variables now pass objects directly to Tcl, instead of first converting them to strings. *************** *** 383,390 **** zlib test suite using the unittest module. (SF bug #640230 and patch #678531.) - - - The socket module now provides the functions inet_pton and inet_ntop - for converting between string and packed representation of IP addresses. - See SF patch #658327. - Added an itertools module containing high speed, memory efficient --- 388,391 ---- From python@rcn.com Fri Apr 25 07:16:54 2003 From: python@rcn.com (Raymond Hettinger) Date: Fri, 25 Apr 2003 02:16:54 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.61,1.62 References: Message-ID: <002901c30af2$4c459da0$1a3cc797@oemcomputer> Two of the test cases are failing in test_socket.py on a fresh build for WinMe: testIPv4toString (__main__.GeneralModuleTests) ... ERROR testStringToIPv4 (__main__.GeneralModuleTests) ... ERROR Raymond Hettinger From tim_one@users.sourceforge.net Fri Apr 25 08:11:52 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 25 Apr 2003 00:11:52 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.748,1.749 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13702/Misc Modified Files: NEWS Log Message: New generator os.walk() does a bit more than os.path.walk() does, and seems much easier to use. Code, docs, NEWS, and additions to test_os.py (testing this sucker is a bitch!). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.748 retrieving revision 1.749 diff -C2 -d -r1.748 -r1.749 *** NEWS 25 Apr 2003 05:52:37 -0000 1.748 --- NEWS 25 Apr 2003 07:11:48 -0000 1.749 *************** *** 128,132 **** Added chain() and cycle(). ! - The rotor module is now deprecated; the encryption algorithm it uses is not believed to be secure, and including crypto code with Python has implications for exporting and importing it in various countries. --- 128,132 ---- Added chain() and cycle(). ! - The rotor module is now deprecated; the encryption algorithm it uses is not believed to be secure, and including crypto code with Python has implications for exporting and importing it in various countries. *************** *** 139,142 **** --- 139,147 ---- Library ------- + + - New generator function os.walk() is an easy-to-use alternative to + os.path.walk(). See os module docs for details. os.path.walk() + isn't deprecated at this time, but may become deprecated in a + future release. - Added new module "platform" which provides a wide range of tools From tim_one@users.sourceforge.net Fri Apr 25 08:12:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 25 Apr 2003 00:12:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.118,1.119 libposixpath.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13702/Doc/lib Modified Files: libos.tex libposixpath.tex Log Message: New generator os.walk() does a bit more than os.path.walk() does, and seems much easier to use. Code, docs, NEWS, and additions to test_os.py (testing this sucker is a bitch!). Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** libos.tex 23 Apr 2003 19:47:14 -0000 1.118 --- libos.tex 25 Apr 2003 07:11:47 -0000 1.119 *************** *** 1051,1054 **** --- 1051,1119 ---- \end{funcdesc} + \begin{funcdesc}{walk}{top\optional{, topdown=True}} + \index{directory!walking} + \index{directory!traversal} + + \function{walk()} generates the file names in a directory tree. + For each directory in the tree rooted at directory \var{top} (including + \var{top} itself), it yields a 3-tuple + \code{(\var{dirpath}, \var{dirnames}, \var{filenames})}. + + \var{dirpath} is a string, the path to the directory. \var{dirnames} is + a list of the names of the subdirectories in \var{dirpath} + (excluding \code{'.'} and \code{'..'}). \var{filenames} is a list of + the names of the non-directory files in \var{dirpath}. Note that the + names in the lists contain no path components. To get a full + path (which begins with \var{top)) to a file or directory in + \var{dirpath}, do \code{os.path.join(\var{dirpath}, \var{name})}. + + If optional argument \var{topdown} is true or not specified, the triple + for a directory is generated before the triples for any of its + subdirectories (directories are generated top down). If \var{topdown} is + false, the triple for a directory is generated after the triples for all + of its subdirectories (directories are generated bottom up). + + When \var{topdown} is true, the caller can modify the \var{dirnames} list + in-place (e.g., via \keyword{del} or slice assignment), and + \function{walk()} will only recurse into the subdirectories whose names + remain in \var{dirnames}; this can be used to prune the search, + impose a specific order of visiting, or even to inform \function{walk()} + about directories the caller creates or renames before it resumes + \function{walk()} again. Modifying \var{dirnames} when \var{topdown} is + false is ineffective, because in bottom-up mode the directories in + \var{dirnames} are generated before \var{dirnames} itself is generated. + + \begin{notice} + If you pass a relative pathname, don't change the current working + directory between resumptions of \function{walk}. \function{walk} + never changes the current directory, and assumes that its caller + doesn't either. + \end{notice} + + \begin{notice} + On systems that support symbolic links, links to subdirectories appear + in \var{dirnames} lists, but \function{walk()} will not visit them + (infinite loops are hard to avoid when following symbolic links). + To visit linked directories, you can identify them with + \code{os.path.islink(\var{path})}, and invoke \function{walk(\var{path})} + on each directly. + \end{notice} + + This example displays the number of bytes taken by non-directory files + in each directory under the starting directory, except that it doesn't + look under any CVS subdirectory: + + \begin{verbatim} + import os + from os.path import join, getsize + for root, dirs, files in os.walk('python/Lib/email'): + print root, "consumes", + print sum([getsize(join(root, name)) for name in files]), + print "bytes in", len(files), "non-directory files" + if 'CVS' in dirs: + dirs.remove('CVS') # don't visit CVS directories + \end{verbatim} + \versionadded{2.3} + \end{funcdesc} \subsection{Process Management \label{os-process}} Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** libposixpath.tex 4 Feb 2003 19:13:07 -0000 1.33 --- libposixpath.tex 25 Apr 2003 07:11:47 -0000 1.34 *************** *** 238,241 **** --- 238,247 ---- necessary. \end{notice} + + \begin{seealso} + \seemodule{os}{The newer \function{os.walk()} generator supplies similar + functionality and can be easier to use. + \end{seealso} + \end{funcdesc} From tim_one@users.sourceforge.net Fri Apr 25 08:12:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 25 Apr 2003 00:12:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13702/Lib/test Modified Files: test_os.py Log Message: New generator os.walk() does a bit more than os.path.walk() does, and seems much easier to use. Code, docs, NEWS, and additions to test_os.py (testing this sucker is a bitch!). Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_os.py 9 Mar 2003 07:05:13 -0000 1.14 --- test_os.py 25 Apr 2003 07:11:48 -0000 1.15 *************** *** 203,211 **** os.environ.update(self.__save) def test_main(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TemporaryFileTests)) ! suite.addTest(unittest.makeSuite(StatAttributeTests)) ! suite.addTest(unittest.makeSuite(EnvironTests)) run_suite(suite) --- 203,293 ---- os.environ.update(self.__save) + class WalkTests(unittest.TestCase): + """Tests for os.walk().""" + + def test_traversal(self): + import os + from os.path import join + + # Build: + # TESTFN/ a file kid and two directory kids + # tmp1 + # SUB1/ a file kid and a directory kid + # tmp2 + # SUB11/ no kids + # SUB2/ just a file kid + # tmp3 + sub1_path = join(TESTFN, "SUB1") + sub11_path = join(sub1_path, "SUB11") + sub2_path = join(TESTFN, "SUB2") + tmp1_path = join(TESTFN, "tmp1") + tmp2_path = join(sub1_path, "tmp2") + tmp3_path = join(sub2_path, "tmp3") + + # Create stuff. + os.makedirs(sub11_path) + os.makedirs(sub2_path) + for path in tmp1_path, tmp2_path, tmp3_path: + f = file(path, "w") + f.write("I'm " + path + " and proud of it. Blame test_os.\n") + f.close() + + # Walk top-down. + all = list(os.walk(TESTFN)) + self.assertEqual(len(all), 4) + # We can't know which order SUB1 and SUB2 will appear in. + # Not flipped: TESTFN, SUB1, SUB11, SUB2 + # flipped: TESTFN, SUB2, SUB1, SUB11 + flipped = all[0][1][0] != "SUB1" + all[0][1].sort() + self.assertEqual(all[0], (TESTFN, ["SUB1", "SUB2"], ["tmp1"])) + self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) + self.assertEqual(all[2 + flipped], (sub11_path, [], [])) + self.assertEqual(all[3 - 2 * flipped], (sub2_path, [], ["tmp3"])) + + # Prune the search. + all = [] + for root, dirs, files in os.walk(TESTFN): + all.append((root, dirs, files)) + # Don't descend into SUB1. + if 'SUB1' in dirs: + # Note that this also mutates the dirs we appended to all! + dirs.remove('SUB1') + self.assertEqual(len(all), 2) + self.assertEqual(all[0], (TESTFN, ["SUB2"], ["tmp1"])) + self.assertEqual(all[1], (sub2_path, [], ["tmp3"])) + + # Walk bottom-up. + all = list(os.walk(TESTFN, topdown=False)) + self.assertEqual(len(all), 4) + # We can't know which order SUB1 and SUB2 will appear in. + # Not flipped: SUB11, SUB1, SUB2, TESTFN + # flipped: SUB2, SUB11, SUB1, TESTFN + flipped = all[3][1][0] != "SUB1" + all[3][1].sort() + self.assertEqual(all[3], (TESTFN, ["SUB1", "SUB2"], ["tmp1"])) + self.assertEqual(all[flipped], (sub11_path, [], [])) + self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) + self.assertEqual(all[2 - 2 * flipped], (sub2_path, [], ["tmp3"])) + + # Tear everything down. This is a decent use for bottom-up on + # Windows, which doesn't have a recursive delete command. The + # (not so) subtlety is that rmdir will fail unless the dir's + # kids are removed first, so bottom up is essential. + for root, dirs, files in os.walk(TESTFN, topdown=False): + for name in files: + os.remove(join(root, name)) + for name in dirs: + os.rmdir(join(root, name)) + os.rmdir(TESTFN) + def test_main(): suite = unittest.TestSuite() ! for cls in (TemporaryFileTests, ! StatAttributeTests, ! EnvironTests, ! WalkTests, ! ): ! suite.addTest(unittest.makeSuite(cls)) run_suite(suite) From tim_one@users.sourceforge.net Fri Apr 25 08:12:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 25 Apr 2003 00:12:20 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13702/Lib Modified Files: os.py Log Message: New generator os.walk() does a bit more than os.path.walk() does, and seems much easier to use. Code, docs, NEWS, and additions to test_os.py (testing this sucker is a bitch!). Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** os.py 27 Feb 2003 20:14:37 -0000 1.69 --- os.py 25 Apr 2003 07:11:48 -0000 1.70 *************** *** 27,30 **** --- 27,31 ---- _names = sys.builtin_module_names + # Note: more names are added to __all__ later. __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", "defpath", "name", "path"] *************** *** 159,163 **** ones. Works like rmdir except that, if the leaf directory is successfully removed, directories corresponding to rightmost path ! segments will be pruned way until either the whole path is consumed or an error occurs. Errors during this latter phase are ignored -- they generally mean that a directory was not empty. --- 160,164 ---- ones. Works like rmdir except that, if the leaf directory is successfully removed, directories corresponding to rightmost path ! segments will be pruned away until either the whole path is consumed or an error occurs. Errors during this latter phase are ignored -- they generally mean that a directory was not empty. *************** *** 202,205 **** --- 203,284 ---- __all__.extend(["makedirs", "removedirs", "renames"]) + + def walk(top, topdown=True): + """Directory tree generator. + + For each directory in the directory tree rooted at top (including top + itself, but excluding '.' and '..'), yields a 3-tuple + + dirpath, dirnames, filenames + + dirpath is a string, the path to the directory. dirnames is a list of + the names of the subdirectories in dirpath (excluding '.' and '..'). + filenames is a list of the names of the non-directory files in dirpath. + Note that the names in the lists are just names, with no path components. + To get a full path (which begins with top) to a file or directory in + dirpath, do os.path.join(dirpath, name). + + If optional arg 'topdown' is true or not specified, the triple for a + directory is generated before the triples for any of its subdirectories + (directories are generated top down). If topdown is false, the triple + for a directory is generated after the triples for all of its + subdirectories (directories are generated bottom up). + + When topdown is true, the caller can modify the dirnames list in-place + (e.g., via del or slice assignment), and walk will only recurse into the + subdirectories whose names remain in dirnames; this can be used to prune + the search, or to impose a specific order of visiting. Modifying + dirnames when topdown is false is ineffective, since the directories in + dirnames have already been generated by the time dirnames itself is + generated. + + Caution: if you pass a relative pathname for top, don't change the + current working directory between resumptions of walk. walk never + changes the current directory, and assumes that the client doesn't + either. + + Example: + + from os.path import join, getsize + for root, dirs, files in walk('python/Lib/email'): + print root, "consumes", + print sum([getsize(join(root, name)) for name in files]), + print "bytes in", len(files), "non-directory files" + if 'CVS' in dirs: + dirs.remove('CVS') # don't visit CVS directories + """ + + from os.path import join, isdir, islink + + # We may not have read permission for top, in which case we can't + # get a list of the files the directory contains. os.path.walk + # always suppressed the exception then, rather than blow up for a + # minor reason when (say) a thousand readable directories are still + # left to visit. That logic is copied here. + try: + # Note that listdir and error are globals in this module due + # to earlier import-*. + names = listdir(top) + except error: + return + + dirs, nondirs = [], [] + for name in names: + if isdir(join(top, name)): + dirs.append(name) + else: + nondirs.append(name) + + if topdown: + yield top, dirs, nondirs + for name in dirs: + path = join(top, name) + if not islink(path): + for x in walk(path, topdown): + yield x + if not topdown: + yield top, dirs, nondirs + + __all__.append("walk") # Make sure os.environ exists, at least From bcannon@users.sourceforge.net Fri Apr 25 10:39:51 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 25 Apr 2003 02:39:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv3644/Lib/test Modified Files: test_urllib.py Log Message: Complete rewrite of module. Only has tests using temporary files; net tests should go in test_urllibnet.py . Still need to write tests for _urlopener usage and urlretrieve. Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_urllib.py 23 Jul 2002 19:04:09 -0000 1.9 --- test_urllib.py 25 Apr 2003 09:39:47 -0000 1.10 *************** *** 1,109 **** ! # Minimal test of the quote function ! from test.test_support import verify, verbose ! import urllib ! chars = 'abcdefghijklmnopqrstuvwxyz'\ ! '\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356' \ ! '\357\360\361\362\363\364\365\366\370\371\372\373\374\375\376\377' \ ! 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' \ ! '\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317' \ ! '\320\321\322\323\324\325\326\330\331\332\333\334\335\336' ! expected = 'abcdefghijklmnopqrstuvwxyz' \ ! '%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE' \ ! '%EF%F0%F1%F2%F3%F4%F5%F6%F8%F9%FA%FB%FC%FD%FE%FF' \ ! 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' \ ! '%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF' \ ! '%D0%D1%D2%D3%D4%D5%D6%D8%D9%DA%DB%DC%DD%DE' ! test = urllib.quote(chars) ! verify(test == expected, "urllib.quote problem 1") ! test2 = urllib.unquote(expected) ! verify(test2 == chars) ! in1 = "abc/def" ! out1_1 = "abc/def" ! out1_2 = "abc%2Fdef" ! verify(urllib.quote(in1) == out1_1, "urllib.quote problem 2") ! verify(urllib.quote(in1, '') == out1_2, "urllib.quote problem 3") ! in2 = "abc?def" ! out2_1 = "abc%3Fdef" ! out2_2 = "abc?def" ! verify(urllib.quote(in2) == out2_1, "urllib.quote problem 4") ! verify(urllib.quote(in2, '?') == out2_2, "urllib.quote problem 5") ! in3 = {"p1":"v1","p2":"v2"} ! in3list = [("p1", "v1"), ("p2","v2")] ! exp3_1 = "p2=v2&p1=v1" ! exp3_2 = "p1=v1&p2=v2" ! # dict input, only string values ! act3 = urllib.urlencode(in3) ! verify(act3==exp3_1 or act3==exp3_2, "urllib.urlencode problem 1 dict") ! # list input, only string values ! act3list = urllib.urlencode(in3list) ! verify(act3list==exp3_2, "urllib.urlencode problem 1 list") ! in4 = {"p1":["v1","v2"]} ! in4list = [("p1", ["v1","v2"])] ! exp4 = "p1=v1&p1=v2" ! # dict input, list values, doseq==1 ! act4 = urllib.urlencode(in4,doseq=1) ! verify(act4==exp4, "urllib.urlencode problem 2 dict") ! # list input, list values, doseq==1 ! act4list = urllib.urlencode(in4,doseq=1) ! verify(act4list==exp4, "urllib.urlencode problem 2 list") ! in5 = in4 ! in5list = in4list ! exp5 = "p1=%5B%27v1%27%2C+%27v2%27%5D" ! exp5list = "p1=%5B%27v1%27%2C+%27v2%27%5D" ! # dict input, list variables, doseq=0 ! act5 = urllib.urlencode(in5) ! verify(act5==exp5, "urllib.urlencode problem 3 dict") ! # list input, list variables, doseq=0 ! act5list = urllib.urlencode(in5list) ! verify(act5list==exp5list, "urllib.urlencode problem 3 list") ! in6 = {"p1":"v1","p2":"v2"} ! in6list = [("p1", "v1"), ("p2","v2")] ! exp6_1 = "p2=v2&p1=v1" ! exp6_2 = "p1=v1&p2=v2" ! # dict input, only string values, doseq==1 ! act6 = urllib.urlencode(in6,doseq=1) ! verify(act6==exp6_1 or act6==exp6_2, "urllib.urlencode problem 4 dict") ! # list input, only string values ! act6list = urllib.urlencode(in6list,doseq=1) ! verify(act6list==exp6_2, "urllib.urlencode problem 4 list") ! in7 = "p1=v1&p2=v2" ! try: ! act7 = urllib.urlencode(in7) ! print "urllib.urlencode problem 5 string" ! except TypeError: pass ! import UserDict ! in8 = UserDict.UserDict() ! in8["p1"] = "v1" ! in8["p2"] = ["v1", "v2"] ! exp8_1 = "p1=v1&p2=v1&p2=v2" ! exp8_2 = "p2=v1&p2=v2&p1=v1" ! act8 = urllib.urlencode(in8,doseq=1) ! verify(act8==exp8_1 or act8==exp8_2, "urllib.urlencode problem 6 UserDict") ! import UserString ! in9 = UserString.UserString("") ! exp9 = "" ! act9 = urllib.urlencode(in9,doseq=1) ! verify(act9==exp9, "urllib.urlencode problem 7 UserString") --- 1,383 ---- ! """Regresssion tests for urllib""" ! import urllib ! import unittest ! from test import test_support ! import os ! import mimetools ! def hexescape(char): ! """Escape char as RFC 2396 specifies""" ! hex_repr = hex(ord(char))[2:].upper() ! if len(hex_repr) == 1: ! hex_repr = "0%s" % hex_repr ! return "%" + hex_repr ! class urlopen_FileTests(unittest.TestCase): ! """Test urlopen() opening a temporary file. ! Try to test as much functionality as possible so as to cut down on reliance ! on connect to the Net for testing. ! """ ! def setUp(self): ! """Setup of a temp file to use for testing""" ! self.text = "test_urllib: %s\n" % self.__class__.__name__ ! FILE = file(test_support.TESTFN, 'w') ! try: ! FILE.write(self.text) ! finally: ! FILE.close() ! self.pathname = test_support.TESTFN ! self.returned_obj = urllib.urlopen("file:%s" % self.pathname) ! def tearDown(self): ! """Shut down the open object""" ! self.returned_obj.close() + def test_interface(self): + # Make sure object returned by urlopen() has the specified methods + for attr in ("read", "readline", "readlines", "fileno", + "close", "info", "geturl", "__iter__"): + self.assert_(hasattr(self.returned_obj, attr), + "object returned by urlopen() lacks %s attribute" % + attr) + def test_read(self): + self.assertEqual(self.text, self.returned_obj.read()) ! def test_readline(self): ! self.assertEqual(self.text, self.returned_obj.readline()) ! self.assertEqual('', self.returned_obj.readline(), ! "calling readline() after exhausting the file did not" ! " return an empty string") + def test_readlines(self): + lines_list = self.returned_obj.readlines() + self.assertEqual(len(lines_list), 1, + "readlines() returned the wrong number of lines") + self.assertEqual(lines_list[0], self.text, + "readlines() returned improper text") ! def test_fileno(self): ! file_num = self.returned_obj.fileno() ! self.assert_(isinstance(file_num, int), ! "fileno() did not return an int") ! self.assertEqual(os.read(file_num, len(self.text)), self.text, ! "Reading on the file descriptor returned by fileno() " ! "did not return the expected text") + def test_close(self): + # Test close() by calling it hear and then having it be called again + # by the tearDown() method for the test + self.returned_obj.close() ! def test_info(self): ! self.assert_(isinstance(self.returned_obj.info(), mimetools.Message)) + def test_geturl(self): + self.assertEqual(self.returned_obj.geturl(), self.pathname) ! def test_iter(self): ! # Test iterator ! # Don't need to count number of iterations since test would fail the ! # instant it returned anything beyond the first line from the ! # comparison ! for line in self.returned_obj.__iter__(): ! self.assertEqual(line, self.text) + class urlretrieve_Tests(unittest.TestCase): + """Test urllib.urlretrieve() on local files""" + pass ! class _urlopener_Tests(unittest.TestCase): ! """Make sure urlopen() and urlretrieve() use the class assigned to ! _urlopener""" ! #XXX: Maybe create a custom class here that takes in a list and modifies ! # it to signal that it was called? pass + class QuotingTests(unittest.TestCase): + """Tests for urllib.quote() and urllib.quote_plus() + + According to RFC 2396 ("Uniform Resource Identifiers), to escape a + character you write it as '%' + <2 character US-ASCII hex value>. The Python + code of ``'%' + hex(ord())[2:]`` escapes a character properly. + Case does not matter on the hex letters. ! The various character sets specified are: ! ! Reserved characters : ";/?:@&=+$," ! Have special meaning in URIs and must be escaped if not being used for ! their special meaning ! Data characters : letters, digits, and "-_.!~*'()" ! Unreserved and do not need to be escaped; can be, though, if desired ! Control characters : 0x00 - 0x1F, 0x7F ! Have no use in URIs so must be escaped ! space : 0x20 ! Must be escaped ! Delimiters : '<>#%"' ! Must be escaped ! Unwise : "{}|\^[]`" ! Must be escaped ! ! """ + def test_never_quote(self): + # Make sure quote() does not quote letters, digits, and "_,.-" + do_not_quote = '' .join(["ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "abcdefghijklmnopqrstuvwxyz", + "0123456789", + "_.-"]) + result = urllib.quote(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote(): %s != %s" % (do_not_quote, result)) + result = urllib.quote_plus(do_not_quote) + self.assertEqual(do_not_quote, result, + "using quote_plus(): %s != %s" % (do_not_quote, result)) ! def test_default_safe(self): ! # Test '/' is default value for 'safe' parameter ! self.assertEqual(urllib.quote.func_defaults[0], '/') ! ! def test_safe(self): ! # Test setting 'safe' parameter does what it should do ! quote_by_default = "<>" ! result = urllib.quote(quote_by_default, safe=quote_by_default) ! self.assertEqual(quote_by_default, result, ! "using quote(): %s != %s" % (quote_by_default, result)) ! result = urllib.quote_plus(quote_by_default, safe=quote_by_default) ! self.assertEqual(quote_by_default, result, ! "using quote_plus(): %s != %s" % ! (quote_by_default, result)) ! ! def test_default_quoting(self): ! # Make sure all characters that should be quoted are by default sans ! # space (separate test for that). ! should_quote = [chr(num) for num in range(32)] # For 0x00 - 0x1F ! should_quote.append('<>#%"{}|\^[]`') ! should_quote.append(chr(127)) # For 0x7F ! should_quote = ''.join(should_quote) ! for char in should_quote: ! result = urllib.quote(char) ! self.assertEqual(hexescape(char), result, ! "using quote(): %s should be escaped to %s, not %s" % ! (char, hexescape(char), result)) ! result = urllib.quote_plus(char) ! self.assertEqual(hexescape(char), result, ! "using quote_plus(): " ! "%s should be escapes to %s, not %s" % ! (char, hexescape(char), result)) ! del should_quote ! partial_quote = "ab[]cd" ! expected = "ab%5B%5Dcd" ! result = urllib.quote(partial_quote) ! self.assertEqual(expected, result, ! "using quote(): %s != %s" % (expected, result)) ! self.assertEqual(expected, result, ! "using quote_plus(): %s != %s" % (expected, result)) ! ! def test_quoting_space(self): ! # Make sure quote() and quote_plus() handle spaces as specified in ! # their unique way ! result = urllib.quote(' ') ! self.assertEqual(result, hexescape(' '), ! "using quote(): %s != %s" % (result, hexescape(' '))) ! result = urllib.quote_plus(' ') ! self.assertEqual(result, '+', ! "using quote_plus(): %s != +" % result) ! given = "a b cd e f" ! expect = given.replace(' ', hexescape(' ')) ! result = urllib.quote(given) ! self.assertEqual(expect, result, ! "using quote(): %s != %s" % (expect, result)) ! expect = given.replace(' ', '+') ! result = urllib.quote_plus(given) ! self.assertEqual(expect, result, ! "using quote_plus(): %s != %s" % (expect, result)) ! ! class UnquotingTests(unittest.TestCase): ! """Tests for unquote() and unquote_plus() ! ! See the doc string for quoting_Tests for details on quoting and such. ! ! """ ! ! def test_unquoting(self): ! # Make sure unquoting of all ASCII values works ! escape_list = [] ! for num in range(128): ! given = hexescape(chr(num)) ! expect = chr(num) ! result = urllib.unquote(given) ! self.assertEqual(expect, result, ! "using unquote(): %s != %s" % (expect, result)) ! result = urllib.unquote_plus(given) ! self.assertEqual(expect, result, ! "using unquote_plus(): %s != %s" % ! (expect, result)) ! escape_list.append(given) ! escape_string = ''.join(escape_list) ! del escape_list ! result = urllib.unquote(escape_string) ! self.assertEqual(result.count('%'), 1, ! "using quote(): not all characters escaped; %s" % ! result) ! result = urllib.unquote(escape_string) ! self.assertEqual(result.count('%'), 1, ! "using unquote(): not all characters escaped: " ! "%s" % result) ! ! def test_unquoting_parts(self): ! # Make sure unquoting works when have non-quoted characters ! # interspersed ! given = 'ab%sd' % hexescape('c') ! expect = "abcd" ! result = urllib.unquote(given) ! self.assertEqual(expect, result, ! "using quote(): %s != %s" % (expect, result)) ! result = urllib.unquote_plus(given) ! self.assertEqual(expect, result, ! "using unquote_plus(): %s != %s" % (expect, result)) ! ! def test_unquoting_plus(self): ! # Test difference between unquote() and unquote_plus() ! given = "are+there+spaces..." ! expect = given ! result = urllib.unquote(given) ! self.assertEqual(expect, result, ! "using unquote(): %s != %s" % (expect, result)) ! expect = given.replace('+', ' ') ! result = urllib.unquote_plus(given) ! self.assertEqual(expect, result, ! "using unquote_plus(): %s != %s" % (expect, result)) ! ! class urlencode_Tests(unittest.TestCase): ! """Tests for urlencode()""" ! ! def help_inputtype(self, given, test_type): ! """Helper method for testing different input types. ! ! 'given' must lead to only the pairs: ! * 1st, 1 ! * 2nd, 2 ! * 3rd, 3 ! ! Test cannot assume anything about order. Docs make no guarantee and ! have possible dictionary input. ! ! """ ! expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] ! result = urllib.urlencode(given) ! for expected in expect_somewhere: ! self.assert_(expected in result, ! "testing %s: %s not found in %s" % ! (test_type, expected, result)) ! self.assertEqual(result.count('&'), 2, ! "testing %s: expected 2 '&'s; got %s" % ! (test_type, result.count('&'))) ! amp_location = result.index('&') ! on_amp_left = result[amp_location - 1] ! on_amp_right = result[amp_location + 1] ! self.assert_(on_amp_left.isdigit() and on_amp_right.isdigit(), ! "testing %s: '&' not located in proper place in %s" % ! (test_type, result)) ! self.assertEqual(len(result), (5 * 3) + 2, #5 chars per thing and amps ! "testing %s: " ! "unexpected number of characters: %s != %s" % ! (test_type, len(result), (5 * 3) + 2)) ! ! def test_using_mapping(self): ! # Test passing in a mapping object as an argument. ! self.help_inputtype({"1st":'1', "2nd":'2', "3rd":'3'}, ! "using dict as input type") ! ! def test_using_sequence(self): ! # Test passing in a sequence of two-item sequences as an argument. ! self.help_inputtype([('1st', '1'), ('2nd', '2'), ('3rd', '3')], ! "using sequence of two-item tuples as input") ! ! def test_quoting(self): ! # Make sure keys and values are quoted using quote_plus() ! given = {"&":"="} ! expect = "%s=%s" % (hexescape('&'), hexescape('=')) ! result = urllib.urlencode(given) ! self.assertEqual(expect, result) ! given = {"key name":"A bunch of pluses"} ! expect = "key+name=A+bunch+of+pluses" ! result = urllib.urlencode(given) ! self.assertEqual(expect, result) ! ! def test_doseq(self): ! # Test that passing True for 'doseq' parameter works correctly ! given = {'sequence':['1', '2', '3']} ! expect = "sequence=%s" % urllib.quote_plus(str(['1', '2', '3'])) ! result = urllib.urlencode(given) ! self.assertEqual(expect, result) ! result = urllib.urlencode(given, True) ! for value in given["sequence"]: ! expect = "sequence=%s" % value ! self.assert_(expect in result, ! "%s not found in %s" % (expect, result)) ! self.assertEqual(result.count('&'), 2, ! "Expected 2 '&'s, got %s" % result.count('&')) ! ! class Pathname_Tests(unittest.TestCase): ! """Test pathname2url() and url2pathname()""" ! ! def test_basic(self): ! # Make sure simple tests pass ! expected_path = os.path.join("parts", "of", "a", "path") ! expected_url = "parts/of/a/path" ! result = urllib.pathname2url(expected_path) ! self.assertEqual(expected_url, result, ! "pathname2url() failed; %s != %s" % ! (result, expected_url)) ! result = urllib.url2pathname(expected_url) ! self.assertEqual(expected_path, result, ! "url2pathame() failed; %s != %s" % ! (result, expected_path)) ! ! def test_quoting(self): ! # Test automatic quoting and unquoting works for pathnam2url() and ! # url2pathname() respectively ! given = os.path.join("needs", "quot=ing", "here") ! expect = "needs/%s/here" % urllib.quote("quot=ing") ! result = urllib.pathname2url(given) ! self.assertEqual(expect, result, ! "pathname2url() failed; %s != %s" % ! (expect, result)) ! expect = given ! result = urllib.url2pathname(result) ! self.assertEqual(expect, result, ! "url2pathname() failed; %s != %s" % ! (expect, result)) ! given = os.path.join("make sure", "using_quote") ! expect = "%s/using_quote" % urllib.quote("make sure") ! result = urllib.pathname2url(given) ! self.assertEqual(expect, result, ! "pathname2url() failed; %s != %s" % ! (expect, result)) ! given = "make+sure/using_unquote" ! expect = os.path.join("make+sure", "using_unquote") ! result = urllib.url2pathname(given) ! self.assertEqual(expect, result, ! "url2pathname() failed; %s != %s" % ! (expect, result)) ! ! ! ! def test_main(): ! test_suite = unittest.TestSuite() ! test_suite.addTest(unittest.makeSuite(urlopen_FileTests)) ! test_suite.addTest(unittest.makeSuite(QuotingTests)) ! test_suite.addTest(unittest.makeSuite(UnquotingTests)) ! test_suite.addTest(unittest.makeSuite(urlencode_Tests)) ! test_suite.addTest(unittest.makeSuite(Pathname_Tests)) ! test_support.run_suite(test_suite) ! ! ! ! if __name__ == '__main__': ! test_main() From doerwalter@users.sourceforge.net Fri Apr 25 11:22:05 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 25 Apr 2003 03:22:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bool.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24059/Lib/test Modified Files: test_bool.py Log Message: Port test_bool.py to PyUnit. From SF patch #662807. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_bool.py 19 Apr 2003 18:15:09 -0000 1.8 --- test_bool.py 25 Apr 2003 10:22:01 -0000 1.9 *************** *** 1,7 **** # Test properties of bool promised by PEP 285 ! from test.test_support import verbose, TestFailed, TESTFN, vereq, have_unicode import os def veris(a, b): if a is not b: --- 1,11 ---- # Test properties of bool promised by PEP 285 ! import unittest ! from test import test_support ! import os + from test.test_support import verbose, TestFailed, TESTFN, vereq, have_unicode + def veris(a, b): if a is not b: *************** *** 12,265 **** raise TestFailed, "%r is %r" % (a, b) ! try: ! class C(bool): ! pass ! except TypeError: ! pass ! else: ! raise TestFailed, "bool should not be subclassable" ! try: ! int.__new__(bool, 0) ! except TypeError: ! pass ! else: ! raise TestFailed, "should not be able to create new bool instances" ! # checking tp_print slot ! fo = open(TESTFN, "wb") ! print >> fo, False, True ! fo.close() ! fo = open(TESTFN, "rb") ! vereq(fo.read(), 'False True\n') ! fo.close() ! os.remove(TESTFN) ! # checking repr and str ! vereq(str(False), 'False') ! vereq(str(True), 'True') ! vereq(repr(False), 'False') ! vereq(repr(True), 'True') ! vereq(eval(repr(False)), False) ! vereq(eval(repr(True)), True) ! vereq(int(False), 0) ! verisnot(int(False), False) ! vereq(int(True), 1) ! verisnot(int(True), True) ! vereq(+False, 0) ! verisnot(+False, False) ! vereq(-False, 0) ! verisnot(-False, False) ! vereq(abs(False), 0) ! verisnot(abs(False), False) ! vereq(+True, 1) ! verisnot(+True, True) ! vereq(-True, -1) ! vereq(abs(True), 1) ! verisnot(abs(True), True) ! vereq(~False, -1) ! vereq(~True, -2) ! vereq(False+2, 2) ! vereq(True+2, 3) ! vereq(2+False, 2) ! vereq(2+True, 3) ! vereq(False+False, 0) ! verisnot(False+False, False) ! vereq(False+True, 1) ! verisnot(False+True, True) ! vereq(True+False, 1) ! verisnot(True+False, True) ! vereq(True+True, 2) ! vereq(True-True, 0) ! verisnot(True-True, False) ! vereq(False-False, 0) ! verisnot(False-False, False) ! vereq(True-False, 1) ! verisnot(True-False, True) ! vereq(False-True, -1) ! vereq(True*1, 1) ! vereq(False*1, 0) ! verisnot(False*1, False) ! vereq(True/1, 1) ! verisnot(True/1, True) ! vereq(False/1, 0) ! verisnot(False/1, False) ! for b in False, True: ! for i in 0, 1, 2: ! vereq(b**i, int(b)**i) ! verisnot(b**i, bool(int(b)**i)) ! for a in False, True: ! for b in False, True: ! veris(a&b, bool(int(a)&int(b))) ! veris(a|b, bool(int(a)|int(b))) ! veris(a^b, bool(int(a)^int(b))) ! vereq(a&int(b), int(a)&int(b)) ! verisnot(a&int(b), bool(int(a)&int(b))) ! vereq(a|int(b), int(a)|int(b)) ! verisnot(a|int(b), bool(int(a)|int(b))) ! vereq(a^int(b), int(a)^int(b)) ! verisnot(a^int(b), bool(int(a)^int(b))) ! vereq(int(a)&b, int(a)&int(b)) ! verisnot(int(a)&b, bool(int(a)&int(b))) ! vereq(int(a)|b, int(a)|int(b)) ! verisnot(int(a)|b, bool(int(a)|int(b))) ! vereq(int(a)^b, int(a)^int(b)) ! verisnot(int(a)^b, bool(int(a)^int(b))) ! veris(1==1, True) ! veris(1==0, False) ! # XXX <, <=, >, >=, != ! x = [1] ! veris(x is x, True) ! veris(x is not x, False) ! veris(1 in x, True) ! veris(0 in x, False) ! veris(1 not in x, False) ! veris(0 not in x, True) ! veris(not True, False) ! veris(not False, True) ! veris(bool(10), True) ! veris(bool(1), True) ! veris(bool(-1), True) ! veris(bool(0), False) ! veris(bool("hello"), True) ! veris(bool(""), False) ! veris(bool(), False) ! veris(hasattr([], "append"), True) ! veris(hasattr([], "wobble"), False) ! veris(callable(len), True) ! veris(callable(1), False) ! veris(isinstance(True, bool), True) ! veris(isinstance(False, bool), True) ! veris(isinstance(True, int), True) ! veris(isinstance(False, int), True) ! veris(isinstance(1, bool), False) ! veris(isinstance(0, bool), False) ! veris(issubclass(bool, int), True) ! veris(issubclass(int, bool), False) ! veris({}.has_key(1), False) ! veris({1:1}.has_key(1), True) ! veris("xyz".endswith("z"), True) ! veris("xyz".endswith("x"), False) ! veris("xyz0123".isalnum(), True) ! veris("@#$%".isalnum(), False) ! veris("xyz".isalpha(), True) ! veris("@#$%".isalpha(), False) ! veris("0123".isdigit(), True) ! veris("xyz".isdigit(), False) ! veris("xyz".islower(), True) ! veris("XYZ".islower(), False) ! veris(" ".isspace(), True) ! veris("XYZ".isspace(), False) ! veris("X".istitle(), True) ! veris("x".istitle(), False) ! veris("XYZ".isupper(), True) ! veris("xyz".isupper(), False) ! veris("xyz".startswith("x"), True) ! veris("xyz".startswith("z"), False) ! if have_unicode: ! veris(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) ! veris(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) ! veris(unicode("xyz0123", 'ascii').isalnum(), True) ! veris(unicode("@#$%", 'ascii').isalnum(), False) ! veris(unicode("xyz", 'ascii').isalpha(), True) ! veris(unicode("@#$%", 'ascii').isalpha(), False) ! veris(unicode("0123", 'ascii').isdecimal(), True) ! veris(unicode("xyz", 'ascii').isdecimal(), False) ! veris(unicode("0123", 'ascii').isdigit(), True) ! veris(unicode("xyz", 'ascii').isdigit(), False) ! veris(unicode("xyz", 'ascii').islower(), True) ! veris(unicode("XYZ", 'ascii').islower(), False) ! veris(unicode("0123", 'ascii').isnumeric(), True) ! veris(unicode("xyz", 'ascii').isnumeric(), False) ! veris(unicode(" ", 'ascii').isspace(), True) ! veris(unicode("XYZ", 'ascii').isspace(), False) ! veris(unicode("X", 'ascii').istitle(), True) ! veris(unicode("x", 'ascii').istitle(), False) ! veris(unicode("XYZ", 'ascii').isupper(), True) ! veris(unicode("xyz", 'ascii').isupper(), False) ! veris(unicode("xyz", 'ascii').startswith(unicode("x", 'ascii')), True) ! veris(unicode("xyz", 'ascii').startswith(unicode("z", 'ascii')), False) ! f = file(TESTFN, "w") ! veris(f.closed, False) ! f.close() ! veris(f.closed, True) ! os.remove(TESTFN) ! import operator ! veris(operator.truth(0), False) ! veris(operator.truth(1), True) ! veris(operator.isCallable(0), False) ! veris(operator.isCallable(len), True) ! veris(operator.isNumberType(None), False) ! veris(operator.isNumberType(0), True) ! veris(operator.not_(1), False) ! veris(operator.not_(0), True) ! veris(operator.isSequenceType(0), False) ! veris(operator.isSequenceType([]), True) ! veris(operator.contains([], 1), False) ! veris(operator.contains([1], 1), True) ! veris(operator.isMappingType(1), False) ! veris(operator.isMappingType({}), True) ! veris(operator.lt(0, 0), False) ! veris(operator.lt(0, 1), True) ! import marshal ! veris(marshal.loads(marshal.dumps(True)), True) ! veris(marshal.loads(marshal.dumps(False)), False) ! import pickle ! veris(pickle.loads(pickle.dumps(True)), True) ! veris(pickle.loads(pickle.dumps(False)), False) ! veris(pickle.loads(pickle.dumps(True, True)), True) ! veris(pickle.loads(pickle.dumps(False, True)), False) ! import cPickle ! veris(cPickle.loads(cPickle.dumps(True)), True) ! veris(cPickle.loads(cPickle.dumps(False)), False) ! veris(cPickle.loads(cPickle.dumps(True, True)), True) ! veris(cPickle.loads(cPickle.dumps(False, True)), False) ! veris(pickle.loads(cPickle.dumps(True)), True) ! veris(pickle.loads(cPickle.dumps(False)), False) ! veris(pickle.loads(cPickle.dumps(True, True)), True) ! veris(pickle.loads(cPickle.dumps(False, True)), False) ! veris(cPickle.loads(pickle.dumps(True)), True) ! veris(cPickle.loads(pickle.dumps(False)), False) ! veris(cPickle.loads(pickle.dumps(True, True)), True) ! veris(cPickle.loads(pickle.dumps(False, True)), False) ! # Test for specific backwards-compatible pickle values ! vereq(pickle.dumps(True), "I01\n.") ! vereq(pickle.dumps(False), "I00\n.") ! vereq(cPickle.dumps(True), "I01\n.") ! vereq(cPickle.dumps(False), "I00\n.") ! vereq(pickle.dumps(True, True), "I01\n.") ! vereq(pickle.dumps(False, True), "I00\n.") ! vereq(cPickle.dumps(True, True), "I01\n.") ! vereq(cPickle.dumps(False, True), "I00\n.") - if verbose: - print "All OK" --- 16,340 ---- raise TestFailed, "%r is %r" % (a, b) ! class BoolTest(unittest.TestCase): ! def assertIs(self, a, b): ! self.assert_(a is b) ! def assertIsNot(self, a, b): ! self.assert_(a is not b) ! def test_subclass(self): ! try: ! class C(bool): ! pass ! except TypeError: ! pass ! else: ! self.fail("bool should not be subclassable") ! self.assertRaises(TypeError, int.__new__, bool, 0) ! def test_print(self): ! try: ! fo = open(test_support.TESTFN, "wb") ! print >> fo, False, True ! fo.close() ! fo = open(test_support.TESTFN, "rb") ! self.assertEqual(fo.read(), 'False True\n') ! finally: ! fo.close() ! os.remove(test_support.TESTFN) ! def test_repr(self): ! self.assertEqual(repr(False), 'False') ! self.assertEqual(repr(True), 'True') ! self.assertEqual(eval(repr(False)), False) ! self.assertEqual(eval(repr(True)), True) ! def test_str(self): ! self.assertEqual(str(False), 'False') ! self.assertEqual(str(True), 'True') ! def test_int(self): ! self.assertEqual(int(False), 0) ! self.assertIsNot(int(False), False) ! self.assertEqual(int(True), 1) ! self.assertIsNot(int(True), True) ! def test_math(self): ! self.assertEqual(+False, 0) ! self.assertIsNot(+False, False) ! self.assertEqual(-False, 0) ! self.assertIsNot(-False, False) ! self.assertEqual(abs(False), 0) ! self.assertIsNot(abs(False), False) ! self.assertEqual(+True, 1) ! self.assertIsNot(+True, True) ! self.assertEqual(-True, -1) ! self.assertEqual(abs(True), 1) ! self.assertIsNot(abs(True), True) ! self.assertEqual(~False, -1) ! self.assertEqual(~True, -2) ! self.assertEqual(False+2, 2) ! self.assertEqual(True+2, 3) ! self.assertEqual(2+False, 2) ! self.assertEqual(2+True, 3) ! self.assertEqual(False+False, 0) ! self.assertIsNot(False+False, False) ! self.assertEqual(False+True, 1) ! self.assertIsNot(False+True, True) ! self.assertEqual(True+False, 1) ! self.assertIsNot(True+False, True) ! self.assertEqual(True+True, 2) ! self.assertEqual(True-True, 0) ! self.assertIsNot(True-True, False) ! self.assertEqual(False-False, 0) ! self.assertIsNot(False-False, False) ! self.assertEqual(True-False, 1) ! self.assertIsNot(True-False, True) ! self.assertEqual(False-True, -1) ! self.assertEqual(True*1, 1) ! self.assertEqual(False*1, 0) ! self.assertIsNot(False*1, False) ! self.assertEqual(True/1, 1) ! self.assertIsNot(True/1, True) ! self.assertEqual(False/1, 0) ! self.assertIsNot(False/1, False) ! for b in False, True: ! for i in 0, 1, 2: ! self.assertEqual(b**i, int(b)**i) ! self.assertIsNot(b**i, bool(int(b)**i)) ! for a in False, True: ! for b in False, True: ! self.assertIs(a&b, bool(int(a)&int(b))) ! self.assertIs(a|b, bool(int(a)|int(b))) ! self.assertIs(a^b, bool(int(a)^int(b))) ! self.assertEqual(a&int(b), int(a)&int(b)) ! self.assertIsNot(a&int(b), bool(int(a)&int(b))) ! self.assertEqual(a|int(b), int(a)|int(b)) ! self.assertIsNot(a|int(b), bool(int(a)|int(b))) ! self.assertEqual(a^int(b), int(a)^int(b)) ! self.assertIsNot(a^int(b), bool(int(a)^int(b))) ! self.assertEqual(int(a)&b, int(a)&int(b)) ! self.assertIsNot(int(a)&b, bool(int(a)&int(b))) ! self.assertEqual(int(a)|b, int(a)|int(b)) ! self.assertIsNot(int(a)|b, bool(int(a)|int(b))) ! self.assertEqual(int(a)^b, int(a)^int(b)) ! self.assertIsNot(int(a)^b, bool(int(a)^int(b))) ! self.assertIs(1==1, True) ! self.assertIs(1==0, False) ! self.assertIs(0<1, True) ! self.assertIs(1<0, False) ! self.assertIs(0<=0, True) ! self.assertIs(1<=0, False) ! self.assertIs(1>0, True) ! self.assertIs(1>1, False) ! self.assertIs(1>=1, True) ! self.assertIs(0>=1, False) ! self.assertIs(0!=1, True) ! self.assertIs(0!=0, False) ! x = [1] ! self.assertIs(x is x, True) ! self.assertIs(x is not x, False) ! self.assertIs(1 in x, True) ! self.assertIs(0 in x, False) ! self.assertIs(1 not in x, False) ! self.assertIs(0 not in x, True) ! x = {1: 2} ! self.assertIs(x is x, True) ! self.assertIs(x is not x, False) ! self.assertIs(1 in x, True) ! self.assertIs(0 in x, False) ! self.assertIs(1 not in x, False) ! self.assertIs(0 not in x, True) ! self.assertIs(not True, False) ! self.assertIs(not False, True) ! def test_convert(self): ! self.assertRaises(TypeError, bool, 42, 42) ! self.assertIs(bool(10), True) ! self.assertIs(bool(1), True) ! self.assertIs(bool(-1), True) ! self.assertIs(bool(0), False) ! self.assertIs(bool("hello"), True) ! self.assertIs(bool(""), False) ! self.assertIs(bool(), False) ! def test_hasattr(self): ! self.assertIs(hasattr([], "append"), True) ! self.assertIs(hasattr([], "wobble"), False) ! def test_callable(self): ! self.assertIs(callable(len), True) ! self.assertIs(callable(1), False) ! def test_isinstance(self): ! self.assertIs(isinstance(True, bool), True) ! self.assertIs(isinstance(False, bool), True) ! self.assertIs(isinstance(True, int), True) ! self.assertIs(isinstance(False, int), True) ! self.assertIs(isinstance(1, bool), False) ! self.assertIs(isinstance(0, bool), False) ! def test_issubclass(self): ! self.assertIs(issubclass(bool, int), True) ! self.assertIs(issubclass(int, bool), False) ! def test_haskey(self): ! self.assertIs({}.has_key(1), False) ! self.assertIs({1:1}.has_key(1), True) ! def test_string(self): ! self.assertIs("xyz".endswith("z"), True) ! self.assertIs("xyz".endswith("x"), False) ! self.assertIs("xyz0123".isalnum(), True) ! self.assertIs("@#$%".isalnum(), False) ! self.assertIs("xyz".isalpha(), True) ! self.assertIs("@#$%".isalpha(), False) ! self.assertIs("0123".isdigit(), True) ! self.assertIs("xyz".isdigit(), False) ! self.assertIs("xyz".islower(), True) ! self.assertIs("XYZ".islower(), False) ! self.assertIs(" ".isspace(), True) ! self.assertIs("XYZ".isspace(), False) ! self.assertIs("X".istitle(), True) ! self.assertIs("x".istitle(), False) ! self.assertIs("XYZ".isupper(), True) ! self.assertIs("xyz".isupper(), False) ! self.assertIs("xyz".startswith("x"), True) ! self.assertIs("xyz".startswith("z"), False) ! if have_unicode: ! self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) ! self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) ! self.assertIs(unicode("xyz0123", 'ascii').isalnum(), True) ! self.assertIs(unicode("@#$%", 'ascii').isalnum(), False) ! self.assertIs(unicode("xyz", 'ascii').isalpha(), True) ! self.assertIs(unicode("@#$%", 'ascii').isalpha(), False) ! self.assertIs(unicode("0123", 'ascii').isdecimal(), True) ! self.assertIs(unicode("xyz", 'ascii').isdecimal(), False) ! self.assertIs(unicode("0123", 'ascii').isdigit(), True) ! self.assertIs(unicode("xyz", 'ascii').isdigit(), False) ! self.assertIs(unicode("xyz", 'ascii').islower(), True) ! self.assertIs(unicode("XYZ", 'ascii').islower(), False) ! self.assertIs(unicode("0123", 'ascii').isnumeric(), True) ! self.assertIs(unicode("xyz", 'ascii').isnumeric(), False) ! self.assertIs(unicode(" ", 'ascii').isspace(), True) ! self.assertIs(unicode("XYZ", 'ascii').isspace(), False) ! self.assertIs(unicode("X", 'ascii').istitle(), True) ! self.assertIs(unicode("x", 'ascii').istitle(), False) ! self.assertIs(unicode("XYZ", 'ascii').isupper(), True) ! self.assertIs(unicode("xyz", 'ascii').isupper(), False) ! self.assertIs(unicode("xyz", 'ascii').startswith(unicode("x", 'ascii')), True) ! self.assertIs(unicode("xyz", 'ascii').startswith(unicode("z", 'ascii')), False) ! def test_boolean(self): ! self.assertEqual(True & 1, 1) ! self.assert_(not isinstance(True & 1, bool)) ! self.assertIs(True & True, True) ! self.assertEqual(True | 1, 1) ! self.assert_(not isinstance(True | 1, bool)) ! self.assertIs(True | True, True) ! ! self.assertEqual(True ^ 1, 0) ! self.assert_(not isinstance(True ^ 1, bool)) ! self.assertIs(True ^ True, False) ! ! def test_fileclosed(self): ! try: ! f = file(TESTFN, "w") ! self.assertIs(f.closed, False) ! f.close() ! self.assertIs(f.closed, True) ! finally: ! os.remove(TESTFN) ! ! def test_operator(self): ! import operator ! self.assertIs(operator.truth(0), False) ! self.assertIs(operator.truth(1), True) ! self.assertIs(operator.isCallable(0), False) ! self.assertIs(operator.isCallable(len), True) ! self.assertIs(operator.isNumberType(None), False) ! self.assertIs(operator.isNumberType(0), True) ! self.assertIs(operator.not_(1), False) ! self.assertIs(operator.not_(0), True) ! self.assertIs(operator.isSequenceType(0), False) ! self.assertIs(operator.isSequenceType([]), True) ! self.assertIs(operator.contains([], 1), False) ! self.assertIs(operator.contains([1], 1), True) ! self.assertIs(operator.isMappingType(1), False) ! self.assertIs(operator.isMappingType({}), True) ! self.assertIs(operator.lt(0, 0), False) ! self.assertIs(operator.lt(0, 1), True) ! self.assertIs(operator.is_(True, True), True) ! self.assertIs(operator.is_(True, False), False) ! self.assertIs(operator.is_not(True, True), False) ! self.assertIs(operator.is_not(True, False), True) ! ! def test_marshal(self): ! import marshal ! veris(marshal.loads(marshal.dumps(True)), True) ! veris(marshal.loads(marshal.dumps(False)), False) ! ! def test_pickle(self): ! import pickle ! self.assertIs(pickle.loads(pickle.dumps(True)), True) ! self.assertIs(pickle.loads(pickle.dumps(False)), False) ! self.assertIs(pickle.loads(pickle.dumps(True, True)), True) ! self.assertIs(pickle.loads(pickle.dumps(False, True)), False) ! ! def test_cpickle(self): ! import cPickle ! self.assertIs(cPickle.loads(cPickle.dumps(True)), True) ! self.assertIs(cPickle.loads(cPickle.dumps(False)), False) ! self.assertIs(cPickle.loads(cPickle.dumps(True, True)), True) ! self.assertIs(cPickle.loads(cPickle.dumps(False, True)), False) ! ! def test_mixedpickle(self): ! import pickle, cPickle ! self.assertIs(pickle.loads(cPickle.dumps(True)), True) ! self.assertIs(pickle.loads(cPickle.dumps(False)), False) ! self.assertIs(pickle.loads(cPickle.dumps(True, True)), True) ! self.assertIs(pickle.loads(cPickle.dumps(False, True)), False) ! ! self.assertIs(cPickle.loads(pickle.dumps(True)), True) ! self.assertIs(cPickle.loads(pickle.dumps(False)), False) ! self.assertIs(cPickle.loads(pickle.dumps(True, True)), True) ! self.assertIs(cPickle.loads(pickle.dumps(False, True)), False) ! ! def test_picklevalues(self): ! import pickle, cPickle ! ! # Test for specific backwards-compatible pickle values ! self.assertEqual(pickle.dumps(True), "I01\n.") ! self.assertEqual(pickle.dumps(False), "I00\n.") ! self.assertEqual(cPickle.dumps(True), "I01\n.") ! self.assertEqual(cPickle.dumps(False), "I00\n.") ! self.assertEqual(pickle.dumps(True, True), "I01\n.") ! self.assertEqual(pickle.dumps(False, True), "I00\n.") ! self.assertEqual(cPickle.dumps(True, True), "I01\n.") ! self.assertEqual(cPickle.dumps(False, True), "I00\n.") ! ! def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(BoolTest)) ! test_support.run_suite(suite) ! ! if __name__ == "__main__": ! test_main() From python@rcn.com Fri Apr 25 11:40:27 2003 From: python@rcn.com (Raymond Hettinger) Date: Fri, 25 Apr 2003 06:40:27 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib.py,1.9,1.10 References: Message-ID: <005d01c30b17$28840580$1a3cc797@oemcomputer> > Update of /cvsroot/python/python/dist/src/Lib/test > In directory sc8-pr-cvs1:/tmp/cvs-serv3644/Lib/test > > Modified Files: > test_urllib.py > Log Message: > Complete rewrite of module. Only has tests using temporary files; net tests > should go in test_urllibnet.py . > > Still need to write tests for _urlopener usage and urlretrieve. test_urllib.py is crashing on my fresh WinMe build: test_fileno (__main__.urlopen_FileTests) ... FAIL test_iter (__main__.urlopen_FileTests) ... FAIL test_read (__main__.urlopen_FileTests) ... FAIL test_readline (__main__.urlopen_FileTests) ... FAIL test_readlines (__main__.urlopen_FileTests) ... FAIL Raymond Hettinger From guido@python.org Fri Apr 25 14:28:45 2003 From: guido@python.org (Guido van Rossum) Date: Fri, 25 Apr 2003 09:28:45 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.61,1.62 In-Reply-To: "Your message of Fri, 25 Apr 2003 02:16:54 EDT." <002901c30af2$4c459da0$1a3cc797@oemcomputer> References: <002901c30af2$4c459da0$1a3cc797@oemcomputer> Message-ID: <200304251328.h3PDSjr04128@pcp02138704pcs.reston01.va.comcast.net> > Two of the test cases are failing in test_socket.py > on a fresh build for WinMe: > > testIPv4toString (__main__.GeneralModuleTests) ... ERROR > testStringToIPv4 (__main__.GeneralModuleTests) ... ERROR Ouch, sorry! These are tests for the brand-new inet_{pton,ntop}, which don't exist on Windows (and maybe not on some other platforms either). The tests should be skipped if these functions don't exist. --Guido van Rossum (home page: http://www.python.org/~guido/) From montanaro@users.sourceforge.net Fri Apr 25 15:12:46 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:12:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31075 Modified Files: test_re.py Log Message: copy a few tests from test_sre Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_re.py 25 Apr 2003 01:40:11 -0000 1.35 --- test_re.py 25 Apr 2003 14:12:40 -0000 1.36 *************** *** 187,190 **** --- 187,205 ---- self.fail("re.match('(x)*', 50000*'x') should have failed") + def test_sre_character_literals(self): + for i in [0, 8, 16, 32, 64, 127, 128, 255]: + self.assertNotEqual(re.match(r"\%03o" % i, chr(i)), None) + self.assertNotEqual(re.match(r"\%03o0" % i, chr(i)+"0"), None) + self.assertNotEqual(re.match(r"\%03o8" % i, chr(i)+"8"), None) + self.assertNotEqual(re.match(r"\x%02x" % i, chr(i)), None) + self.assertNotEqual(re.match(r"\x%02x0" % i, chr(i)+"0"), None) + self.assertNotEqual(re.match(r"\x%02xz" % i, chr(i)+"z"), None) + self.assertRaises(re.error, re.match, "\911", "") + + def test_bug_113254(self): + self.assertEqual(re.match(r'(a)|(b)', 'b').start(1), -1) + self.assertEqual(re.match(r'(a)|(b)', 'b').end(1), -1) + self.assertEqual(re.match(r'(a)|(b)', 'b').span(1), (-1, -1)) + def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR From gvanrossum@users.sourceforge.net Fri Apr 25 15:22:05 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:22:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_logging.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv2824 Modified Files: test_logging.py Log Message: New version from Vinaj, should solve the threading problems (hopefully). Index: test_logging.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_logging.py 18 Feb 2003 14:20:02 -0000 1.5 --- test_logging.py 25 Apr 2003 14:22:00 -0000 1.6 *************** *** 39,42 **** --- 39,44 ---- BANNER = "-- %-10s %-6s ---------------------------------------------------\n" + FINISH_UP = "Finish up, it's closing time. Messages should bear numbers 0 through 24." + #---------------------------------------------------------------------------- # Log receiver *************** *** 80,87 **** --- 82,94 ---- def handleLogRecord(self, record): logname = "logrecv.tcp." + record.name + #If the end-of-messages sentinel is seen, tell the server to terminate + if record.msg == FINISH_UP: + self.server.abort = 1 record.msg = record.msg + " (via " + logname + ")" logger = logging.getLogger(logname) logger.handle(record) + socketDataProcessed = threading.Condition() + class LogRecordSocketReceiver(ThreadingTCPServer): """ *************** *** 108,111 **** --- 115,122 ---- self.handle_request() abort = self.abort + #notify the main thread that we're about to exit + socketDataProcessed.acquire() + socketDataProcessed.notify() + socketDataProcessed.release() def process_request(self, request, client_address): *************** *** 196,200 **** INF_ERR_UNDEF.debug(nextmessage()) ! INF.info("Messages should bear numbers 0 through 24.") #---------------------------------------------------------------------------- --- 207,211 ---- INF_ERR_UNDEF.debug(nextmessage()) ! INF.info(FINISH_UP) #---------------------------------------------------------------------------- *************** *** 456,463 **** finally: ! #shut down server ! tcpserver.abort = 1 ! for thread in threads: ! thread.join() banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) --- 467,474 ---- finally: ! #wait for TCP receiver to terminate ! socketDataProcessed.acquire() ! socketDataProcessed.wait() ! socketDataProcessed.release() banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) From gvanrossum@users.sourceforge.net Fri Apr 25 15:22:05 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:22:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_logging,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv2824/output Modified Files: test_logging Log Message: New version from Vinaj, should solve the threading problems (hopefully). Index: test_logging =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_logging,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_logging 18 Feb 2003 14:20:04 -0000 1.3 --- test_logging 25 Apr 2003 14:22:00 -0000 1.4 *************** *** 26,30 **** CRITICAL:INF.BADPARENT.UNDEF:Message 23 CRITICAL:INF.BADPARENT:Message 24 ! INFO:INF:Messages should bear numbers 0 through 24. -- log_test0 end --------------------------------------------------- -- log_test1 begin --------------------------------------------------- --- 26,30 ---- CRITICAL:INF.BADPARENT.UNDEF:Message 23 CRITICAL:INF.BADPARENT:Message 24 ! INFO:INF:Finish up, it's closing time. Messages should bear numbers 0 through 24. -- log_test0 end --------------------------------------------------- -- log_test1 begin --------------------------------------------------- *************** *** 512,515 **** INF.BADPARENT.UNDEF -> CRITICAL: Message 23 (via logrecv.tcp.INF.BADPARENT.UNDEF) INF.BADPARENT -> CRITICAL: Message 24 (via logrecv.tcp.INF.BADPARENT) ! INF -> INFO: Messages should bear numbers 0 through 24. (via logrecv.tcp.INF) -- logrecv output end --------------------------------------------------- --- 512,515 ---- INF.BADPARENT.UNDEF -> CRITICAL: Message 23 (via logrecv.tcp.INF.BADPARENT.UNDEF) INF.BADPARENT -> CRITICAL: Message 24 (via logrecv.tcp.INF.BADPARENT) ! INF -> INFO: Finish up, it's closing time. Messages should bear numbers 0 through 24. (via logrecv.tcp.INF) -- logrecv output end --------------------------------------------------- From fdrake@users.sourceforge.net Fri Apr 25 15:27:05 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:27:05 -0700 Subject: [Python-checkins] python/dist/src/Lib csv.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5510 Modified Files: csv.py Log Message: Attempt to deal with some obvious errors in the code. These were all due to using a single module-level namespace where multiple namespaces were used before. There *really* need to be tests for the sniffer stuff. This could have been avoided. Skip, please review, and add sniffer tests! Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csv.py 24 Apr 2003 20:21:31 -0000 1.1 --- csv.py 25 Apr 2003 14:27:00 -0000 1.2 *************** *** 162,166 **** Takes a file-like object and returns a dialect (or None) """ - self.fileobj = fileobj --- 162,165 ---- *************** *** 172,186 **** delimiter, skipinitialspace = self._guessDelimiter(data) ! class Dialect(csv.Dialect): _name = "sniffed" lineterminator = '\r\n' ! quoting = csv.QUOTE_MINIMAL # escapechar = '' doublequote = False ! Dialect.delimiter = delimiter ! Dialect.quotechar = quotechar ! Dialect.skipinitialspace = skipinitialspace ! self.dialect = Dialect return self.dialect --- 171,185 ---- delimiter, skipinitialspace = self._guessDelimiter(data) ! class SniffedDialect(Dialect): _name = "sniffed" lineterminator = '\r\n' ! quoting = QUOTE_MINIMAL # escapechar = '' doublequote = False ! SniffedDialect.delimiter = delimiter ! SniffedDialect.quotechar = quotechar ! SniffedDialect.skipinitialspace = skipinitialspace ! self.dialect = SniffedDialect return self.dialect *************** *** 190,195 **** ! def register_dialect(self, name = 'sniffed'): ! csv.register_dialect(name, self.dialect) --- 189,194 ---- ! def register_dialect(self, name='sniffed'): ! register_dialect(name, self.dialect) *************** *** 379,388 **** fileobj.seek(0) ! reader = csv.reader(fileobj, ! delimiter = dialect.delimiter, ! quotechar = dialect.quotechar, ! skipinitialspace = dialect.skipinitialspace) ! header = reader.next() # assume first row is header columns = len(header) --- 378,387 ---- fileobj.seek(0) ! r = csv.reader(fileobj, ! delimiter=dialect.delimiter, ! quotechar=dialect.quotechar, ! skipinitialspace=dialect.skipinitialspace) ! header = r.next() # assume first row is header columns = len(header) *************** *** 391,395 **** checked = 0 ! for row in reader: # arbitrary number of rows to check, to keep it sane if checked > 20: --- 390,394 ---- checked = 0 ! for row in r: # arbitrary number of rows to check, to keep it sane if checked > 20: From montanaro@users.sourceforge.net Fri Apr 25 15:32:00 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:32:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7942 Modified Files: test_re.py Log Message: more tests from test_sre Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_re.py 25 Apr 2003 14:12:40 -0000 1.36 --- test_re.py 25 Apr 2003 14:31:54 -0000 1.37 *************** *** 55,60 **** self.assertEqual(re.sub('^\s*', 'X', 'test'), 'Xtest') ! def test_escaped_re_sub(self): ! # Test for sub() on escaped characters, see SF bug #449000 self.assertEqual(re.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n'), 'abc\ndef\n') --- 55,65 ---- self.assertEqual(re.sub('^\s*', 'X', 'test'), 'Xtest') ! def test_bug_449964(self): ! # fails for group followed by other escape ! self.assertEqual(re.sub(r'(?Px)', '\g<1>\g<1>\\b', 'xx'), ! 'xx\bxx\b') ! ! def test_bug_449000(self): ! # Test for sub() on escaped characters self.assertEqual(re.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n'), 'abc\ndef\n') *************** *** 70,73 **** --- 75,87 ---- self.assertEqual(re.sub('a', 'b', 'aaaaa', 1), 'baaaa') + def test_bug_114660(self): + self.assertEqual(re.sub(r'(\S)\s+(\S)', r'\1 \2', 'hello there'), + 'hello there') + + def test_bug_462270(self): + # Test for empty sub() behaviour, see SF bug #462270 + self.assertEqual(re.sub('x*', '-', 'abxd'), '-a-b-d-') + self.assertEqual(re.sub('x+', '-', 'abxd'), 'ab-d') + def test_symbolic_refs(self): self.assertRaises(re.error, re.sub, '(?Px)', '\ga)(?Pb)?b','ab').lastgroup, 'a') + self.assertEqual(re.match("(?Pa(b))", "ab").lastgroup, 'a') + self.assertEqual(re.match("((a))", "a").lastindex, 1) + + def test_bug_545855(self): + # bug 545855 -- This pattern failed to cause a compile error as it + # should, instead provoking a TypeError. + self.assertRaises(re.error, re.compile, 'foo[a-') + + def test_bug_418626(self): + # bugs 418626 at al. -- Testing Greg Chapman's addition of op code + # SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of + # pattern '*?' on a long string. + self.assertEqual(re.match('.*?c', 10000*'ab'+'cd').end(0), 20001) + self.assertEqual(re.match('.*?cd', 5000*'ab'+'c'+5000*'ab'+'cde').end(0), + 20003) + self.assertEqual(re.match('.*?cd', 20000*'abc'+'de').end(0), 60001) + # non-simple '*?' still recurses and hits the recursion limit + self.assertRaises(RuntimeError, re.search, '(a|b)*?c', 10000*'ab'+'cd') + + def test_bug_612074(self): + pat=u"["+re.escape(u"\u2039")+u"]" + self.assertEqual(re.compile(pat) and 1, 1) def run_re_tests(): From neal@metaslash.com Fri Apr 25 15:33:06 2003 From: neal@metaslash.com (Neal Norwitz) Date: Fri, 25 Apr 2003 10:33:06 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_logging.py,1.5,1.6 In-Reply-To: References: Message-ID: <20030425143306.GD12173@epoch.metaslash.com> On Fri, Apr 25, 2003 at 07:22:05AM -0700, gvanrossum@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Lib/test > In directory sc8-pr-cvs1:/tmp/cvs-serv2824 > > Modified Files: > test_logging.py > Log Message: > New version from Vinaj, should solve the threading problems (hopefully). It solves the problem on Redhat 9 and Solaris 8! Neal From montanaro@users.sourceforge.net Fri Apr 25 15:43:21 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:43:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13024 Modified Files: test_csv.py Log Message: some sniffer tests Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_csv.py 24 Apr 2003 16:02:51 -0000 1.4 --- test_csv.py 25 Apr 2003 14:43:14 -0000 1.5 *************** *** 534,537 **** --- 534,571 ---- + class TestSniffer(unittest.TestCase): + sample1 = """\ + Harry's, Arlington Heights, IL, 2/1/03, Kimi Hayes + Shark City, Glendale Heights, IL, 12/28/02, Prezence + Tommy's Place, Blue Island, IL, 12/28/02, Blue Sunday/White Crow + Stonecutters Seafood and Chop House, Lemont, IL, 12/19/02, Week Back + """ + sample2 = """\ + 'Harry''s':'Arlington Heights':'IL':'2/1/03':'Kimi Hayes' + 'Shark City':'Glendale Heights':'IL':'12/28/02':'Prezence' + 'Tommy''s Place':'Blue Island':'IL':'12/28/02':'Blue Sunday/White Crow' + 'Stonecutters Seafood and Chop House':'Lemont':'IL':'12/19/02':'Week Back' + """ + + header = '''\ + "venue","city","state","date","performers" + ''' + def test_has_header(self): + sniffer = csv.Sniffer() + self.assertEqual(sniffer.has_header(self.sample1), False) + self.assertEqual(sniffer.has_header(self.header+self.sample1), True) + + def test_sniff(self): + sniffer = csv.Sniffer() + dialect = sniffer.sniff(self.sample1) + self.assertEqual(dialect.delimiter, ",") + self.assertEqual(dialect.quotechar, '"') + self.assertEqual(dialect.skipinitialspace, True) + + dialect = sniffer.sniff(self.sample2) + self.assertEqual(dialect.delimiter, ":") + self.assertEqual(dialect.quotechar, "'") + self.assertEqual(dialect.skipinitialspace, False) + if not hasattr(sys, "gettotalrefcount"): if verbose: print "*** skipping leakage tests ***" From montanaro@users.sourceforge.net Fri Apr 25 15:47:19 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:47:19 -0700 Subject: [Python-checkins] python/dist/src/Lib csv.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14712 Modified Files: csv.py Log Message: rework Sniffer api significantly Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** csv.py 25 Apr 2003 14:27:00 -0000 1.2 --- csv.py 25 Apr 2003 14:47:16 -0000 1.3 *************** *** 10,13 **** --- 10,18 ---- __doc__ + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO + __all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE", "Error", "Dialect", "excel", "excel_tab", "reader", "writer", *************** *** 148,175 **** ''' "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) ! Returns a csv.Dialect object. ''' ! def __init__(self, sample = 16 * 1024): # in case there is more than one possible delimiter self.preferred = [',', '\t', ';', ' ', ':'] - # amount of data (in bytes) to sample - self.sample = sample ! ! def sniff(self, fileobj): """ ! Takes a file-like object and returns a dialect (or None) """ - self.fileobj = fileobj - - data = fileobj.read(self.sample) quotechar, delimiter, skipinitialspace = \ ! self._guessQuoteAndDelimiter(data) if delimiter is None: ! delimiter, skipinitialspace = self._guessDelimiter(data) ! class SniffedDialect(Dialect): _name = "sniffed" lineterminator = '\r\n' --- 153,174 ---- ''' "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) ! Returns a Dialect object. ''' ! def __init__(self): # in case there is more than one possible delimiter self.preferred = [',', '\t', ';', ' ', ':'] ! def sniff(self, sample): """ ! Returns a dialect (or None) corresponding to the sample """ quotechar, delimiter, skipinitialspace = \ ! self._guess_quote_and_delimiter(sample) if delimiter is None: ! delimiter, skipinitialspace = self._guess_delimiter(sample) ! class dialect(Dialect): _name = "sniffed" lineterminator = '\r\n' *************** *** 177,197 **** # escapechar = '' doublequote = False - SniffedDialect.delimiter = delimiter - SniffedDialect.quotechar = quotechar - SniffedDialect.skipinitialspace = skipinitialspace - - self.dialect = SniffedDialect - return self.dialect - - - def hasHeaders(self): - return self._hasHeaders(self.fileobj, self.dialect) ! def register_dialect(self, name='sniffed'): ! register_dialect(name, self.dialect) ! def _guessQuoteAndDelimiter(self, data): """ Looks for text enclosed between two identical quotes --- 176,189 ---- # escapechar = '' doublequote = False + dialect.delimiter = delimiter + # _csv.reader won't accept a quotechar of '' + dialect.quotechar = quotechar or '"' + dialect.skipinitialspace = skipinitialspace ! return dialect ! def _guess_quote_and_delimiter(self, data): """ Looks for text enclosed between two identical quotes *************** *** 257,261 **** ! def _guessDelimiter(self, data): """ The delimiter /should/ occur the same number of times on --- 249,253 ---- ! def _guess_delimiter(self, data): """ The delimiter /should/ occur the same number of times on *************** *** 291,300 **** for line in data[start:end]: for char in ascii: ! metafrequency = charFrequency.get(char, {}) # must count even if frequency is 0 freq = line.strip().count(char) # value is the mode ! metafrequency[freq] = metafrequency.get(freq, 0) + 1 ! charFrequency[char] = metafrequency for char in charFrequency.keys(): --- 283,292 ---- for line in data[start:end]: for char in ascii: ! metaFrequency = charFrequency.get(char, {}) # must count even if frequency is 0 freq = line.strip().count(char) # value is the mode ! metaFrequency[freq] = metaFrequency.get(freq, 0) + 1 ! charFrequency[char] = metaFrequency for char in charFrequency.keys(): *************** *** 357,361 **** ! def _hasHeaders(self, fileobj, dialect): # Creates a dictionary of types of data in each column. If any # column is of a single type (say, integers), *except* for the first --- 349,353 ---- ! def has_header(self, sample): # Creates a dictionary of types of data in each column. If any # column is of a single type (say, integers), *except* for the first *************** *** 374,387 **** return eval(item.replace('(', '').replace(')', '')) ! # rewind the fileobj - this might not work for some file-like ! # objects... ! fileobj.seek(0) ! ! r = csv.reader(fileobj, ! delimiter=dialect.delimiter, ! quotechar=dialect.quotechar, ! skipinitialspace=dialect.skipinitialspace) ! header = r.next() # assume first row is header columns = len(header) --- 366,372 ---- return eval(item.replace('(', '').replace(')', '')) ! rdr = reader(StringIO(sample), self.sniff(sample)) ! header = rdr.next() # assume first row is header columns = len(header) *************** *** 390,394 **** checked = 0 ! for row in r: # arbitrary number of rows to check, to keep it sane if checked > 20: --- 375,379 ---- checked = 0 ! for row in rdr: # arbitrary number of rows to check, to keep it sane if checked > 20: From fdrake@users.sourceforge.net Fri Apr 25 15:50:10 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:50:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16045 Modified Files: libos.tex Log Message: markup adjustments Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** libos.tex 25 Apr 2003 07:11:47 -0000 1.119 --- libos.tex 25 Apr 2003 14:50:06 -0000 1.120 *************** *** 1051,1058 **** \end{funcdesc} ! \begin{funcdesc}{walk}{top\optional{, topdown=True}} \index{directory!walking} \index{directory!traversal} - \function{walk()} generates the file names in a directory tree. For each directory in the tree rooted at directory \var{top} (including --- 1051,1057 ---- \end{funcdesc} ! \begin{funcdesc}{walk}{top\optional{, topdown\code{=True}}} \index{directory!walking} \index{directory!traversal} \function{walk()} generates the file names in a directory tree. For each directory in the tree rooted at directory \var{top} (including *************** *** 1065,1069 **** the names of the non-directory files in \var{dirpath}. Note that the names in the lists contain no path components. To get a full ! path (which begins with \var{top)) to a file or directory in \var{dirpath}, do \code{os.path.join(\var{dirpath}, \var{name})}. --- 1064,1068 ---- the names of the non-directory files in \var{dirpath}. Note that the names in the lists contain no path components. To get a full ! path (which begins with \var{top}) to a file or directory in \var{dirpath}, do \code{os.path.join(\var{dirpath}, \var{name})}. *************** *** 1086,1090 **** \begin{notice} If you pass a relative pathname, don't change the current working ! directory between resumptions of \function{walk}. \function{walk} never changes the current directory, and assumes that its caller doesn't either. --- 1085,1089 ---- \begin{notice} If you pass a relative pathname, don't change the current working ! directory between resumptions of \function{walk()}. \function{walk()} never changes the current directory, and assumes that its caller doesn't either. *************** *** 1096,1100 **** (infinite loops are hard to avoid when following symbolic links). To visit linked directories, you can identify them with ! \code{os.path.islink(\var{path})}, and invoke \function{walk(\var{path})} on each directly. \end{notice} --- 1095,1099 ---- (infinite loops are hard to avoid when following symbolic links). To visit linked directories, you can identify them with ! \code{os.path.islink(\var{path})}, and invoke \code{walk(\var{path})} on each directly. \end{notice} From nnorwitz@users.sourceforge.net Fri Apr 25 15:52:45 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:52:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17287 Modified Files: libposixpath.tex Log Message: Fix markup Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** libposixpath.tex 25 Apr 2003 07:11:47 -0000 1.34 --- libposixpath.tex 25 Apr 2003 14:52:41 -0000 1.35 *************** *** 241,245 **** \begin{seealso} \seemodule{os}{The newer \function{os.walk()} generator supplies similar ! functionality and can be easier to use. \end{seealso} --- 241,245 ---- \begin{seealso} \seemodule{os}{The newer \function{os.walk()} generator supplies similar ! functionality and can be easier to use.} \end{seealso} From nnorwitz@users.sourceforge.net Fri Apr 25 15:53:51 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 25 Apr 2003 07:53:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17577 Modified Files: libsocket.tex Log Message: Add versionadded for has_ipv6 attribute Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** libsocket.tex 25 Apr 2003 05:48:31 -0000 1.70 --- libsocket.tex 25 Apr 2003 14:53:48 -0000 1.71 *************** *** 154,157 **** --- 154,158 ---- This constant contains a boolean value which indicates if IPv6 is supported on this platform. + \versionadded{2.3} \end{datadesc} From gvanrossum@users.sourceforge.net Fri Apr 25 16:01:08 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:01:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20288/Lib/test Modified Files: test_urllib.py Log Message: Fix the tests on Windows, by writing the test data file in binary mode. XXX I'm not convinced that this is the right solution -- arguably, on Windows, the _fileobject class should honor the mode argument and do newline translation. But it's never done that so I think there's no urgent need to fix this today. Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_urllib.py 25 Apr 2003 09:39:47 -0000 1.10 --- test_urllib.py 25 Apr 2003 15:01:05 -0000 1.11 *************** *** 25,29 **** """Setup of a temp file to use for testing""" self.text = "test_urllib: %s\n" % self.__class__.__name__ ! FILE = file(test_support.TESTFN, 'w') try: FILE.write(self.text) --- 25,29 ---- """Setup of a temp file to use for testing""" self.text = "test_urllib: %s\n" % self.__class__.__name__ ! FILE = file(test_support.TESTFN, 'wb') try: FILE.write(self.text) From fdrake@users.sourceforge.net Fri Apr 25 16:12:50 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:12:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26441 Modified Files: libposixpath.tex Log Message: Use a simpler \note instead of a "See also" section to refer to the os.walk() generator. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** libposixpath.tex 25 Apr 2003 14:52:41 -0000 1.35 --- libposixpath.tex 25 Apr 2003 15:12:47 -0000 1.36 *************** *** 239,247 **** \end{notice} ! \begin{seealso} ! \seemodule{os}{The newer \function{os.walk()} generator supplies similar ! functionality and can be easier to use.} ! \end{seealso} ! \end{funcdesc} --- 239,244 ---- \end{notice} ! \note{The newer \function{\refmodule{os}.walk()} generator supplies ! similar functionality and can be easier to use.} \end{funcdesc} From gvanrossum@users.sourceforge.net Fri Apr 25 16:11:27 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:11:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25523 Modified Files: test_socket.py Log Message: Skip testing inet_ntop() an inet_pton() if they aren't defined. This makes the test pass on Windows again (and on other platforms that don't have these). Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** test_socket.py 25 Apr 2003 05:48:32 -0000 1.62 --- test_socket.py 25 Apr 2003 15:11:23 -0000 1.63 *************** *** 320,323 **** --- 320,325 ---- def testIPv4toString(self): + if not hasattr(socket, 'inet_pton'): + return # No inet_pton() on this platform from socket import inet_aton as f, inet_pton, AF_INET g = lambda a: inet_pton(AF_INET, a) *************** *** 333,336 **** --- 335,340 ---- def testIPv6toString(self): + if not hasattr(socket, 'inet_pton'): + return # No inet_pton() on this platform try: from socket import inet_pton, AF_INET6, has_ipv6 *************** *** 350,353 **** --- 354,359 ---- def testStringToIPv4(self): + if not hasattr(socket, 'inet_ntop'): + return # No inet_ntop() on this platform from socket import inet_ntoa as f, inet_ntop, AF_INET g = lambda a: inet_ntop(AF_INET, a) *************** *** 363,366 **** --- 369,374 ---- def testStringToIPv6(self): + if not hasattr(socket, 'inet_ntop'): + return # No inet_ntop() on this platform try: from socket import inet_ntop, AF_INET6, has_ipv6 From montanaro@users.sourceforge.net Fri Apr 25 16:14:52 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:14:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcsv.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27333 Modified Files: libcsv.tex Log Message: reflect csv's change back to a module. Document the new sniffer api. Index: libcsv.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcsv.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libcsv.tex 24 Apr 2003 18:47:31 -0000 1.2 --- libcsv.tex 25 Apr 2003 15:14:49 -0000 1.3 *************** *** 20,24 **** of reading and writing the data from the programmer. ! The \module{csv} package implements classes to read and write tabular data in CSV format. It allows programmers to say, ``write this data in the format preferred by Excel,'' or ``read data from this file which was generated by --- 20,24 ---- of reading and writing the data from the programmer. ! The \module{csv} module implements classes to read and write tabular data in CSV format. It allows programmers to say, ``write this data in the format preferred by Excel,'' or ``read data from this file which was generated by *************** *** 27,35 **** applications or define their own special-purpose CSV formats. ! The \module{csv} package's \class{reader} and \class{writer} objects read and write sequences. Programmers can also read and write data in dictionary form using the \class{DictReader} and \class{DictWriter} classes. ! \note{The first version of the \module{csv} package doesn't support Unicode input. Also, there are currently some issues regarding \ASCII{} NUL characters. Accordingly, all input should generally be printable \ASCII{} --- 27,35 ---- applications or define their own special-purpose CSV formats. ! The \module{csv} module's \class{reader} and \class{writer} objects read and write sequences. Programmers can also read and write data in dictionary form using the \class{DictReader} and \class{DictWriter} classes. ! \note{The first version of the \module{csv} module doesn't support Unicode input. Also, there are currently some issues regarding \ASCII{} NUL characters. Accordingly, all input should generally be printable \ASCII{} *************** *** 44,51 **** ! \subsection{Package Contents} ! The \module{csv} package defines the following functions: \begin{funcdesc}{reader}{csvfile\optional{, --- 44,51 ---- ! \subsection{Module Contents} ! The \module{csv} module defines the following functions: \begin{funcdesc}{reader}{csvfile\optional{, *************** *** 110,114 **** ! The \module{csv} package defines the following classes: \begin{classdesc}{DictReader}{csvfile, fieldnames\optional{, --- 110,114 ---- ! The \module{csv} module defines the following classes: \begin{classdesc}{DictReader}{csvfile, fieldnames\optional{, *************** *** 264,285 **** ! \subsection{Submodule \code{utils}} ! ! The \module{csv} package contains a \module{utils} submodule which defines ! the following class. ! ! \begin{classdesc}{Sniffer}{\optional{sample=16384}} ! The \class{Sniffer} class is used to deduce the format of a CSV file. The ! optional \var{sample} argument to the constructor specifies the number of ! bytes to use when determining Dialect parameters. ! \begin{methoddesc}{sniff}{fileobj} ! Analyze the next chunk of \var{fileobj} and return a \class{Dialect} class ! reflecting the parameters found. \end{methoddesc} ! \begin{methoddesc} ! \end{methoddesc} \end{classdesc} --- 264,279 ---- ! \begin{classdesc}{Sniffer}{} ! The \class{Sniffer} class is used to deduce the format of a CSV file. ! \begin{methoddesc}{sniff}{sample} ! Analyze the sample text (presumed to be in CSV format) and return a ! {}\class{Dialect} class reflecting the parameters found. \end{methoddesc} ! \begin{methoddesc}{has_header}{sample} ! Analyze the sample text (presumed to be in CSV format) and return ! {}\code{True} if the first row appears to be a series of column headers. \end{methoddesc} \end{classdesc} From montanaro@users.sourceforge.net Fri Apr 25 16:17:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:17:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sre.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28369 Modified Files: test_sre.py Log Message: Remove tests which were migrated to test_re.py. There are still more tests to migrate. Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_sre.py 20 Apr 2003 07:35:44 -0000 1.41 --- test_sre.py 25 Apr 2003 15:17:03 -0000 1.42 *************** *** 47,59 **** print 'Running tests on character literals' - for i in [0, 8, 16, 32, 64, 127, 128, 255]: - test(r"""sre.match(r"\%03o" % i, chr(i)) is not None""", 1) - test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") is not None""", 1) - test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") is not None""", 1) - test(r"""sre.match(r"\x%02x" % i, chr(i)) is not None""", 1) - test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") is not None""", 1) - test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") is not None""", 1) - test(r"""sre.match("\911", "")""", None, sre.error) - # # Misc tests from Tim Peters' re.doc --- 47,50 ---- *************** *** 74,199 **** test(r"""sre.match(r'a+', 'xxx')""", None) - # bug 113254 - test(r"""sre.match(r'(a)|(b)', 'b').start(1)""", -1) - test(r"""sre.match(r'(a)|(b)', 'b').end(1)""", -1) - test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1)) - - # bug described in patches 527371/672491 - test(r"""sre.match(r'(a)?a','a').lastindex""", None) - test(r"""sre.match(r'(a)(b)?b','ab').lastindex""", 1) - test(r"""sre.match(r'(?Pa)(?Pb)?b','ab').lastgroup""", 'a') - test(r"""sre.match("(?Pa(b))", "ab").lastgroup""", 'a') - test(r"""sre.match("((a))", "a").lastindex""", 1) - - # bug 545855 -- This pattern failed to cause a compile error as it - # should, instead provoking a TypeError. - test(r"""sre.compile('foo[a-')""", None, sre.error) - - # bugs 418626 at al. -- Testing Greg Chapman's addition of op code - # SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of - # pattern '*?' on a long string. - test(r"""sre.match('.*?c', 10000*'ab'+'cd').end(0)""", 20001) - test(r"""sre.match('.*?cd', 5000*'ab'+'c'+5000*'ab'+'cde').end(0)""", 20003) - test(r"""sre.match('.*?cd', 20000*'abc'+'de').end(0)""", 60001) - # non-simple '*?' still recurses and hits the recursion limit - test(r"""sre.search('(a|b)*?c', 10000*'ab'+'cd').end(0)""", None, RuntimeError) - - # bug 612074 - pat=u"["+sre.escape(u"\u2039")+u"]" - test(r"""sre.compile(pat) and 1""", 1, None) - - if verbose: - print 'Running tests on sre.sub' - - test(r"""sre.sub(r"(?i)b+", "x", "bbbb BBBB")""", 'x x') - - def bump_num(matchobj): - int_value = int(matchobj.group(0)) - return str(int_value + 1) - - test(r"""sre.sub(r'\d+', bump_num, '08.2 -2 23x99y')""", '9.3 -3 24x100y') - test(r"""sre.sub(r'\d+', bump_num, '08.2 -2 23x99y', 3)""", '9.3 -3 23x99y') - - test(r"""sre.sub(r'.', lambda m: r"\n", 'x')""", '\\n') - test(r"""sre.sub(r'.', r"\n", 'x')""", '\n') - - s = r"\1\1" - - test(r"""sre.sub(r'(.)', s, 'x')""", 'xx') - test(r"""sre.sub(r'(.)', sre.escape(s), 'x')""", s) - test(r"""sre.sub(r'(.)', lambda m: s, 'x')""", s) - - test(r"""sre.sub(r'(?Px)', '\g\g', 'xx')""", 'xxxx') - test(r"""sre.sub(r'(?Px)', '\g\g<1>', 'xx')""", 'xxxx') - test(r"""sre.sub(r'(?Px)', '\g\g', 'xx')""", 'xxxx') - test(r"""sre.sub(r'(?Px)', '\g<1>\g<1>', 'xx')""", 'xxxx') - - # bug 449964: fails for group followed by other escape - test(r"""sre.sub(r'(?Px)', '\g<1>\g<1>\\b', 'xx')""", 'xx\bxx\b') - - test(r"""sre.sub(r'a', r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D', 'a')""", '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D') - test(r"""sre.sub(r'a', '\t\n\v\r\f\a', 'a')""", '\t\n\v\r\f\a') - test(r"""sre.sub(r'a', '\t\n\v\r\f\a', 'a')""", (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7))) - - test(r"""sre.sub(r'^\s*', 'X', 'test')""", 'Xtest') - - # qualified sub - test(r"""sre.sub(r'a', 'b', 'aaaaa')""", 'bbbbb') - test(r"""sre.sub(r'a', 'b', 'aaaaa', 1)""", 'baaaa') - - # bug 114660 - test(r"""sre.sub(r'(\S)\s+(\S)', r'\1 \2', 'hello there')""", 'hello there') - - # Test for sub() on escaped characters, see SF bug #449000 - test(r"""sre.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n') - test(r"""sre.sub('\r\n', r'\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n') - test(r"""sre.sub(r'\r\n', '\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n') - test(r"""sre.sub('\r\n', '\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n') - - # Test for empty sub() behaviour, see SF bug #462270 - test(r"""sre.sub('x*', '-', 'abxd')""", '-a-b-d-') - test(r"""sre.sub('x+', '-', 'abxd')""", 'ab-d') - - if verbose: - print 'Running tests on symbolic references' - - test(r"""sre.sub(r'(?Px)', '\gx)', '\g<', 'xx')""", None, sre.error) - test(r"""sre.sub(r'(?Px)', '\g', 'xx')""", None, sre.error) - test(r"""sre.sub(r'(?Px)', '\g', 'xx')""", None, sre.error) - test(r"""sre.sub(r'(?Px)', '\g<1a1>', 'xx')""", None, sre.error) - test(r"""sre.sub(r'(?Px)', '\g', 'xx')""", None, IndexError) - test(r"""sre.sub(r'(?Px)|(?Py)', '\g', 'xx')""", None, sre.error) - test(r"""sre.sub(r'(?Px)|(?Py)', '\\2', 'xx')""", None, sre.error) - - if verbose: - print 'Running tests on sre.subn' - - test(r"""sre.subn(r"(?i)b+", "x", "bbbb BBBB")""", ('x x', 2)) - test(r"""sre.subn(r"b+", "x", "bbbb BBBB")""", ('x BBBB', 1)) - test(r"""sre.subn(r"b+", "x", "xyz")""", ('xyz', 0)) - test(r"""sre.subn(r"b*", "x", "xyz")""", ('xxxyxzx', 4)) - test(r"""sre.subn(r"b*", "x", "xyz", 2)""", ('xxxyz', 2)) - - if verbose: - print 'Running tests on sre.split' - - test(r"""sre.split(r":", ":a:b::c")""", ['', 'a', 'b', '', 'c']) - test(r"""sre.split(r":+", ":a:b:::")""", ['', 'a', 'b', '']) - test(r"""sre.split(r":*", ":a:b::c")""", ['', 'a', 'b', 'c']) - test(r"""sre.split(r"(:*)", ":a:b::c")""", ['', ':', 'a', ':', 'b', '::', 'c']) - test(r"""sre.split(r"(?::*)", ":a:b::c")""", ['', 'a', 'b', 'c']) - test(r"""sre.split(r"(:)*", ":a:b::c")""", ['', ':', 'a', ':', 'b', ':', 'c']) - test(r"""sre.split(r"([b:]+)", ":a:b::c")""", ['', ':', 'a', ':b::', 'c']) - test(r"""sre.split(r"(b)|(:+)", ":a:b::c")""", - ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']) - test(r"""sre.split(r"(?:b)|(?::+)", ":a:b::c")""", ['', 'a', '', '', 'c']) - - test(r"""sre.split(r":", ":a:b::c", 2)""", ['', 'a', 'b::c']) - test(r"""sre.split(r':', 'a:b:c:d', 2)""", ['a', 'b', 'c:d']) - - test(r"""sre.split(r"(:)", ":a:b::c", 2)""", ['', ':', 'a', ':', 'b::c']) - test(r"""sre.split(r"(:*)", ":a:b::c", 2)""", ['', ':', 'a', ':', 'b::c']) - if verbose: print "Running tests on sre.findall" --- 65,68 ---- *************** *** 322,454 **** test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) - - from test.re_tests import * - - if verbose: - print 'Running re_tests test suite' - else: - # To save time, only run the first and last 10 tests - #tests = tests[:10] + tests[-10:] - pass - - for t in tests: - sys.stdout.flush() - pattern=s=outcome=repl=expected=None - if len(t)==5: - pattern, s, outcome, repl, expected = t - elif len(t)==3: - pattern, s, outcome = t - else: - raise ValueError, ('Test tuples should have 3 or 5 fields',t) - - try: - obj=sre.compile(pattern) - except sre.error: - if outcome==SYNTAX_ERROR: pass # Expected a syntax error - else: - print '=== Syntax error:', t - except KeyboardInterrupt: raise KeyboardInterrupt - except: - print '*** Unexpected error ***', t - if verbose: - traceback.print_exc(file=sys.stdout) - else: - try: - result=obj.search(s) - except (sre.error), msg: - print '=== Unexpected exception', t, repr(msg) - if outcome==SYNTAX_ERROR: - print '=== Compiled incorrectly', t - elif outcome==FAIL: - if result is None: pass # No match, as expected - else: print '=== Succeeded incorrectly', t - elif outcome==SUCCEED: - if result is not None: - # Matched, as expected, so now we compute the - # result string and compare it to our expected result. - start, end = result.span(0) - vardict={'found': result.group(0), - 'groups': result.group(), - 'flags': result.re.flags} - for i in range(1, 100): - try: - gi = result.group(i) - # Special hack because else the string concat fails: - if gi is None: - gi = "None" - except IndexError: - gi = "Error" - vardict['g%d' % i] = gi - for i in result.re.groupindex.keys(): - try: - gi = result.group(i) - if gi is None: - gi = "None" - except IndexError: - gi = "Error" - vardict[i] = gi - repl=eval(repl, vardict) - if repl!=expected: - print '=== grouping error', t, - print repr(repl)+' should be '+repr(expected) - else: - print '=== Failed incorrectly', t - continue - - # Try the match on a unicode string, and check that it - # still succeeds. - try: - u = unicode(s, "latin-1") - except NameError: - pass - except TypeError: - continue # skip unicode test strings - else: - result=obj.search(u) - if result==None: - print '=== Fails on unicode match', t - - # Try the match on a unicode pattern, and check that it - # still succeeds. - try: - u = unicode(pattern, "latin-1") - except NameError: - pass - else: - obj=sre.compile(u) - result=obj.search(s) - if result==None: - print '=== Fails on unicode pattern match', t - - # Try the match with the search area limited to the extent - # of the match and see if it still succeeds. \B will - # break (because it won't match at the end or start of a - # string), so we'll ignore patterns that feature it. - - if pattern[:2]!='\\B' and pattern[-2:]!='\\B': - obj=sre.compile(pattern) - result=obj.search(s, result.start(0), result.end(0)+1) - if result==None: - print '=== Failed on range-limited match', t - - # Try the match with IGNORECASE enabled, and check that it - # still succeeds. - obj=sre.compile(pattern, sre.IGNORECASE) - result=obj.search(s) - if result==None: - print '=== Fails on case-insensitive match', t - - # Try the match with LOCALE enabled, and check that it - # still succeeds. - obj=sre.compile(pattern, sre.LOCALE) - result=obj.search(s) - if result==None: - print '=== Fails on locale-sensitive match', t - - # Try the match with UNICODE locale enabled, and check - # that it still succeeds. - if have_unicode: - obj=sre.compile(pattern, sre.UNICODE) - result=obj.search(s) - if result==None: - print '=== Fails on unicode-sensitive match', t --- 191,192 ---- From gvanrossum@users.sourceforge.net Fri Apr 25 16:27:02 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:27:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv32305 Modified Files: libsocket.tex Log Message: Fix a copy-paste error: the paragraph about inet_ntop's use was copied literally from inet_pton. Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** libsocket.tex 25 Apr 2003 14:53:48 -0000 1.71 --- libsocket.tex 25 Apr 2003 15:26:58 -0000 1.72 *************** *** 382,387 **** and \constant{AF_INET6}. ! \function{inet_pton()} is useful when a library or network protocol calls for ! an object of type \ctype{struct in_addr} (similar to \function{inet_aton()}) or \ctype{struct in6_addr}. --- 382,387 ---- and \constant{AF_INET6}. ! \function{inet_ntop()} is useful when a library or network protocol returns ! an object of type \ctype{struct in_addr} (similar to \function{inet_ntoa()}) or \ctype{struct in6_addr}. From fdrake@users.sourceforge.net Fri Apr 25 16:27:36 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:27:36 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib2.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv32507 Modified Files: liburllib2.tex Log Message: Add modified versions of the examples from Sean Reifschneider (SF patch #545480). Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** liburllib2.tex 24 Apr 2003 15:32:07 -0000 1.7 --- liburllib2.tex 25 Apr 2003 15:27:33 -0000 1.8 *************** *** 602,603 **** --- 602,639 ---- Raise a \exception{URLError} exception. \end{methoddesc} + + + \subsection{Examples \label{urllib2-examples}} + + This example gets the python.org main page and displays the first 100 + bytes of it: + + \begin{verbatim} + >>> import urllib2 + >>> f = urllib2.urlopen('http://www.python.org/') + >>> print f.read(100) + + >> import urllib2 + >>> req = urllib2.Request(url='https://localhost/cgi-bin/test.cgi', + ... data='This data is passed to stdin of the CGI') + >>> f = urllib2.urlopen(req) + >>> print f.read() + Got Data: "This data is passed to stdin of the CGI" + \end{verbatim} + + The code for the sample CGI used in the above example is: + + \begin{verbatim} + #!/usr/bin/env python + import sys + data = sys.stdin.read() + print 'Content-type: text-plain\n\nGot Data: "%s"' % + data + \end{verbatim} From fdrake@users.sourceforge.net Fri Apr 25 16:29:25 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:29:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib2.tex,1.6.8.1,1.6.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv740 Modified Files: Tag: release22-maint liburllib2.tex Log Message: Add modified versions of the examples from Sean Reifschneider (SF patch #545480). Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.6.8.1 retrieving revision 1.6.8.2 diff -C2 -d -r1.6.8.1 -r1.6.8.2 *** liburllib2.tex 25 Apr 2003 05:31:43 -0000 1.6.8.1 --- liburllib2.tex 25 Apr 2003 15:29:22 -0000 1.6.8.2 *************** *** 602,603 **** --- 602,639 ---- Raise a \exception{URLError} exception. \end{methoddesc} + + + \subsection{Examples \label{urllib2-examples}} + + This example gets the python.org main page and displays the first 100 + bytes of it: + + \begin{verbatim} + >>> import urllib2 + >>> f = urllib2.urlopen('http://www.python.org/') + >>> print f.read(100) + + >> import urllib2 + >>> req = urllib2.Request(url='https://localhost/cgi-bin/test.cgi', + ... data='This data is passed to stdin of the CGI') + >>> f = urllib2.urlopen(req) + >>> print f.read() + Got Data: "This data is passed to stdin of the CGI" + \end{verbatim} + + The code for the sample CGI used in the above example is: + + \begin{verbatim} + #!/usr/bin/env python + import sys + data = sys.stdin.read() + print 'Content-type: text-plain\n\nGot Data: "%s"' % + data + \end{verbatim} From montanaro@users.sourceforge.net Fri Apr 25 16:40:34 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:40:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv5064 Modified Files: test_re.py Log Message: more tests converted from test_sre Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test_re.py 25 Apr 2003 14:31:54 -0000 1.37 --- test_re.py 25 Apr 2003 15:40:28 -0000 1.38 *************** *** 4,7 **** --- 4,8 ---- from test.test_support import verbose, run_suite import re + from sre import Scanner import sys, os, traceback *************** *** 169,173 **** self.assertEqual(re.match(re.escape(chr(i)), chr(i)).span(), (0,1)) ! pat=re.compile( re.escape(p) ) self.assertEqual(pat.match(p) is not None, True) self.assertEqual(pat.match(p).span(), (0,256)) --- 170,174 ---- self.assertEqual(re.match(re.escape(chr(i)), chr(i)).span(), (0,1)) ! pat=re.compile(re.escape(p)) self.assertEqual(pat.match(p) is not None, True) self.assertEqual(pat.match(p).span(), (0,256)) *************** *** 175,178 **** --- 176,184 ---- def test_pickling(self): import pickle + self.pickle_test(pickle) + import cPickle + self.pickle_test(cPickle) + + def pickle_test(self, pickle): oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)') s = pickle.dumps(oldpat) *************** *** 188,203 **** def test_flags(self): ! for flags in [re.I, re.M, re.X, re.S, re.L]: ! r = re.compile('^pattern$', flags) ! ! def test_limitations(self): ! # Try nasty case that overflows the straightforward recursive ! # implementation of repeated groups. ! try: ! re.match('(x)*', 50000*'x') ! except RuntimeError, v: ! self.assertEqual(str(v), "maximum recursion limit exceeded") ! else: ! self.fail("re.match('(x)*', 50000*'x') should have failed") def test_sre_character_literals(self): --- 194,199 ---- def test_flags(self): ! for flag in [re.I, re.M, re.X, re.S, re.L]: ! self.assertNotEqual(re.compile('^pattern$', flag), None) def test_sre_character_literals(self): *************** *** 244,247 **** --- 240,268 ---- self.assertEqual(re.compile(pat) and 1, 1) + def test_stack_overflow(self): + # nasty case that overflows the straightforward recursive + # implementation of repeated groups. + self.assertRaises(RuntimeError, re.match, '(x)*', 50000*'x') + self.assertRaises(RuntimeError, re.match, '(x)*y', 50000*'x'+'y') + self.assertRaises(RuntimeError, re.match, '(x)*?y', 50000*'x'+'y') + + def test_scanner(self): + def s_ident(scanner, token): return token + def s_operator(scanner, token): return "op%s" % token + def s_float(scanner, token): return float(token) + def s_int(scanner, token): return int(token) + + scanner = Scanner([ + (r"[a-zA-Z_]\w*", s_ident), + (r"\d+\.\d*", s_float), + (r"\d+", s_int), + (r"=|\+|-|\*|/", s_operator), + (r"\s+", None), + ]) + + self.assertEqual(scanner.scan("sum = 3*foo + 312.50 + bar"), + (['sum', 'op=', 3, 'op*', 'foo', 'op+', 312.5, + 'op+', 'bar'], '')) + def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR *************** *** 369,376 **** def test_main(): - run_re_tests() suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(ReTests)) run_suite(suite) if __name__ == "__main__": --- 390,397 ---- def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(ReTests)) run_suite(suite) + run_re_tests() if __name__ == "__main__": From montanaro@users.sourceforge.net Fri Apr 25 16:41:23 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:41:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sre.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv5369 Modified Files: test_sre.py Log Message: deleted more tests which were either already in test_re or that I migrated in the last revison Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_sre.py 25 Apr 2003 15:17:03 -0000 1.42 --- test_sre.py 25 Apr 2003 15:41:19 -0000 1.43 *************** *** 115,192 **** test(r"""sre.match(r'((.%s):)?z', 'z').groups()"""%op, (None, None)) test(r"""sre.match(r'((.%s):)?z', 'a:z').groups()"""%op, ('a:', 'a')) - - if verbose: - print "Running tests on sre.escape" - - p = "" - for i in range(0, 256): - p = p + chr(i) - test(r"""sre.match(sre.escape(chr(i)), chr(i)) is not None""", 1) - test(r"""sre.match(sre.escape(chr(i)), chr(i)).span()""", (0,1)) - - pat = sre.compile(sre.escape(p)) - test(r"""pat.match(p) is not None""", 1) - test(r"""pat.match(p).span()""", (0,256)) - - if verbose: - print 'Running tests on sre.Scanner' - - def s_ident(scanner, token): return token - def s_operator(scanner, token): return "op%s" % token - def s_float(scanner, token): return float(token) - def s_int(scanner, token): return int(token) - - scanner = sre.Scanner([ - (r"[a-zA-Z_]\w*", s_ident), - (r"\d+\.\d*", s_float), - (r"\d+", s_int), - (r"=|\+|-|\*|/", s_operator), - (r"\s+", None), - ]) - - # sanity check - test('scanner.scan("sum = 3*foo + 312.50 + bar")', - (['sum', 'op=', 3, 'op*', 'foo', 'op+', 312.5, 'op+', 'bar'], '')) - - if verbose: - print 'Pickling a SRE_Pattern instance' - - try: - import pickle - pat = sre.compile(r'a(?:b|(c|e){1,2}?|d)+?(.)') - s = pickle.dumps(pat) - pat = pickle.loads(s) - except: - print TestFailed, 're module pickle' - - try: - import cPickle - pat = sre.compile(r'a(?:b|(c|e){1,2}?|d)+?(.)') - s = cPickle.dumps(pat) - pat = cPickle.loads(s) - except: - print TestFailed, 're module cPickle' - - # constants - test(r"""sre.I""", sre.IGNORECASE) - test(r"""sre.L""", sre.LOCALE) - test(r"""sre.M""", sre.MULTILINE) - test(r"""sre.S""", sre.DOTALL) - test(r"""sre.X""", sre.VERBOSE) - test(r"""sre.T""", sre.TEMPLATE) - test(r"""sre.U""", sre.UNICODE) - - for flags in [sre.I, sre.M, sre.X, sre.S, sre.L, sre.T, sre.U]: - try: - r = sre.compile('^pattern$', flags) - except: - print 'Exception raised on flag', flags - - if verbose: - print 'Test engine limitations' - - # Try nasty case that overflows the straightforward recursive - # implementation of repeated groups. - test("sre.match('(x)*', 50000*'x').span()", (0, 50000), RuntimeError) - test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) - test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) --- 115,116 ---- From montanaro@users.sourceforge.net Fri Apr 25 16:59:17 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 08:59:17 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sre.py,1.43,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12473 Removed Files: test_sre.py Log Message: test_sre is dead! long live test_re! --- test_sre.py DELETED --- From montanaro@users.sourceforge.net Fri Apr 25 17:00:26 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 09:00:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13121 Modified Files: test_re.py Log Message: final bit of tests converted from test_sre Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** test_re.py 25 Apr 2003 15:40:28 -0000 1.38 --- test_re.py 25 Apr 2003 16:00:14 -0000 1.39 *************** *** 17,26 **** self.assertEqual(re.search('x+', 'axx').span(0), (1, 3)) self.assertEqual(re.search('x+', 'axx').span(), (1, 3)) ! self.assertEqual(re.search('x', 'aaa') is None, True) self.assertEqual(re.match('a*', 'xxx').span(0), (0, 0)) self.assertEqual(re.match('a*', 'xxx').span(), (0, 0)) self.assertEqual(re.match('x*', 'xxxa').span(0), (0, 3)) self.assertEqual(re.match('x*', 'xxxa').span(), (0, 3)) ! self.assertEqual(re.match('a+', 'xxx') is None, True) def bump_num(self, matchobj): --- 17,26 ---- self.assertEqual(re.search('x+', 'axx').span(0), (1, 3)) self.assertEqual(re.search('x+', 'axx').span(), (1, 3)) ! self.assertEqual(re.search('x', 'aaa'), None) self.assertEqual(re.match('a*', 'xxx').span(0), (0, 0)) self.assertEqual(re.match('a*', 'xxx').span(), (0, 0)) self.assertEqual(re.match('x*', 'xxxa').span(0), (0, 3)) self.assertEqual(re.match('x*', 'xxxa').span(), (0, 3)) ! self.assertEqual(re.match('a+', 'xxx'), None) def bump_num(self, matchobj): *************** *** 134,144 **** (":", "::")]) def test_re_match(self): ! # No groups at all ! m = re.match('a', 'a') ! self.assertEqual(m.groups(), ()) ! # A single group ! m = re.match('(a)', 'a') ! self.assertEqual(m.groups(), ('a',)) pat = re.compile('((a)|(b))(c)?') --- 134,147 ---- (":", "::")]) + def test_bug_117612(self): + self.assertEqual(re.findall(r"(a|(b))", "aba"), + [("a", ""),("b", "b"),("a", "")]) + def test_re_match(self): ! self.assertEqual(re.match('a', 'a').groups(), ()) ! self.assertEqual(re.match('(a)', 'a').groups(), ('a',)) ! self.assertEqual(re.match(r'(a)', 'a').group(0), 'a') ! self.assertEqual(re.match(r'(a)', 'a').group(1), 'a') ! self.assertEqual(re.match(r'(a)', 'a').group(1, 1), ('a', 'a')) pat = re.compile('((a)|(b))(c)?') *************** *** 264,267 **** --- 267,284 ---- (['sum', 'op=', 3, 'op*', 'foo', 'op+', 312.5, 'op+', 'bar'], '')) + + def test_bug_448951(self): + # bug 448951 (similar to 429357, but with single char match) + # (Also test greedy matches.) + for op in '','?','*': + self.assertEqual(re.match(r'((.%s):)?z'%op, 'z').groups(), + (None, None)) + self.assertEqual(re.match(r'((.%s):)?z'%op, 'a:z').groups(), + ('a:', 'a')) + + def test_finditer(self): + iter = re.finditer(r":+", "a:b::c:::d") + self.assertEqual([item.group(0) for item in iter], + [":", "::", ":::"]) def run_re_tests(): From fdrake@users.sourceforge.net Fri Apr 25 17:16:06 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 09:16:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19504 Modified Files: libsocket.tex Log Message: - add availability statements for some of the new APIs - lots of general cleanup Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** libsocket.tex 25 Apr 2003 15:26:58 -0000 1.72 --- libsocket.tex 25 Apr 2003 16:16:02 -0000 1.73 *************** *** 157,167 **** \end{datadesc} ! \begin{funcdesc}{getaddrinfo}{host, port\optional{, family, socktype, proto, flags}} ! Resolves the \var{host}/\var{port} argument, into a sequence of 5-tuples that contain all the necessary argument for the sockets manipulation. \var{host} is a domain name, a string representation of IPv4/v6 address or \code{None}. ! \var{port} is a string service name (like \code{``http''}), a numeric port number or \code{None}. --- 157,168 ---- \end{datadesc} ! \begin{funcdesc}{getaddrinfo}{host, port\optional{, family\optional{, ! socktype\optional{, proto\optional{, ! flags}}}}} Resolves the \var{host}/\var{port} argument, into a sequence of 5-tuples that contain all the necessary argument for the sockets manipulation. \var{host} is a domain name, a string representation of IPv4/v6 address or \code{None}. ! \var{port} is a string service name (like \code{'http'}), a numeric port number or \code{None}. *************** *** 172,184 **** the following structure: ! \code{(\var{family}, \var{socktype}, \var{proto}, \var{canonname}, \var{sockaddr})}. \var{family}, \var{socktype}, \var{proto} are all integer and are meant to be passed to the \function{socket()} function. \var{canonname} is a string representing the canonical name of the \var{host}. ! It can be a numeric IPv4/v6 address when \code{AI_CANONNAME} is specified for a numeric \var{host}. \var{sockaddr} is a tuple describing a socket address, as described above. ! See \code{Lib/httplib.py} and other library files for a typical usage of the function. \versionadded{2.2} --- 173,186 ---- the following structure: ! \code{(\var{family}, \var{socktype}, \var{proto}, \var{canonname}, ! \var{sockaddr})} \var{family}, \var{socktype}, \var{proto} are all integer and are meant to be passed to the \function{socket()} function. \var{canonname} is a string representing the canonical name of the \var{host}. ! It can be a numeric IPv4/v6 address when \constant{AI_CANONNAME} is specified for a numeric \var{host}. \var{sockaddr} is a tuple describing a socket address, as described above. ! See the source for the \refmodule{httplib} and other library modules for a typical usage of the function. \versionadded{2.2} *************** *** 207,214 **** \begin{funcdesc}{gethostbyname_ex}{hostname} Translate a host name to IPv4 address format, extended interface. ! Return a triple \code{(hostname, aliaslist, ipaddrlist)} where ! \code{hostname} is the primary host name responding to the given ! \var{ip_address}, \code{aliaslist} is a (possibly empty) list of ! alternative host names for the same address, and \code{ipaddrlist} is a list of IPv4 addresses for the same interface on the same host (often but not always a single address). --- 209,217 ---- \begin{funcdesc}{gethostbyname_ex}{hostname} Translate a host name to IPv4 address format, extended interface. ! Return a triple \code{(\var{hostname}, \var{aliaslist}, ! \var{ipaddrlist})} where ! \var{hostname} is the primary host name responding to the given ! \var{ip_address}, \var{aliaslist} is a (possibly empty) list of ! alternative host names for the same address, and \var{ipaddrlist} is a list of IPv4 addresses for the same interface on the same host (often but not always a single address). *************** *** 323,331 **** Convert an IPv4 address from dotted-quad string format (for example, '123.45.67.89') to 32-bit packed binary format, as a string four ! characters in length. ! ! Useful when conversing with a program that uses the standard C library ! and needs objects of type \ctype{struct in_addr}, which is the C type ! for the 32-bit packed binary this function returns. If the IPv4 address string passed to this function is invalid, --- 326,333 ---- Convert an IPv4 address from dotted-quad string format (for example, '123.45.67.89') to 32-bit packed binary format, as a string four ! characters in length. This is useful when conversing with a program ! that uses the standard C library and needs objects of type ! \ctype{struct in_addr}, which is the C type for the 32-bit packed ! binary this function returns. If the IPv4 address string passed to this function is invalid, *************** *** 341,354 **** \begin{funcdesc}{inet_ntoa}{packed_ip} Convert a 32-bit packed IPv4 address (a string four characters in ! length) to its standard dotted-quad string representation ! (for example, '123.45.67.89'). ! ! Useful when conversing with a program that uses the standard C library ! and needs objects of type \ctype{struct in_addr}, which is the C type ! for the 32-bit packed binary this function takes as an argument. If the string passed to this function is not exactly 4 bytes in length, \exception{socket.error} will be raised. - \function{inet_ntoa()} does not support IPv6, and \function{getnameinfo()} should be used instead for IPv4/v6 dual stack --- 343,354 ---- \begin{funcdesc}{inet_ntoa}{packed_ip} Convert a 32-bit packed IPv4 address (a string four characters in ! length) to its standard dotted-quad string representation (for ! example, '123.45.67.89'). This is useful when conversing with a ! program that uses the standard C library and needs objects of type ! \ctype{struct in_addr}, which is the C type for the 32-bit packed ! binary data this function takes as an argument. If the string passed to this function is not exactly 4 bytes in length, \exception{socket.error} will be raised. \function{inet_ntoa()} does not support IPv6, and \function{getnameinfo()} should be used instead for IPv4/v6 dual stack *************** *** 359,393 **** Convert an IP address from its family-specific string format to a packed, binary format. - - Supported values for address_family are currently \constant{AF_INET} - and \constant{AF_INET6}. - \function{inet_pton()} is useful when a library or network protocol calls for an object of type \ctype{struct in_addr} (similar to \function{inet_aton()}) or \ctype{struct in6_addr}. ! If the IP address string passed to this function is invalid, \exception{socket.error} will be raised. Note that exactly what is valid depends on both the value of \var{address_family} and the underlying implementation of \cfunction{inet_pton()}. \versionadded{2.3} \end{funcdesc} \begin{funcdesc}{inet_ntop}{address_family, packed_ip} ! Convert a packed IP address (a string of some number of characters) to its ! standard, family-specific string representation (for example, '7.10.0.5' or ! '5aef:2b::8') ! ! Supported values for address_family are currently \constant{AF_INET} ! and \constant{AF_INET6}. ! \function{inet_ntop()} is useful when a library or network protocol returns an object of type \ctype{struct in_addr} (similar to \function{inet_ntoa()}) or \ctype{struct in6_addr}. ! If the string passed to this function is not the correct length for the ! specified address family, \exception{ValueError} will be raised. ! A \exception{socket.error} is raised for errors from the call to \function{inet_ntop()}. \versionadded{2.3} \end{funcdesc} --- 359,393 ---- Convert an IP address from its family-specific string format to a packed, binary format. \function{inet_pton()} is useful when a library or network protocol calls for an object of type \ctype{struct in_addr} (similar to \function{inet_aton()}) or \ctype{struct in6_addr}. ! Supported values for \var{address_family} are currently ! \constant{AF_INET} and \constant{AF_INET6}. ! If the IP address string \var{ip_string} is invalid, \exception{socket.error} will be raised. Note that exactly what is valid depends on both the value of \var{address_family} and the underlying implementation of \cfunction{inet_pton()}. + + Availability: \UNIX{} (maybe not all platforms). \versionadded{2.3} \end{funcdesc} \begin{funcdesc}{inet_ntop}{address_family, packed_ip} ! Convert a packed IP address (a string of some number of characters) to ! its standard, family-specific string representation (for example, ! \code{'7.10.0.5'} or \code{'5aef:2b::8'}) \function{inet_ntop()} is useful when a library or network protocol returns an object of type \ctype{struct in_addr} (similar to \function{inet_ntoa()}) or \ctype{struct in6_addr}. ! Supported values for \var{address_family} are currently ! \constant{AF_INET} and \constant{AF_INET6}. ! If the string \var{packed_ip} is not the correct length for the ! specified address family, \exception{ValueError} will be raised. A ! \exception{socket.error} is raised for errors from the call to \function{inet_ntop()}. + + Availability: \UNIX{} (maybe not all platforms). \versionadded{2.3} \end{funcdesc} *************** *** 617,621 **** Set the value of the given socket option (see the \UNIX{} manual page \manpage{setsockopt}{2}). The needed symbolic constants are defined in ! the \module{socket} module (\code{SO_*} etc.). The value can be an integer or a string representing a buffer. In the latter case it is up to the caller to ensure that the string contains the proper bits --- 617,621 ---- Set the value of the given socket option (see the \UNIX{} manual page \manpage{setsockopt}{2}). The needed symbolic constants are defined in ! the \module{socket} module (\constant{SO_*} etc.). The value can be an integer or a string representing a buffer. In the latter case it is up to the caller to ensure that the string contains the proper bits From fdrake@users.sourceforge.net Fri Apr 25 17:43:31 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 09:43:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1:/tmp/cvs-serv31682 Modified Files: dist.tex Log Message: Updated information on package metadata to reflect recent additions. This is a modified form of SF patch #718027 (mostly markup changes). Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** dist.tex 31 Mar 2003 16:23:09 -0000 1.52 --- dist.tex 25 Apr 2003 16:43:28 -0000 1.53 *************** *** 688,723 **** version. This information includes: ! \begin{tableiii}{l|l|c}{code}% ! {Meta-Data}{Description}{Notes} ! \lineiii{name}{the name of the package}{(1)} ! \lineiii{version}{the version of this release}{(1)} ! \lineiii{author}{package author's name}{(2)} ! \lineiii{author_email}{email address of the package author}{(2)} ! \lineiii{maintainer}{package maintainer's name}{(2)} ! \lineiii{maintainer_email}{email address of the package maintainer}{(2)} ! \lineiii{url}{URL of the package's home page}{(1)} ! \lineiii{license}{the terms the package is released under}{} ! \lineiii{description}{a short, summary description of the package}{} ! \lineiii{long_description}{a longer description of the package}{} ! \lineiii{keywords}{some keywords appropriate to the package}{} ! \lineiii{platforms}{a list of the target platforms}{} ! \lineiii{classifiers}{a list of Trove classifiers}{(3),(4)} ! \lineiii{download_url}{a single URL containing the download location ! for this version of the package}{(3)} ! \end{tableiii} \noindent Notes: \begin{description} ! \item[(1)] these fields are required ! \item[(2)] either the author or the maintainer must be nominated ! \item[(3)] should not be used if your package is to be compatible with ! Python versions prior to 2.2.3 or 2.3. ! \item[(4)] The list of classifiers is available from the ! PyPI website (\url{http://www.python.org/pypi}). ! \option{classifiers} are specified as a list of strings: \begin{verbatim} setup(... ! classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', --- 688,759 ---- version. This information includes: ! \begin{tableiv}{l|l|l|c}{code}% ! {Meta-Data}{Description}{Value}{Notes} ! \lineiv{name}{name of the package} ! {short string}{(1)} ! \lineiv{version}{version of this release} ! {short string}{(1)(2)} ! \lineiv{author}{package author's name} ! {short string}{(3)} ! \lineiv{author_email}{email address of the package author} ! {email address}{(3)} ! \lineiv{maintainer}{package maintainer's name} ! {short string}{(3)} ! \lineiv{maintainer_email}{email address of the package maintainer} ! {email address}{(3)} ! \lineiv{url}{home page for the package} ! {URL}{(1)} ! \lineiv{description}{short, summary description of the package} ! {short string}{} ! \lineiv{long_description}{longer description of the package} ! {long string}{} ! \lineiv{download_url}{location where the package may be downloaded} ! {URL}{(4)} ! \lineiv{classifiers}{a list of Trove classifiers} ! {list of strings}{(4)} ! \end{tableiv} \noindent Notes: \begin{description} ! \item[(1)] These fields are required. ! \item[(2)] It is recommended that versions take the form ! \emph{major.minor\optional{.patch\optional{.sub}}}. ! \item[(3)] Either the author or the maintainer must be identified. ! \item[(4)] These fields should not be used if your package is to be ! compatible with Python versions prior to 2.2.3 or 2.3. The list is ! available from the \ulink{PyPI website}{http://www.python.org/pypi}. ! ! \item["short string"] A single line of text, not more than 200 characters. ! \item["long string"] Multiple lines of plain text in ReStructuredText ! format (see \url{http://docutils.sf.net/}). ! \item["list of strings"] See below. ! \end{description} ! ! None of the string values may be Unicode. ! ! Encoding the version information is an art in itself. Python packages ! generally adhere to the version format ! \emph{major.minor\optional{.patch}\optional{sub}}. The major number is ! 0 for ! initial, experimental releases of software. It is incremented for ! releases that represent major milestones in a package. The minor ! number is incremented when important new features are added to the ! package. The patch number increments when bug-fix releases are ! made. Additional trailing version information is sometimes used to ! indicate sub-releases. These are "a1,a2,...,aN" (for alpha releases, ! where functionality and API may change), "b1,b2,...,bN" (for beta ! releases, which only fix bugs) and "pr1,pr2,...,prN" (for final ! pre-release release testing). Some examples: ! ! \begin{description} ! \item[0.1.0] the first, experimental release of a package ! \item[1.0.1a2] the second alpha release of the first patch version of 1.0 ! \end{description} ! ! \option{classifiers} are specified in a python list: \begin{verbatim} setup(... ! classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Console', *************** *** 735,750 **** 'Topic :: Software Development :: Bug Tracking', ], - ... ) \end{verbatim} - \end{description} ! If you wish to include classifiers or a download URL in your ! \file{setup.py} file and also wish to remain backwards-compatible with ! Python releases prior to 2.2.3, then you can include the following ! code fragment in your \file{setup.py} before the \code{setup()} call: \begin{verbatim} ! # patch distutils if it can't cope with the "classifiers" keyword if sys.version < '2.2.3': from distutils.dist import DistributionMetadata --- 771,785 ---- 'Topic :: Software Development :: Bug Tracking', ], ) \end{verbatim} ! If you wish to include classifiers in your \file{setup.py} file and also ! wish to remain backwards-compatible with Python releases prior to 2.2.3, ! then you can include the following code fragment in your \file{setup.py} ! before the \code{setup()} call. \begin{verbatim} ! # patch distutils if it can't cope with the "classifiers" or ! # "download_url" keywords if sys.version < '2.2.3': from distutils.dist import DistributionMetadata From fdrake@users.sourceforge.net Fri Apr 25 19:02:37 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 11:02:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcsv.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv3294 Modified Files: libcsv.tex Log Message: organizational and markup cleansing Index: libcsv.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcsv.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libcsv.tex 25 Apr 2003 15:14:49 -0000 1.3 --- libcsv.tex 25 Apr 2003 18:02:34 -0000 1.4 *************** *** 31,38 **** form using the \class{DictReader} and \class{DictWriter} classes. ! \note{The first version of the \module{csv} module doesn't support Unicode ! input. Also, there are currently some issues regarding \ASCII{} NUL ! characters. Accordingly, all input should generally be printable \ASCII{} ! to be safe. These restrictions will be removed in the future.} \begin{seealso} --- 31,40 ---- form using the \class{DictReader} and \class{DictWriter} classes. ! \begin{notice} ! This version of the \module{csv} module doesn't support Unicode ! input. Also, there are currently some issues regarding \ASCII{} NUL ! characters. Accordingly, all input should generally be printable ! \ASCII{} to be safe. These restrictions will be removed in the future. ! \end{notice} \begin{seealso} *************** *** 46,50 **** \subsection{Module Contents} - The \module{csv} module defines the following functions: --- 48,51 ---- *************** *** 113,118 **** \begin{classdesc}{DictReader}{csvfile, fieldnames\optional{, ! restkey=\code{None}\optional{, ! restval=\code{None}\optional{, dialect=\code{'excel'}\optional{, fmtparam}}}}} --- 114,119 ---- \begin{classdesc}{DictReader}{csvfile, fieldnames\optional{, ! restkey=\constant{None}\optional{, ! restval=\constant{None}\optional{, dialect=\code{'excel'}\optional{, fmtparam}}}}} *************** *** 146,195 **** \end{classdesc} - \begin{classdesc*}{Dialect}{} The \class{Dialect} class is a container class relied on primarily for its attributes, which are used to define the parameters for a specific ! \class{reader} or \class{writer} instance. Dialect objects support the ! following data attributes: ! ! \begin{memberdesc}[string]{delimiter} ! A one-character string used to separate fields. It defaults to \code{","}. ! \end{memberdesc} ! ! \begin{memberdesc}[boolean]{doublequote} ! Controls how instances of \var{quotechar} appearing inside a field should be ! themselves be quoted. When \constant{True}, the character is doubledd. ! When \constant{False}, the \var{escapechar} must be a one-character string ! which is used as a prefix to the \var{quotechar}. It defaults to ! \constant{True}. ! \end{memberdesc} ! ! \begin{memberdesc}{escapechar} ! A one-character string used to escape the \var{delimiter} if \var{quoting} ! is set to \constant{QUOTE_NONE}. It defaults to \constant{None}. ! \end{memberdesc} ! \begin{memberdesc}[string]{lineterminator} ! The string used to terminate lines in the CSV file. It defaults to ! \code{"\e r\e n"}. ! \end{memberdesc} ! \begin{memberdesc}[string]{quotechar} ! A one-character string used to quote elements containing the \var{delimiter} ! or which start with the \var{quotechar}. It defaults to \code{'"'}. ! \end{memberdesc} ! \begin{memberdesc}[integer]{quoting} ! Controls when quotes should be generated by the writer. It can take on any ! of the \code{QUOTE_*} constants defined below and defaults to ! \constant{QUOTE_MINIMAL}. ! \end{memberdesc} ! \begin{memberdesc}[boolean]{skipinitialspace} ! When \constant{True}, whitespace immediately following the \var{delimiter} ! is ignored. The default is \constant{False}. ! \end{memberdesc} - \end{classdesc*} The \module{csv} module defines the following constants: --- 147,175 ---- \end{classdesc} \begin{classdesc*}{Dialect}{} The \class{Dialect} class is a container class relied on primarily for its attributes, which are used to define the parameters for a specific ! \class{reader} or \class{writer} instance. ! \end{classdesc*} ! \begin{classdesc}{Sniffer}{\optional{sample=16384}} ! The \class{Sniffer} class is used to deduce the format of a CSV file. The ! optional \var{sample} argument to the constructor specifies the number of ! bytes to use when determining Dialect parameters. ! \end{classdesc} ! The \class{Sniffer} class provides a single method: ! \begin{methoddesc}{sniff}{fileobj} ! Analyze the next chunk of \var{fileobj} and return a \class{Dialect} subclass ! reflecting the parameters found. ! \end{methoddesc} ! \begin{methoddesc}{has_header}{sample} ! Analyze the sample text (presumed to be in CSV format) and return ! \constant{True} if the first row appears to be a series of column ! headers. ! \end{methoddesc} The \module{csv} module defines the following constants: *************** *** 224,228 **** ! \subsection{Dialects and Formatting Parameters\label{fmt-params}} To make it easier to specify the format of input and output records, --- 204,208 ---- ! \subsection{Dialects and Formatting Parameters\label{csv-fmt-params}} To make it easier to specify the format of input and output records, *************** *** 236,246 **** attributes defined above for the \class{Dialect} class. \subsection{Reader Objects} ! \class{DictReader} and \var{reader} objects have the following public ! methods: ! \begin{methoddesc}{next}{} Return the next row of the reader's iterable object as a list, parsed according to the current dialect. --- 216,266 ---- attributes defined above for the \class{Dialect} class. + Dialects support the following attributes: + + \begin{memberdesc}[Dialect]{delimiter} + A one-character string used to separate fields. It defaults to \code{','}. + \end{memberdesc} + + \begin{memberdesc}[Dialect]{doublequote} + Controls how instances of \var{quotechar} appearing inside a field should be + themselves be quoted. When \constant{True}, the character is doubledd. + When \constant{False}, the \var{escapechar} must be a one-character string + which is used as a prefix to the \var{quotechar}. It defaults to + \constant{True}. + \end{memberdesc} + + \begin{memberdesc}[Dialect]{escapechar} + A one-character string used to escape the \var{delimiter} if \var{quoting} + is set to \constant{QUOTE_NONE}. It defaults to \constant{None}. + \end{memberdesc} + + \begin{memberdesc}[Dialect]{lineterminator} + The string used to terminate lines in the CSV file. It defaults to + \code{'\e r\e n'}. + \end{memberdesc} + + \begin{memberdesc}[Dialect]{quotechar} + A one-character string used to quote elements containing the \var{delimiter} + or which start with the \var{quotechar}. It defaults to \code{'"'}. + \end{memberdesc} + + \begin{memberdesc}[Dialect]{quoting} + Controls when quotes should be generated by the writer. It can take on any + of the \constant{QUOTE_*} constants defined below and defaults to + \constant{QUOTE_MINIMAL}. + \end{memberdesc} + + \begin{memberdesc}[Dialect]{skipinitialspace} + When \constant{True}, whitespace immediately following the \var{delimiter} + is ignored. The default is \constant{False}. + \end{memberdesc} + \subsection{Reader Objects} ! Reader objects (\class{DictReader} instances and objects returned by ! the \function{reader()}function) have the following public methods: ! \begin{methoddesc}[csv reader]{next}{} Return the next row of the reader's iterable object as a list, parsed according to the current dialect. *************** *** 250,262 **** \subsection{Writer Objects} ! \class{DictWriter} and \var{writer} objects have the following public ! methods: ! \begin{methoddesc}{writerow}{row} Write the \var{row} parameter to the writer's file object, formatted according to the current dialect. \end{methoddesc} ! \begin{methoddesc}{writerows}{rows} Write all the \var{rows} parameters to the writer's file object, formatted according to the current dialect. --- 270,282 ---- \subsection{Writer Objects} ! Writer objects (\class{DictWriter} instances and objects returned by ! the \function{writer()} function) have the following public methods: ! \begin{methoddesc}[csv writer]{writerow}{row} Write the \var{row} parameter to the writer's file object, formatted according to the current dialect. \end{methoddesc} ! \begin{methoddesc}[csv writer]{writerows}{rows} Write all the \var{rows} parameters to the writer's file object, formatted according to the current dialect. *************** *** 264,282 **** - \begin{classdesc}{Sniffer}{} - - The \class{Sniffer} class is used to deduce the format of a CSV file. - - \begin{methoddesc}{sniff}{sample} - Analyze the sample text (presumed to be in CSV format) and return a - {}\class{Dialect} class reflecting the parameters found. - \end{methoddesc} - - \begin{methoddesc}{has_header}{sample} - Analyze the sample text (presumed to be in CSV format) and return - {}\code{True} if the first row appears to be a series of column headers. - \end{methoddesc} - \end{classdesc} - \subsection{Examples} --- 284,287 ---- *************** *** 284,291 **** \begin{verbatim} ! import csv ! reader = csv.reader(file("some.csv")) ! for row in reader: ! print row \end{verbatim} --- 289,296 ---- \begin{verbatim} ! import csv ! reader = csv.reader(file("some.csv")) ! for row in reader: ! print row \end{verbatim} *************** *** 293,299 **** \begin{verbatim} ! import csv ! writer = csv.writer(file("some.csv", "w")) ! for row in someiterable: ! writer.writerow(row) \end{verbatim} --- 298,304 ---- \begin{verbatim} ! import csv ! writer = csv.writer(file("some.csv", "w")) ! for row in someiterable: ! writer.writerow(row) \end{verbatim} From fdrake@users.sourceforge.net Fri Apr 25 20:04:31 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 12:04:31 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.33,1.34 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27885 Modified Files: pep-0283.txt Log Message: Update the note on the PendingDeprecationWarning. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** pep-0283.txt 17 Apr 2003 17:31:58 -0000 1.33 --- pep-0283.txt 25 Apr 2003 19:04:27 -0000 1.34 *************** *** 84,89 **** - Add a new concept, "pending deprecation", with associated warning PendingDeprecationWarning. This warning is normally ! suppressed, but can be enabled by a suitable -W option. (This ! has been added, but nothing uses it yet.) - Warn when an extension type's tp_compare returns anything except --- 84,89 ---- - Add a new concept, "pending deprecation", with associated warning PendingDeprecationWarning. This warning is normally ! suppressed, but can be enabled by a suitable -W option. Only a ! few things use this at this time. - Warn when an extension type's tp_compare returns anything except From gvanrossum@users.sourceforge.net Fri Apr 25 20:20:00 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 12:20:00 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.749,1.750 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2581/Misc Modified Files: NEWS Log Message: Update version number and release date. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.749 retrieving revision 1.750 diff -C2 -d -r1.749 -r1.750 *** NEWS 25 Apr 2003 07:11:48 -0000 1.749 --- NEWS 25 Apr 2003 19:19:52 -0000 1.750 *************** *** 8,12 **** ================================ ! *Release date: XX-XXX-2003* Core and builtins --- 8,12 ---- ================================ ! *Release date: 25-Apr-2003* Core and builtins From gvanrossum@users.sourceforge.net Fri Apr 25 20:20:27 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 12:20:27 -0700 Subject: [Python-checkins] python/dist/src README,1.169,1.170 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv2581 Modified Files: README Log Message: Update version number and release date. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** README 19 Feb 2003 18:18:46 -0000 1.169 --- README 25 Apr 2003 19:19:51 -0000 1.170 *************** *** 1,4 **** ! This is Python version 2.3 alpha 2 ! ================================== Copyright (c) 2001, 2002, 2003 Python Software Foundation. --- 1,4 ---- ! This is Python version 2.3 beta 1 ! ================================= Copyright (c) 2001, 2002, 2003 Python Software Foundation. From fdrake@users.sourceforge.net Fri Apr 25 20:22:28 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 12:22:28 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.34,1.35 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv3877 Modified Files: pep-0283.txt Log Message: - updates to reflect the current state of affairs - small typo fixes Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** pep-0283.txt 25 Apr 2003 19:04:27 -0000 1.34 --- pep-0283.txt 25 Apr 2003 19:22:25 -0000 1.35 *************** *** 117,121 **** - A new command line option parser. Greg Ward's Optik package ! (http://optik.sf.net) has been adopted, convert to a single module named optparse. See also http://www.python.org/sigs/getopt-sig/ --- 117,121 ---- - A new command line option parser. Greg Ward's Optik package ! (http://optik.sf.net) has been adopted, converted to a single module named optparse. See also http://www.python.org/sigs/getopt-sig/ *************** *** 124,130 **** http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage . A prototype was coded in nondist/sandbox/datetime/. Tim Peters ! has finished the C implementation and checked it in. While we ! may be tweaking the API during the alpha test period, I consider ! this module basically complete -- except for its documentation. - PEP 273 Import Modules from Zip Archives Ahlstrom --- 124,128 ---- http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage . A prototype was coded in nondist/sandbox/datetime/. Tim Peters ! has finished the C implementation and checked it in. - PEP 273 Import Modules from Zip Archives Ahlstrom *************** *** 140,147 **** - PEP 305 (CSV File API, by Skip Montanaro et al.) is in; this is ! the csv package. - Raymond Hettinger's itertools module is in. Planned features for 2.3 --- 138,153 ---- - PEP 305 (CSV File API, by Skip Montanaro et al.) is in; this is ! the csv module. - Raymond Hettinger's itertools module is in. + - PEP 311 (Simplified GIL Acquisition for Extensions, by Mark + Hammond) has been included in beta 1. + + - A new PyArg_Parse*() format code that returns an unsigned C long + int that receives the lower LONG_BIT bits of the Python + argument, truncating without range checking. (SF 595026; Thomas + Heller did this work.) + Planned features for 2.3 *************** *** 159,172 **** project (http://idlefork.sf.net). - - We need a new PyArg_Parse*() format code that returns an - unsigned C long int that receives the lower LONG_BIT bits of the - Python argument, truncating without range checking. (SF - 595026; Thomas Heller is working on this.) - - The import lock could use some redesign. (SF 683658.) - - PEP 311 (Simplified GIL Acquisition for Extensions, by Mark - Hammond) is expected to go into beta 1. - Ongoing tasks --- 165,170 ---- *************** *** 181,185 **** classes. ! - Look over the Demos/ directory and update where required. - New tests. --- 179,184 ---- classes. ! - Look over the Demos/ directory and update where required (Andrew ! Kuchling has done a lot of this) - New tests. From theller@python.net Fri Apr 25 20:55:11 2003 From: theller@python.net (Thomas Heller) Date: 25 Apr 2003 21:55:11 +0200 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.34,1.35 In-Reply-To: References: Message-ID: fdrake@users.sourceforge.net writes: > + - A new PyArg_Parse*() format code that returns an unsigned C long > + int that receives the lower LONG_BIT bits of the Python > + argument, truncating without range checking. (SF 595026; Thomas > + Heller did this work.) Actually there are two new format codes, the second one receives the lower LONG_LONG_BITS (does this exist, but you get it, I'm sure) in an unsigned long long. From guido@python.org Fri Apr 25 21:06:39 2003 From: guido@python.org (Guido van Rossum) Date: Fri, 25 Apr 2003 16:06:39 -0400 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.34,1.35 In-Reply-To: "Your message of 25 Apr 2003 21:55:11 +0200." References: Message-ID: <200304252006.h3PK6eY26494@pcp02138704pcs.reston01.va.comcast.net> > fdrake@users.sourceforge.net writes: > > > + - A new PyArg_Parse*() format code that returns an unsigned C long > > + int that receives the lower LONG_BIT bits of the Python > > + argument, truncating without range checking. (SF 595026; Thomas > > + Heller did this work.) > > Actually there are two new format codes, the second one receives the > lower LONG_LONG_BITS (does this exist, but you get it, I'm sure) in an > unsigned long long. Please check in a fix to the PEP yourself! --Guido van Rossum (home page: http://www.python.org/~guido/) From theller@users.sourceforge.net Fri Apr 25 21:13:56 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 25 Apr 2003 13:13:56 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.35,1.36 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv25182 Modified Files: pep-0283.txt Log Message: Guido's wish is my command ;-) Document both new format codes. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** pep-0283.txt 25 Apr 2003 19:22:25 -0000 1.35 --- pep-0283.txt 25 Apr 2003 20:13:53 -0000 1.36 *************** *** 145,151 **** Hammond) has been included in beta 1. ! - A new PyArg_Parse*() format code that returns an unsigned C long ! int that receives the lower LONG_BIT bits of the Python ! argument, truncating without range checking. (SF 595026; Thomas Heller did this work.) --- 145,153 ---- Hammond) has been included in beta 1. ! - Two new PyArg_Parse*() format codes, 'k' returns an unsigned C ! long int that receives the lower LONG_BIT bits of the Python ! argument, truncating without range checking. 'K' returns an ! unsigned C long long int that receives the lower LONG_LONG_BIT ! bits, truncating without range checking. (SF 595026; Thomas Heller did this work.) From gvanrossum@users.sourceforge.net Fri Apr 25 22:10:33 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 14:10:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.750,1.750.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv15657 Modified Files: Tag: r23b1-branch NEWS Log Message: Get rid of TBD markers; fix reST error. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.750 retrieving revision 1.750.2.1 diff -C2 -d -r1.750 -r1.750.2.1 *** NEWS 25 Apr 2003 19:19:52 -0000 1.750 --- NEWS 25 Apr 2003 21:10:12 -0000 1.750.2.1 *************** *** 211,216 **** See the module docstring for details. - TBD - Build ----- --- 211,214 ---- *************** *** 230,233 **** --- 228,232 ---- - LONG_LONG was renamed to PY_LONG_LONG. Extensions that use this and need compatibility with previous versions can use this: + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG *************** *** 244,248 **** ------------- ! TBD Tests --- 243,247 ---- ------------- ! None this time. Tests From gvanrossum@users.sourceforge.net Fri Apr 25 22:22:07 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 14:22:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_logging.py,1.6,1.6.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19604 Modified Files: Tag: r23b1-branch test_logging.py Log Message: Add Neal's band-aid for the Solaris problem, even if it doesn't fix it for Skip. Index: test_logging.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** test_logging.py 25 Apr 2003 14:22:00 -0000 1.6 --- test_logging.py 25 Apr 2003 21:22:03 -0000 1.6.2.1 *************** *** 471,474 **** --- 471,476 ---- socketDataProcessed.wait() socketDataProcessed.release() + for thread in threads: + thread.join() banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) From fdrake@users.sourceforge.net Fri Apr 25 23:09:27 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 15:09:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libnetrc.tex,1.8.22.1,1.8.22.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4069 Modified Files: Tag: release22-maint libnetrc.tex Log Message: Markup change; make the notice a little stronger by using the "boxed" version. Index: libnetrc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnetrc.tex,v retrieving revision 1.8.22.1 retrieving revision 1.8.22.2 diff -C2 -d -r1.8.22.1 -r1.8.22.2 *** libnetrc.tex 23 Apr 2003 20:36:18 -0000 1.8.22.1 --- libnetrc.tex 25 Apr 2003 22:09:23 -0000 1.8.22.2 *************** *** 61,68 **** \end{memberdesc} ! \note{Passwords are limited to a subset of the ASCII character set. ! Versions of this module prior to 2.2.3 were extremely limited. Starting ! with 2.2.3, all ASCII punctuation is allowed in passwords. However, note ! that whitespace and non-printable characters are not allowed in passwords. ! This is a limitation of the way the .netrc file is parsed and may be removed ! in the future.} --- 61,71 ---- \end{memberdesc} ! \begin{notice} ! Passwords are limited to a subset of the \ASCII{} character set. ! Versions of this module prior to 2.2.3 were extremely limited. ! Starting with 2.2.3, all \ASCII{} punctuation is allowed in ! passwords. However, note that whitespace and non-printable ! characters are not allowed in passwords. This is a limitation of ! the way the \file{.netrc} file is parsed and may be removed in the ! future. ! \end{notice} From gvanrossum@users.sourceforge.net Sat Apr 26 01:21:33 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 17:21:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_logging.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15379/Lib/test Modified Files: test_logging.py Log Message: Merge back from r23b1-branch Index: test_logging.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_logging.py 25 Apr 2003 14:22:00 -0000 1.6 --- test_logging.py 26 Apr 2003 00:21:31 -0000 1.7 *************** *** 471,474 **** --- 471,476 ---- socketDataProcessed.wait() socketDataProcessed.release() + for thread in threads: + thread.join() banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) From gvanrossum@users.sourceforge.net Sat Apr 26 01:21:33 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 25 Apr 2003 17:21:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.750,1.751 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv15379/Misc Modified Files: NEWS Log Message: Merge back from r23b1-branch Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.750 retrieving revision 1.751 diff -C2 -d -r1.750 -r1.751 *** NEWS 25 Apr 2003 19:19:52 -0000 1.750 --- NEWS 26 Apr 2003 00:21:31 -0000 1.751 *************** *** 211,216 **** See the module docstring for details. - TBD - Build ----- --- 211,214 ---- *************** *** 230,233 **** --- 228,232 ---- - LONG_LONG was renamed to PY_LONG_LONG. Extensions that use this and need compatibility with previous versions can use this: + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG *************** *** 244,248 **** ------------- ! TBD Tests --- 243,247 ---- ------------- ! None this time. Tests From fdrake@users.sourceforge.net Sat Apr 26 01:52:32 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 25 Apr 2003 17:52:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs boilerplate.tex,1.78,1.79 license.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv23518 Modified Files: boilerplate.tex license.tex Log Message: Version updates for Python 2.3. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** boilerplate.tex 24 Apr 2003 16:37:21 -0000 1.78 --- boilerplate.tex 26 Apr 2003 00:52:30 -0000 1.79 *************** *** 8,11 **** \date{\today} % XXX update before final release! \release{2.3} % software release, not documentation ! \setreleaseinfo{b1} % empty for final release \setshortversion{2.3} % major.minor only for software --- 8,11 ---- \date{\today} % XXX update before final release! \release{2.3} % software release, not documentation ! \setreleaseinfo{b1+} % empty for final release \setshortversion{2.3} % major.minor only for software Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/license.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** license.tex 31 Dec 2002 05:51:05 -0000 1.8 --- license.tex 26 Apr 2003 00:52:30 -0000 1.9 *************** *** 25,29 **** GPL-compatible; the table below summarizes the various releases. ! \begin{tablev}{c|c|c|c|c}{textrm}{Release}{Derived from}{Year}{Owner}{GPL compatible?} \linev{0.9.0 thru 1.2}{n/a}{1991-1995}{CWI}{yes} \linev{1.3 thru 1.5.2}{1.2}{1995-1999}{CNRI}{yes} --- 25,30 ---- GPL-compatible; the table below summarizes the various releases. ! \begin{tablev}{c|c|c|c|c}{textrm}% ! {Release}{Derived from}{Year}{Owner}{GPL compatible?} \linev{0.9.0 thru 1.2}{n/a}{1991-1995}{CWI}{yes} \linev{1.3 thru 1.5.2}{1.2}{1995-1999}{CNRI}{yes} *************** *** 38,41 **** --- 39,44 ---- \linev{2.1.3}{2.1.2}{2002}{PSF}{yes} \linev{2.2.1}{2.2}{2002}{PSF}{yes} + \linev{2.2.2}{2.2.1}{2002}{PSF}{yes} + \linev{2.3}{2.2.2}{2002-2003}{PSF}{yes} \end{tablev} *************** *** 52,56 **** \section{Terms and conditions for accessing or otherwise using Python} ! \centerline{\strong{PSF LICENSE AGREEMENT FOR PYTHON 2.3}} \begin{enumerate} --- 55,59 ---- \section{Terms and conditions for accessing or otherwise using Python} ! \centerline{\strong{PSF LICENSE AGREEMENT FOR PYTHON \version}} \begin{enumerate} *************** *** 68,72 **** \version{} alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., ! ``Copyright \copyright{} 2001, 2002 Python Software Foundation; All Rights Reserved'' are retained in Python \version{} alone or in any derivative version prepared by Licensee. --- 71,75 ---- \version{} alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., ! ``Copyright \copyright{} 2001-2003 Python Software Foundation; All Rights Reserved'' are retained in Python \version{} alone or in any derivative version prepared by Licensee. From tim_one@users.sourceforge.net Sat Apr 26 01:53:26 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 25 Apr 2003 17:53:26 -0700 Subject: [Python-checkins] python/dist/src/PCbuild rmpyc.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv23729/python/PCbuild Modified Files: rmpyc.py Log Message: Use os.walk() to find files to delete. Index: rmpyc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/rmpyc.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rmpyc.py 12 Jul 2001 22:36:02 -0000 1.3 --- rmpyc.py 26 Apr 2003 00:53:24 -0000 1.4 *************** *** 1,22 **** # Remove all the .pyc and .pyo files under ../Lib. def deltree(root): import os ! def rm(path): ! os.unlink(path) npyc = npyo = 0 ! dirs = [root] ! while dirs: ! dir = dirs.pop() ! for short in os.listdir(dir): ! full = os.path.join(dir, short) ! if os.path.isdir(full): ! dirs.append(full) ! elif short.endswith(".pyc"): npyc += 1 ! rm(full) ! elif short.endswith(".pyo"): npyo += 1 ! rm(full) return npyc, npyo --- 1,23 ---- # Remove all the .pyc and .pyo files under ../Lib. + def deltree(root): import os ! from os.path import join ! npyc = npyo = 0 ! for root, dirs, files in os.walk(root): ! for name in files: ! delete = False ! if name.endswith('.pyc'): ! delete = True npyc += 1 ! elif name.endswith('.pyo'): ! delete = True npyo += 1 ! ! if delete: ! os.remove(join(root, name)) ! return npyc, npyo From montanaro@users.sourceforge.net Sat Apr 26 03:59:02 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 19:59:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmath.tex,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25390 Modified Files: libmath.tex Log Message: Add note about platform-specific behavior arising from discussion on bug 711019. Index: libmath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmath.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** libmath.tex 17 Dec 2002 01:24:11 -0000 1.28 --- libmath.tex 26 Apr 2003 02:59:00 -0000 1.29 *************** *** 18,22 **** and why it was generated in the first place. ! The following functions provided by this module: \begin{funcdesc}{acos}{x} --- 18,22 ---- and why it was generated in the first place. ! The following functions are provided by this module: \begin{funcdesc}{acos}{x} *************** *** 145,148 **** --- 145,158 ---- The mathematical constant \emph{e}. \end{datadesc} + + \begin{notice} + Specific exceptions raised in assorted error cases (and even whether some + arguments are considered to be exceptional at all) are not defined in any + useful cross-platform or cross-release way. For example, whether + \code{math.log(0)} returns \code{-Inf} or raises \exception{ValueError} or + \exception{OverflowError} is both platform- and release-dependent, and in + cases where \code{math.log(0)} raises an \exception{OverflowError}, + \code{math.log(0L)} often raises a \exception{ValueError}. + \end{notice} \begin{seealso} From montanaro@users.sourceforge.net Sat Apr 26 03:59:48 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 25 Apr 2003 19:59:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmath.tex,1.25,1.25.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25623 Modified Files: Tag: release22-maint libmath.tex Log Message: backport of note arising from bug 711019. Index: libmath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmath.tex,v retrieving revision 1.25 retrieving revision 1.25.22.1 diff -C2 -d -r1.25 -r1.25.22.1 *** libmath.tex 18 Dec 2000 13:50:24 -0000 1.25 --- libmath.tex 26 Apr 2003 02:59:46 -0000 1.25.22.1 *************** *** 18,22 **** and why it was generated in the first place. ! The following functions provided by this module: \begin{funcdesc}{acos}{x} --- 18,22 ---- and why it was generated in the first place. ! The following functions are provided by this module: \begin{funcdesc}{acos}{x} *************** *** 135,138 **** --- 135,148 ---- The mathematical constant \emph{e}. \end{datadesc} + + \begin{notice} + Specific exceptions raised in assorted error cases (and even whether some + arguments are considered to be exceptional at all) are not defined in any + useful cross-platform or cross-release way. For example, whether + \code{math.log(0)} returns \code{-Inf} or raises \exception{ValueError} or + \exception{OverflowError} is both platform- and release-dependent, and in + cases where \code{math.log(0)} raises an \exception{OverflowError}, + \code{math.log(0L)} often raises a \exception{ValueError}. + \end{notice} \begin{seealso} From tim_one@users.sourceforge.net Sat Apr 26 15:31:28 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 26 Apr 2003 07:31:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imp.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23267/python/Lib/test Modified Files: test_imp.py Log Message: Rewrote. As reported on c.l.py, when the test suite is run via "import test.autotest", temp_imp failed because the import lock was still held at the test's end (the test assumed it wouldn't be), and then a RuntimeError got raised at the end of the entire suite run because test_imp cleared the import lock as a side effect of trying to test that the import lock wasn't held (but a legitimate import is in progress, so the lock should be held, and the import machinery complained when it found that the lock was unexpectedly cleareed). Also removed the unittest scaffolding. It didn't buy anything here, and the test was raising regrtest's TestFailed instead of using the unittest failure-reporting mechanisms. Index: test_imp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imp.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_imp.py 17 Feb 2003 22:38:56 -0000 1.3 --- test_imp.py 26 Apr 2003 14:31:24 -0000 1.4 *************** *** 1,28 **** - import imp ! import unittest ! from test.test_support import TestFailed, run_unittest ! class ImpLock(unittest.TestCase): ! # XXX this test is woefully inadequate, please fix me ! def testLock(self): ! LOOPS = 50 ! for i in range(LOOPS): ! imp.acquire_lock() ! for i in range(LOOPS): ! imp.release_lock() ! for i in range(LOOPS): ! try: ! imp.release_lock() ! except RuntimeError: ! pass ! else: ! raise TestFailed, \ ! "release_lock() without lock should raise RuntimeError" def test_main(): ! run_unittest(ImpLock) if __name__ == "__main__": --- 1,38 ---- import imp ! from test.test_support import TestFailed ! def verify_lock_state(expected): ! if imp.lock_held() != expected: ! raise TestFailed("expected imp.lock_held() to be %r" % expected) ! def testLock(): ! LOOPS = 50 ! # The import lock may already be held, e.g. if the test suite is run ! # via "import test.autotest". ! lock_held_at_start = imp.lock_held() ! verify_lock_state(lock_held_at_start) ! ! for i in range(LOOPS): ! imp.acquire_lock() ! verify_lock_state(True) ! ! for i in range(LOOPS): ! imp.release_lock() ! ! # The original state should be restored now. ! verify_lock_state(lock_held_at_start) ! ! if not lock_held_at_start: ! try: ! imp.release_lock() ! except RuntimeError: ! pass ! else: ! raise TestFailed("release_lock() without lock should raise " ! "RuntimeError") def test_main(): ! testLock() if __name__ == "__main__": From tim_one@users.sourceforge.net Sat Apr 26 15:53:04 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 26 Apr 2003 07:53:04 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.751,1.752 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv873/python/Misc Modified Files: NEWS Log Message: A start on news for 2.3b2. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.751 retrieving revision 1.752 diff -C2 -d -r1.751 -r1.752 *** NEWS 26 Apr 2003 00:21:31 -0000 1.751 --- NEWS 26 Apr 2003 14:53:01 -0000 1.752 *************** *** 5,8 **** --- 5,49 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) + What's New in Python 2.3 beta 2? + ================================ + + *Release date: XX-XXX-2003* + + Core and builtins + ----------------- + + Extension modules + ----------------- + + Library + ------- + + Tools/Demos + ----------- + + Build + ----- + + C API + ----- + + New platforms + ------------- + + None this time. + + Tests + ----- + + - test_imp rewritten so that it doesn't raise RuntimeError if run as a + side effect of being imported ("import test.autotest"). + + Windows + ------- + + Mac + --- + + What's New in Python 2.3 beta 1? ================================ From tim_one@users.sourceforge.net Sat Apr 26 16:11:11 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 26 Apr 2003 08:11:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmath.tex,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7219/python/Doc/lib Modified Files: libmath.tex Log Message: Clarified new text about math exceptions. Bugfix candidate. Index: libmath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmath.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** libmath.tex 26 Apr 2003 02:59:00 -0000 1.29 --- libmath.tex 26 Apr 2003 15:11:08 -0000 1.30 *************** *** 147,157 **** \begin{notice} ! Specific exceptions raised in assorted error cases (and even whether some arguments are considered to be exceptional at all) are not defined in any useful cross-platform or cross-release way. For example, whether \code{math.log(0)} returns \code{-Inf} or raises \exception{ValueError} or ! \exception{OverflowError} is both platform- and release-dependent, and in ! cases where \code{math.log(0)} raises an \exception{OverflowError}, ! \code{math.log(0L)} often raises a \exception{ValueError}. \end{notice} --- 147,162 ---- \begin{notice} ! The \module{math} module consists mostly of thin wrappers around ! the platform C math library functions. Behavior in exceptional cases is ! loosely specified by the C standards, and Python inherits much of its ! math-function error-reporting behavior from the platform C ! implementation. As a result, ! the specific exceptions raised in error cases (and even whether some arguments are considered to be exceptional at all) are not defined in any useful cross-platform or cross-release way. For example, whether \code{math.log(0)} returns \code{-Inf} or raises \exception{ValueError} or ! \exception{OverflowError} isn't defined, and in ! cases where \code{math.log(0)} raises \exception{OverflowError}, ! \code{math.log(0L)} may raise \exception{ValueError} instead. \end{notice} From bwarsaw@users.sourceforge.net Sun Apr 27 05:00:10 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 26 Apr 2003 21:00:10 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.73.4.15,1.73.4.16 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv20221 Modified Files: Tag: release22-maint setup.py Log Message: detect_modules(): On Redhat 9, building the ssl stuff eventually includes krb5.h. Copy the krb5_h stanza from Python 2.3's setup.py which seems to fix the problem. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.15 retrieving revision 1.73.4.16 diff -C2 -d -r1.73.4.15 -r1.73.4.16 *** setup.py 21 Feb 2003 12:18:17 -0000 1.73.4.15 --- setup.py 27 Apr 2003 04:00:01 -0000 1.73.4.16 *************** *** 373,378 **** ] ) ! if (ssl_incs is not None and ! ssl_libs is not None): rtlibs = None if platform.startswith('sunos'): --- 373,382 ---- ] ) ! krb5_h = find_file('krb5.h', inc_dirs, ! ['/usr/kerberos/include']) ! if krb5_h: ! ssl_incs += krb5_h ! ! if ssl_incs is not None and ssl_libs is not None: rtlibs = None if platform.startswith('sunos'): From niemeyer@users.sourceforge.net Sun Apr 27 07:25:26 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 26 Apr 2003 23:25:26 -0700 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29438/Modules Modified Files: bz2module.c Log Message: Applying patch by Neal Norwitz: [#727759] get bzip2 to build on Solaris 8 (old bzip library) Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** bz2module.c 29 Mar 2003 10:04:54 -0000 1.16 --- bz2module.c 27 Apr 2003 06:25:24 -0000 1.17 *************** *** 32,35 **** --- 32,38 ---- #define BZ2FileObject_Check(v) ((v)->ob_type == &BZ2File_Type) + + #ifdef BZ_CONFIG_ERROR + #if SIZEOF_LONG >= 8 #define BZS_TOTAL_OUT(bzs) \ *************** *** 43,46 **** --- 46,69 ---- #endif + #else /* ! BZ_CONFIG_ERROR */ + + #define BZ2_bzRead bzRead + #define BZ2_bzReadOpen bzReadOpen + #define BZ2_bzReadClose bzReadClose + #define BZ2_bzWrite bzWrite + #define BZ2_bzWriteOpen bzWriteOpen + #define BZ2_bzWriteClose bzWriteClose + #define BZ2_bzCompress bzCompress + #define BZ2_bzCompressInit bzCompressInit + #define BZ2_bzCompressEnd bzCompressEnd + #define BZ2_bzDecompress bzDecompress + #define BZ2_bzDecompressInit bzDecompressInit + #define BZ2_bzDecompressEnd bzDecompressEnd + + #define BZS_TOTAL_OUT(bzs) bzs->total_out + + #endif /* ! BZ_CONFIG_ERROR */ + + #ifdef WITH_THREAD #define ACQUIRE_LOCK(obj) PyThread_acquire_lock(obj->lock, 1) *************** *** 118,121 **** --- 141,145 ---- break; + #ifdef BZ_CONFIG_ERROR case BZ_CONFIG_ERROR: PyErr_SetString(PyExc_SystemError, *************** *** 124,127 **** --- 148,152 ---- ret = 1; break; + #endif case BZ_PARAM_ERROR: From niemeyer@users.sourceforge.net Sun Apr 27 07:58:56 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 26 Apr 2003 23:58:56 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14584/Modules Modified Files: _sre.c Log Message: Applying patch #726869 by Andrew I MacIntyre, reducing in _sre.c the recursion limit for certain setups of FreeBSD and OS/2. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -d -r2.92 -r2.93 *** _sre.c 22 Apr 2003 15:39:09 -0000 2.92 --- _sre.c 27 Apr 2003 06:58:54 -0000 2.93 *************** *** 73,77 **** --- 73,86 ---- #define USE_RECURSION_LIMIT 7500 #else + #if defined(__GNUC__) && (__GNUC__ > 2) && \ + (defined(__FreeBSD__) || defined(PYOS_OS2)) + /* gcc 3.x, on FreeBSD and OS/2+EMX and at optimisation levels of + * -O3 (autoconf default) and -O2 (EMX port default), generates code + * for _sre that fails for the default recursion limit. + */ + #define USE_RECURSION_LIMIT 7500 + #else #define USE_RECURSION_LIMIT 10000 + #endif #endif #endif From rhettinger@users.sourceforge.net Sun Apr 27 08:54:26 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 27 Apr 2003 00:54:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bisect.py,1.7,1.8 test_bool.py,1.9,1.10 test_os.py,1.15,1.16 test_support.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17451 Modified Files: test_bisect.py test_bool.py test_os.py test_support.py Log Message: Factor out common boilerplate for test_support Index: test_bisect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bisect.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_bisect.py 19 Feb 2003 02:35:05 -0000 1.7 --- test_bisect.py 27 Apr 2003 07:54:23 -0000 1.8 *************** *** 193,206 **** """ - #============================================================================== - - def makeAllTests(): - suite = unittest.TestSuite() - for klass in (TestBisect, - TestInsort - ): - suite.addTest(unittest.makeSuite(klass)) - return suite - #------------------------------------------------------------------------------ --- 193,196 ---- *************** *** 209,214 **** def test_main(verbose=None): from test import test_bisect ! suite = makeAllTests() ! test_support.run_suite(suite) test_support.run_doctest(test_bisect, verbose) --- 199,204 ---- def test_main(verbose=None): from test import test_bisect ! test_support.run_classtests(TestBisect, ! TestInsort) test_support.run_doctest(test_bisect, verbose) Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_bool.py 25 Apr 2003 10:22:01 -0000 1.9 --- test_bool.py 27 Apr 2003 07:54:23 -0000 1.10 *************** *** 332,338 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(BoolTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 332,336 ---- def test_main(): ! test_support.run_classtests(BoolTest) if __name__ == "__main__": Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_os.py 25 Apr 2003 07:11:48 -0000 1.15 --- test_os.py 27 Apr 2003 07:54:23 -0000 1.16 *************** *** 10,14 **** warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) ! from test.test_support import TESTFN, run_suite class TemporaryFileTests(unittest.TestCase): --- 10,14 ---- warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) ! from test.test_support import TESTFN, run_classtests class TemporaryFileTests(unittest.TestCase): *************** *** 283,294 **** def test_main(): ! suite = unittest.TestSuite() ! for cls in (TemporaryFileTests, ! StatAttributeTests, ! EnvironTests, ! WalkTests, ! ): ! suite.addTest(unittest.makeSuite(cls)) ! run_suite(suite) if __name__ == "__main__": --- 283,290 ---- def test_main(): ! run_classtests(TemporaryFileTests, ! StatAttributeTests, ! EnvironTests, ! WalkTests) if __name__ == "__main__": Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** test_support.py 24 Apr 2003 19:06:57 -0000 1.50 --- test_support.py 27 Apr 2003 07:54:23 -0000 1.51 *************** *** 234,237 **** --- 234,243 ---- run_suite(unittest.makeSuite(testclass), testclass) + def run_classtests(*classnames): + suite = unittest.TestSuite() + for cls in classnames: + suite.addTest(unittest.makeSuite(cls)) + run_suite(suite) + #======================================================================= From niemeyer@users.sourceforge.net Sun Apr 27 13:34:16 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 27 Apr 2003 05:34:16 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.93,2.94 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31416/Modules Modified Files: _sre.c Log Message: Applied patch #725106, by Greg Chapman, fixing capturing groups within repeats of alternatives. The only change to the original patch was to convert the tests to the new test_re.py file. This patch fixes cases like: >>> re.match('((a)|b)*', 'abc').groups() ('b', '') Which is wrong (it's impossible to match the empty string), and incompatible with other regex systems, like the following examples show: % perl -e '"abc" =~ /^((a)|b)*/; print "$1 $2\n";' b a % echo "abc" | sed -r -e "s/^((a)|b)*/\1 \2|/" b a|c Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -d -r2.93 -r2.94 *** _sre.c 27 Apr 2003 06:58:54 -0000 2.93 --- _sre.c 27 Apr 2003 12:34:14 -0000 2.94 *************** *** 948,955 **** --- 948,965 ---- (ptr >= end || !SRE_CHARSET(pattern + 3, (SRE_CODE) *ptr))) continue; + if (state->repeat) { + i = mark_save(state, 0, lastmark); + if (i < 0) + return i; + } state->ptr = ptr; i = SRE_MATCH(state, pattern + 1, level + 1); if (i) return i; + if (state->repeat) { + i = mark_restore(state, 0, lastmark); + if (i < 0) + return i; + } LASTMARK_RESTORE(); } From niemeyer@users.sourceforge.net Sun Apr 27 13:34:16 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 27 Apr 2003 05:34:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31416/Lib/test Modified Files: test_re.py Log Message: Applied patch #725106, by Greg Chapman, fixing capturing groups within repeats of alternatives. The only change to the original patch was to convert the tests to the new test_re.py file. This patch fixes cases like: >>> re.match('((a)|b)*', 'abc').groups() ('b', '') Which is wrong (it's impossible to match the empty string), and incompatible with other regex systems, like the following examples show: % perl -e '"abc" =~ /^((a)|b)*/; print "$1 $2\n";' b a % echo "abc" | sed -r -e "s/^((a)|b)*/\1 \2|/" b a|c Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_re.py 25 Apr 2003 16:00:14 -0000 1.39 --- test_re.py 27 Apr 2003 12:34:14 -0000 1.40 *************** *** 277,280 **** --- 277,299 ---- ('a:', 'a')) + def test_bug_725106(self): + # capturing groups in alternatives in repeats + self.assertEqual(re.match('^((a)|b)*', 'abc').groups(), + ('b', 'a')) + self.assertEqual(re.match('^(([ab])|c)*', 'abc').groups(), + ('c', 'b')) + self.assertEqual(re.match('^((d)|[ab])*', 'abc').groups(), + ('b', None)) + self.assertEqual(re.match('^((a)c|[ab])*', 'abc').groups(), + ('b', None)) + self.assertEqual(re.match('^((a)|b)*?c', 'abc').groups(), + ('b', 'a')) + self.assertEqual(re.match('^(([ab])|c)*?d', 'abcd').groups(), + ('c', 'b')) + self.assertEqual(re.match('^((d)|[ab])*?c', 'abc').groups(), + ('b', None)) + self.assertEqual(re.match('^((a)c|[ab])*?c', 'abc').groups(), + ('b', None)) + def test_finditer(self): iter = re.finditer(r":+", "a:b::c:::d") From niemeyer@users.sourceforge.net Sun Apr 27 14:25:23 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 27 Apr 2003 06:25:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24491/Lib/test Modified Files: test_re.py Log Message: Fix for part of the problem mentioned in #725149 by Greg Chapman. This problem is related to a wrong behavior from mark_save/restore(), which don't restore the mark_stack_base before restoring the marks. Greg's suggestion was to change the asserts, which happen to be the only recursive ops that can continue the loop, but the problem would happen to any operation with the same behavior. So, rather than hardcoding this into asserts, I have changed mark_save/restore() to always restore the stackbase before restoring the marks. Both solutions should fix these two cases, presented by Greg: >>> re.match('(a)(?:(?=(b)*)c)*', 'abb').groups() ('b', None) >>> re.match('(a)((?!(b)*))*', 'abb').groups() ('b', None, None) The rest of the bug and patch in #725149 must be discussed further. Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_re.py 27 Apr 2003 12:34:14 -0000 1.40 --- test_re.py 27 Apr 2003 13:25:20 -0000 1.41 *************** *** 296,299 **** --- 296,306 ---- ('b', None)) + def test_bug_725149(self): + # mark_stack_base restoring before restoring marks + self.assertEqual(re.match('(a)(?:(?=(b)*)c)*', 'abb').groups(), + ('a', None)) + self.assertEqual(re.match('(a)((?!(b)*))*', 'abb').groups(), + ('a', None, None)) + def test_finditer(self): iter = re.finditer(r":+", "a:b::c:::d") From niemeyer@users.sourceforge.net Sun Apr 27 14:25:24 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 27 Apr 2003 06:25:24 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.94,2.95 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24491/Modules Modified Files: _sre.c Log Message: Fix for part of the problem mentioned in #725149 by Greg Chapman. This problem is related to a wrong behavior from mark_save/restore(), which don't restore the mark_stack_base before restoring the marks. Greg's suggestion was to change the asserts, which happen to be the only recursive ops that can continue the loop, but the problem would happen to any operation with the same behavior. So, rather than hardcoding this into asserts, I have changed mark_save/restore() to always restore the stackbase before restoring the marks. Both solutions should fix these two cases, presented by Greg: >>> re.match('(a)(?:(?=(b)*)c)*', 'abb').groups() ('b', None) >>> re.match('(a)((?!(b)*))*', 'abb').groups() ('b', None, None) The rest of the bug and patch in #725149 must be discussed further. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.94 retrieving revision 2.95 diff -C2 -d -r2.94 -r2.95 *** _sre.c 27 Apr 2003 12:34:14 -0000 2.94 --- _sre.c 27 Apr 2003 13:25:21 -0000 2.95 *************** *** 280,284 **** static int ! mark_save(SRE_STATE* state, int lo, int hi) { void* stack; --- 280,284 ---- static int ! mark_save(SRE_STATE* state, int lo, int hi, int *mark_stack_base) { void* stack; *************** *** 324,332 **** state->mark_stack_base += size; return 0; } static int ! mark_restore(SRE_STATE* state, int lo, int hi) { int size; --- 324,334 ---- state->mark_stack_base += size; + *mark_stack_base = state->mark_stack_base; + return 0; } static int ! mark_restore(SRE_STATE* state, int lo, int hi, int *mark_stack_base) { int size; *************** *** 337,341 **** size = (hi - lo) + 1; ! state->mark_stack_base -= size; TRACE(("copy %d:%d from %d\n", lo, hi, state->mark_stack_base)); --- 339,343 ---- size = (hi - lo) + 1; ! state->mark_stack_base = *mark_stack_base - size; TRACE(("copy %d:%d from %d\n", lo, hi, state->mark_stack_base)); *************** *** 713,717 **** int i, count; SRE_REPEAT* rp; ! int lastmark, lastindex; SRE_CODE chr; --- 715,719 ---- int i, count; SRE_REPEAT* rp; ! int lastmark, lastindex, mark_stack_base; SRE_CODE chr; *************** *** 949,953 **** continue; if (state->repeat) { ! i = mark_save(state, 0, lastmark); if (i < 0) return i; --- 951,955 ---- continue; if (state->repeat) { ! i = mark_save(state, 0, lastmark, &mark_stack_base); if (i < 0) return i; *************** *** 958,962 **** return i; if (state->repeat) { ! i = mark_restore(state, 0, lastmark); if (i < 0) return i; --- 960,964 ---- return i; if (state->repeat) { ! i = mark_restore(state, 0, lastmark, &mark_stack_base); if (i < 0) return i; *************** *** 1158,1162 **** match another item, do so */ rp->count = count; ! i = mark_save(state, 0, lastmark); if (i < 0) return i; --- 1160,1164 ---- match another item, do so */ rp->count = count; ! i = mark_save(state, 0, lastmark, &mark_stack_base); if (i < 0) return i; *************** *** 1165,1169 **** if (i) return i; ! i = mark_restore(state, 0, lastmark); LASTMARK_RESTORE(); if (i < 0) --- 1167,1171 ---- if (i) return i; ! i = mark_restore(state, 0, lastmark, &mark_stack_base); LASTMARK_RESTORE(); if (i < 0) From goodger@users.sourceforge.net Sun Apr 27 14:48:42 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 27 Apr 2003 06:48:42 -0700 Subject: [Python-checkins] python/nondist/peps pep-0301.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv14545 Modified Files: pep-0301.txt Log Message: update from Richard Jones Index: pep-0301.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0301.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0301.txt 20 Nov 2002 22:10:24 -0000 1.5 --- pep-0301.txt 27 Apr 2003 13:48:39 -0000 1.6 *************** *** 109,114 **** new submitted information. ! There will also be a submit/edit form that will allow manual submission ! and updating for those who do not use Distutils. **submit_pkg_info** --- 109,114 ---- new submitted information. ! There will also be a submit/edit form that will allow manual ! submission and updating for those who do not use Distutils. **submit_pkg_info** *************** *** 117,123 **** **user** ! Registers a new user with the index. Requires username, password and ! email address. Passwords will be stored in the index database as SHA ! hashes. If the username already exists in the database: 1. If valid HTTP Basic authentication is provided, the password and --- 117,123 ---- **user** ! Registers a new user with the index. Requires username, password ! and email address. Passwords will be stored in the index database ! as SHA hashes. If the username already exists in the database: 1. If valid HTTP Basic authentication is provided, the password and *************** *** 196,202 **** **release_discriminators** ! Each entry maps a package (*name*, *version*) to a *discriminator_id*. ! We map to releases instead of packages because the set of ! discriminators may change between releases. **journals** --- 196,202 ---- **release_discriminators** ! Each entry maps a package (*name*, *version*) to a ! *discriminator_id*. We map to releases instead of packages because ! the set of discriminators may change between releases. **journals** *************** *** 234,239 **** Notification of changes to a package entry will be sent to all users ! who have submitted information about the package. That is, the original ! submitter and any subsequent updaters. The *register* command will include a ``--verify`` option which --- 234,239 ---- Notification of changes to a package entry will be sent to all users ! who have submitted information about the package. That is, the ! original submitter and any subsequent updaters. The *register* command will include a ``--verify`` option which *************** *** 289,293 **** from FreshMeat and SourceForge (with their permission). This list will be made available both through the web interface and through the ! *regsiter* command's ``--list-classifiers`` option as a text list which may then be copied to the ``setup.py`` file. The *register* command's ``--verify`` option will check classifiers values against --- 289,293 ---- from FreshMeat and SourceForge (with their permission). This list will be made available both through the web interface and through the ! *register* command's ``--list-classifiers`` option as a text list which may then be copied to the ``setup.py`` file. The *register* command's ``--verify`` option will check classifiers values against *************** *** 296,300 **** Unfortunately, the addition of the "classifiers" property is not backwards-compatible. A setup.py file using it will not work under ! Python 2.1.3. It is hoped that a bugfix release of Python 2.2 (most likely 2.2.3) will relax the argument checking of the setup() command to allow new keywords, even if they're not actually used. It is --- 296,300 ---- Unfortunately, the addition of the "classifiers" property is not backwards-compatible. A setup.py file using it will not work under ! Python 2.1.3. It is hoped that a bug-fix release of Python 2.2 (most likely 2.2.3) will relax the argument checking of the setup() command to allow new keywords, even if they're not actually used. It is *************** *** 317,349 **** ! Reference Implementation ! ======================== ! ! Reference code is available from the SourceForge project: ! ! http://sourceforge.net/projects/pypi/ ! A demonstration will be available at: ! http://www.amk.ca/cgi-bin/pypi.cgi ! ===== ============================================================= ! Done Feature ! ===== ============================================================= ! Y Submission via *register* command (register.py module) ! Y Web interface ! Y Handling of the *classifiers* setup() keyword (dist.py.patch) ! Y Patch Python 2.2.3 to relax keyword argument checks in the ! distutils setup() function ! N Patch Python 2.3 to apply the dist.py.patch ! N Library reference documentation of the *register* command and ! additional *classifiers* keyword ! ===== ============================================================= ! In the two days of the 22nd and 23rd October 2002, after the first ! announcement to the Catalog-SIG (22nd) and Distutils-SIG (23rd), the ! initial prototype had 45 visitors (not including myself), two of whom ! used the *register* command to submit package information. --- 317,332 ---- ! Implementation ! ============== ! The server is be available at: ! http://www.python.org/pypi ! The code is available from the SourceForge project: ! http://sourceforge.net/projects/pypi/ + The *register* command has been integrated into Python 2.3. *************** *** 361,365 **** in the case of a success. ! However, it has been pointed out [8]_ that this is a bad scheme to use. --- 344,349 ---- in the case of a success. ! However, it has been pointed out [8]_ that this is a bad scheme to ! use. From niemeyer@users.sourceforge.net Sun Apr 27 15:42:58 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 27 Apr 2003 07:42:58 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.95,2.96 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv15677/Modules Modified Files: _sre.c Log Message: - Included detailed documentation in _sre.c explaining how, when, and why to use LASTMARK_SAVE()/LASTMARK_RESTORE(), based on the discussion in patch #712900. - Cleaned up LASTMARK_SAVE()/LASTMARK_RESTORE() usage, based on the established rules. - Moved the upper part of the just commited patch (relative to bug #725106) to outside the for() loop of BRANCH OP. There's no need to mark_save() in every loop iteration. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.95 retrieving revision 2.96 diff -C2 -d -r2.95 -r2.96 *** _sre.c 27 Apr 2003 13:25:21 -0000 2.95 --- _sre.c 27 Apr 2003 14:42:54 -0000 2.96 *************** *** 689,693 **** #endif ! /* macros to preserve lastmark in case of backtracking */ #define LASTMARK_SAVE() \ do { \ --- 689,720 ---- #endif ! /* The macros below should be used to protect recursive SRE_MATCH() ! * calls that *failed* and do *not* return immediately (IOW, those ! * that will backtrack). Explaining: ! * ! * - Recursive SRE_MATCH() returned true: that's usually a success ! * (besides atypical cases like ASSERT_NOT), therefore there's no ! * reason to restore lastmark; ! * ! * - Recursive SRE_MATCH() returned false but the current SRE_MATCH() ! * is returning to the caller: If the current SRE_MATCH() is the ! * top function of the recursion, returning false will be a matching ! * failure, and it doesn't matter where lastmark is pointing to. ! * If it's *not* the top function, it will be a recursive SRE_MATCH() ! * failure by itself, and the calling SRE_MATCH() will have to deal ! * with the failure by the same rules explained here (it will restore ! * lastmark by itself if necessary); ! * ! * - Recursive SRE_MATCH() returned false, and will continue the ! * outside 'for' loop: must be protected when breaking, since the next ! * OP could potentially depend on lastmark; ! * ! * - Recursive SRE_MATCH() returned false, and will be called again ! * inside a local for/while loop: must be protected between each ! * loop iteration, since the recursive SRE_MATCH() could do anything, ! * and could potentially depend on lastmark. ! * ! * For more information, check the discussion at SF patch #712900. ! */ #define LASTMARK_SAVE() \ do { \ *************** *** 943,946 **** --- 970,978 ---- TRACE(("|%p|%p|BRANCH\n", pattern, ptr)); LASTMARK_SAVE(); + if (state->repeat) { + i = mark_save(state, 0, lastmark, &mark_stack_base); + if (i < 0) + return i; + } for (; pattern[0]; pattern += pattern[0]) { if (pattern[1] == SRE_OP_LITERAL && *************** *** 950,958 **** (ptr >= end || !SRE_CHARSET(pattern + 3, (SRE_CODE) *ptr))) continue; - if (state->repeat) { - i = mark_save(state, 0, lastmark, &mark_stack_base); - if (i < 0) - return i; - } state->ptr = ptr; i = SRE_MATCH(state, pattern + 1, level + 1); --- 982,985 ---- *************** *** 1093,1097 **** if (c < 0) return c; - LASTMARK_RESTORE(); if (c == 0) break; --- 1120,1123 ---- *************** *** 1099,1102 **** --- 1125,1129 ---- ptr++; count++; + LASTMARK_RESTORE(); } } *************** *** 1141,1146 **** TRACE(("|%p|%p|MAX_UNTIL %d\n", pattern, ptr, count)); - LASTMARK_SAVE(); - if (count < rp->pattern[1]) { /* not enough matches */ --- 1168,1171 ---- *************** *** 1152,1156 **** rp->count = count - 1; state->ptr = ptr; - LASTMARK_RESTORE(); return 0; } --- 1177,1180 ---- *************** *** 1160,1163 **** --- 1184,1188 ---- match another item, do so */ rp->count = count; + LASTMARK_SAVE(); i = mark_save(state, 0, lastmark, &mark_stack_base); if (i < 0) *************** *** 1168,1174 **** return i; i = mark_restore(state, 0, lastmark, &mark_stack_base); - LASTMARK_RESTORE(); if (i < 0) return i; rp->count = count - 1; state->ptr = ptr; --- 1193,1199 ---- return i; i = mark_restore(state, 0, lastmark, &mark_stack_base); if (i < 0) return i; + LASTMARK_RESTORE(); rp->count = count - 1; state->ptr = ptr; *************** *** 1183,1187 **** state->repeat = rp; state->ptr = ptr; - LASTMARK_RESTORE(); return 0; --- 1208,1211 ---- *************** *** 1201,1206 **** rp->pattern)); - LASTMARK_SAVE(); - if (count < rp->pattern[1]) { /* not enough matches */ --- 1225,1228 ---- *************** *** 1212,1219 **** rp->count = count-1; state->ptr = ptr; - LASTMARK_RESTORE(); return 0; } /* see if the tail matches */ state->repeat = rp->prev; --- 1234,1242 ---- rp->count = count-1; state->ptr = ptr; return 0; } + LASTMARK_SAVE(); + /* see if the tail matches */ state->repeat = rp->prev; *************** *** 1225,1232 **** state->repeat = rp; - LASTMARK_RESTORE(); if (count >= rp->pattern[2] && rp->pattern[2] != 65535) return 0; rp->count = count; /* RECURSIVE */ --- 1248,1256 ---- state->repeat = rp; if (count >= rp->pattern[2] && rp->pattern[2] != 65535) return 0; + LASTMARK_RESTORE(); + rp->count = count; /* RECURSIVE */ *************** *** 1236,1240 **** rp->count = count - 1; state->ptr = ptr; ! LASTMARK_RESTORE(); return 0; --- 1260,1264 ---- rp->count = count - 1; state->ptr = ptr; ! return 0; From bcannon@users.sourceforge.net Sun Apr 27 20:42:43 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun, 27 Apr 2003 12:42:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gettext.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13786/Lib/test Modified Files: test_gettext.py Log Message: Make tests clean up after themselves better. This means: * call tearDown when Setup is called * shutil.rmtree the root of the created directory instead of just the leaf directory * set the LANGUAGE environment variable to what it was originally and not assume 'en'. Index: test_gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gettext.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_gettext.py 24 Apr 2003 18:08:13 -0000 1.14 --- test_gettext.py 27 Apr 2003 19:42:41 -0000 1.15 *************** *** 47,50 **** --- 47,54 ---- MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo') + try: + LANG = os.environ['LANGUAGE'] + except: + LANG = 'en' *************** *** 61,66 **** def tearDown(self): ! os.environ['LANGUAGE'] = 'en' ! shutil.rmtree(LOCALEDIR) --- 65,70 ---- def tearDown(self): ! os.environ['LANGUAGE'] = LANG ! shutil.rmtree(os.path.split(LOCALEDIR)[0]) *************** *** 72,75 **** --- 76,82 ---- gettext.install('gettext', self.localedir) + def tearDown(self): + GettextBaseTest.tearDown(self) + def test_some_translations(self): eq = self.assertEqual *************** *** 138,141 **** --- 145,151 ---- self._ = gettext.gettext + def tearDown(self): + GettextBaseTest.tearDown(self) + def test_bindtextdomain(self): self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir) *************** *** 192,195 **** --- 202,208 ---- self.mofile = MOFILE + def tearDown(self): + GettextBaseTest.tearDown(self) + def test_plural_forms1(self): eq = self.assertEqual *************** *** 279,282 **** --- 292,298 ---- fp.close() self._ = self.t.ugettext + + def tearDown(self): + GettextBaseTest.tearDown(self) def test_unicode_msgid(self): From doerwalter@users.sourceforge.net Sun Apr 27 23:40:01 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sun, 27 Apr 2003 15:40:01 -0700 Subject: [Python-checkins] python/nondist/peps pep-0293.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv12483 Modified Files: pep-0293.txt Log Message: Fix typos. Index: pep-0293.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0293.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0293.txt 31 Jan 2003 17:19:09 -0000 1.7 --- pep-0293.txt 27 Apr 2003 22:39:58 -0000 1.8 *************** *** 388,394 **** The semantics of unicode.encode with errors="replace" has changed: The old version always stored a ? character in the output string ! even if no character was mapped to ? in the mapping. With the ! proposed patch, the replacement string from the callback callback ! will again be looked up in the mapping dictionary. But as all supported encodings are ASCII based, and thus map ? to ?, this should not be a problem in practice. --- 388,394 ---- The semantics of unicode.encode with errors="replace" has changed: The old version always stored a ? character in the output string ! even if no character was mapped to ? in the mapping. With the ! proposed patch, the replacement string from the callback will ! again be looked up in the mapping dictionary. But as all supported encodings are ASCII based, and thus map ? to ?, this should not be a problem in practice. From tim_one@users.sourceforge.net Mon Apr 28 03:09:47 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 27 Apr 2003 19:09:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16604/python/Doc/lib Modified Files: libos.tex Log Message: walk() docs: Worked "walking" into the description and the text. Added a brief example where bottom-up walking is essential. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** libos.tex 25 Apr 2003 14:50:06 -0000 1.120 --- libos.tex 28 Apr 2003 02:09:43 -0000 1.121 *************** *** 1054,1058 **** \index{directory!walking} \index{directory!traversal} ! \function{walk()} generates the file names in a directory tree. For each directory in the tree rooted at directory \var{top} (including \var{top} itself), it yields a 3-tuple --- 1054,1059 ---- \index{directory!walking} \index{directory!traversal} ! \function{walk()} generates the file names in a directory tree, by ! walking the tree either top down or bottom up. For each directory in the tree rooted at directory \var{top} (including \var{top} itself), it yields a 3-tuple *************** *** 1113,1116 **** --- 1114,1133 ---- dirs.remove('CVS') # don't visit CVS directories \end{verbatim} + + In the next example, walking the tree bottom up is essential: + \function{rmdir()} doesn't allow deleting a directory before the + directory is empty: + + \begin{verbatim} + import os + from os.path import join + # Delete everything reachable from the directory named in 'top'. + for root, dirs, files in os.walk(top, topdown=False): + for name in files: + os.remove(join(root, name)) + for name in dirs: + os.rmdir(join(root, name)) + \end{verbatim} + \versionadded{2.3} \end{funcdesc} From tim_one@users.sourceforge.net Mon Apr 28 04:13:05 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 27 Apr 2003 20:13:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2879/python/Doc/lib Modified Files: libos.tex Log Message: SF bug 728097: tmpnam problems on windows 2.3b, breaks test.test_os. tmpnam() appears essentially useless on Windows, and it finally broke the test for Irmen de Jong. Read the long new comment in test_tmpnam() for details. Since the MS implementation is insane, it might be good if we supplied a different implementation. Bugfix candidate. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** libos.tex 28 Apr 2003 02:09:43 -0000 1.121 --- libos.tex 28 Apr 2003 03:13:02 -0000 1.122 *************** *** 1026,1030 **** \warning{Use of \function{tmpnam()} is vulnerable to symlink attacks; consider using \function{tmpfile()} instead.} ! Availability: \UNIX, Windows. \end{funcdesc} --- 1026,1034 ---- \warning{Use of \function{tmpnam()} is vulnerable to symlink attacks; consider using \function{tmpfile()} instead.} ! Availability: \UNIX, Windows. This function probably shouldn't be used ! on Windows, though: Microsoft's implementation of \function{tmpnam()} ! always creates a name in the root directory of the current drive, and ! that's generally a poor location for a temp file (depending on ! privileges, you may not even be able to open a file using this name). \end{funcdesc} From tim_one@users.sourceforge.net Mon Apr 28 04:13:06 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 27 Apr 2003 20:13:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv2879/python/Lib/test Modified Files: test_os.py Log Message: SF bug 728097: tmpnam problems on windows 2.3b, breaks test.test_os. tmpnam() appears essentially useless on Windows, and it finally broke the test for Irmen de Jong. Read the long new comment in test_tmpnam() for details. Since the MS implementation is insane, it might be good if we supplied a different implementation. Bugfix candidate. Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_os.py 27 Apr 2003 07:54:23 -0000 1.16 --- test_os.py 28 Apr 2003 03:13:03 -0000 1.17 *************** *** 55,63 **** def test_tmpnam(self): if not hasattr(os, "tmpnam"): return warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, r"test_os$") ! self.check_tempfile(os.tmpnam()) # Test attributes on return values from os.*stat* family. --- 55,84 ---- def test_tmpnam(self): + import sys if not hasattr(os, "tmpnam"): return warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, r"test_os$") ! name = os.tmpnam() ! if sys.platform in ("win32",): ! # The Windows tmpnam() seems useless. From the MS docs: ! # ! # The character string that tmpnam creates consists of ! # the path prefix, defined by the entry P_tmpdir in the ! # file STDIO.H, followed by a sequence consisting of the ! # digit characters '0' through '9'; the numerical value ! # of this string is in the range 1 - 65,535. Changing the ! # definitions of L_tmpnam or P_tmpdir in STDIO.H does not ! # change the operation of tmpnam. ! # ! # The really bizarre part is that, at least under MSVC6, ! # P_tmpdir is "\\". That is, the path returned refers to ! # the root of the current drive. That's a terrible place to ! # put temp files, and, depending on privileges, the user ! # may not even be able to open a file in the root directory. ! self.failIf(os.path.exists(name), ! "file already exists for temporary file") ! else: ! self.check_tempfile(name) # Test attributes on return values from os.*stat* family. From jhylton@users.sourceforge.net Mon Apr 28 13:11:27 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 05:11:27 -0700 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.26,1.1.2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv3221a Modified Files: Tag: ast-branch ast.c Log Message: Handle keyword arguments at call site. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.26 retrieving revision 1.1.2.27 diff -C2 -d -r1.1.2.26 -r1.1.2.27 *** ast.c 3 Apr 2003 00:51:45 -0000 1.1.2.26 --- ast.c 28 Apr 2003 12:11:22 -0000 1.1.2.27 *************** *** 869,900 **** */ ! int i, nargs; asdl_seq *args = NULL; REQ(n, arglist); nargs = 0; ! for (i = 0; i < NCH(n); i++) ! if (TYPE(CHILD(n, i)) == argument) ! nargs++; args = asdl_seq_new(nargs); if (!args) return NULL; for (i = 0; i < NCH(n); i++) { node *ch = CHILD(n, i); if (TYPE(ch) == argument) { expr_ty e; ! if (NCH(ch) == 1) e = ast_for_expr(CHILD(ch, 0)); ! else ! e = NULL; ! asdl_seq_SET(args, i / 2, e); } } - /* XXX syntax error if more than 255 arguments */ ! return Call(func, args, NULL, NULL, NULL); } --- 869,922 ---- */ ! int i, nargs, nkeywords; asdl_seq *args = NULL; + asdl_seq *keywords = NULL; REQ(n, arglist); nargs = 0; ! nkeywords = 0; ! for (i = 0; i < NCH(n); i++) ! if (TYPE(CHILD(n, i)) == argument) { ! if (NCH(CHILD(n, i)) == 1) ! nargs++; ! else ! nkeywords++; ! } args = asdl_seq_new(nargs); if (!args) return NULL; + keywords = asdl_seq_new(nkeywords); + if (!keywords) + return NULL; + nargs = 0; + nkeywords = 0; for (i = 0; i < NCH(n); i++) { node *ch = CHILD(n, i); if (TYPE(ch) == argument) { expr_ty e; ! if (NCH(ch) == 1) { e = ast_for_expr(CHILD(ch, 0)); ! asdl_seq_SET(args, nargs++, e); ! } ! else { ! keyword_ty kw; ! identifier key; ! ! /* CHILD(ch, 0) is test, but must be an identifier? */ ! e = ast_for_expr(CHILD(ch, 0)); ! assert(e->kind == Name_kind); ! key = e->v.Name.id; ! free(e); ! e = ast_for_expr(CHILD(ch, 2)); ! kw = keyword(key, e); ! asdl_seq_SET(keywords, nkeywords++, kw); ! } } } /* XXX syntax error if more than 255 arguments */ ! return Call(func, args, keywords, NULL, NULL); } From jackjansen@users.sourceforge.net Mon Apr 28 15:48:04 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 28 Apr 2003 07:48:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources Welcome.txt,1.1,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv23566/resources Modified Files: Tag: r23b1-branch Welcome.txt Log Message: - Don't generate README, but ask the user to provide it. - Create destination dir, if needed. - Updated for 2.3b1. Index: Welcome.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/Welcome.txt,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** Welcome.txt 21 Mar 2003 23:52:36 -0000 1.1 --- Welcome.txt 28 Apr 2003 14:47:58 -0000 1.1.2.1 *************** *** 1,6 **** ! Welcome! ! This program will install Python 2.3a2 for Mac OS X as a Framework. ! Build number: 3 ! Build date: Thu Mar 20 18:54:52 PST 2003 --- 1,19 ---- ! This program will install MacPython 2.3b1 for Mac OS X. ! MacPython consists of the Python programming language interpreter, plus ! a set of programs to allow easy access to it for Mac users (an ! integrated development environment, a Python extension package manager), ! plus a set of pre-built extension modules that open up specific ! Macintosh technologies to Python programs (Carbon, AppleScript, ! Quicktime, more). ! The installer puts the applications in MacPython-2.3 in your ! Applications folder, command-line tools in /usr/local/bin and the ! underlying machinery in /Library/Frameworks/Python.framework. ! ! The PythonIDE application has a Help command that gets you started ! quickly with MacPython and contains references to other documentation. ! ! More information on MacPython can be found at ! http://www.cwi.nl/~jack/macpython.html, more information on Python in ! general at http://www.python.org. From jackjansen@users.sourceforge.net Mon Apr 28 15:48:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 28 Apr 2003 07:48:30 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.2,1.2.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv23566 Modified Files: Tag: r23b1-branch build Log Message: - Don't generate README, but ask the user to provide it. - Create destination dir, if needed. - Updated for 2.3b1. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** build 22 Mar 2003 00:02:23 -0000 1.2 --- build 28 Apr 2003 14:47:57 -0000 1.2.2.1 *************** *** 6,12 **** # Script configs ! PYVERSION=2.3a2 PYVER=2.3 ! BUILDNUM=3 DOCLEANUP=no --- 6,12 ---- # Script configs ! PYVERSION=2.3b1 PYVER=2.3 ! BUILDNUM=1 DOCLEANUP=no *************** *** 41,44 **** --- 41,52 ---- pushd $BUILDROOT + # Ask the user whether s/he has edited Welcome.txt + read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome + + if [ "$welcome" = "n" -o "$welcome" = "N" ]; then + echo "Please do so and retry" + exit + fi + # Check if we should build and install the docs, but only if it # doesn't appear to be done already. TODO: fix this path to be version independent *************** *** 86,99 **** python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools - # Make the welcome message - cat > $RESOURCEDIR/Welcome.txt < Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv11746/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Improve line number handling./ Set a_lineno on exit from assemble_lnotab()! Otherwise the lnotab entries are always line numbers relative to 0. Set the first line number in a code object. Handle bytecode offsets greater than 255. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.52 retrieving revision 1.1.2.53 diff -C2 -d -r1.1.2.52 -r1.1.2.53 *** newcompile.c 24 Apr 2003 17:39:24 -0000 1.1.2.52 --- newcompile.c 28 Apr 2003 16:35:40 -0000 1.1.2.53 *************** *** 77,80 **** --- 77,81 ---- int a_lineno; /* last lineno of emitted instruction */ int a_lineno_off; /* bytecode offset of last lineno */ + int a_firstlineno; /* first line number in code */ }; *************** *** 495,500 **** { struct basicblock *b; - fprintf(stderr, "set_lineno() set=%d lineno=%d\n", - c->u->u_lineno_set, c->u->u_lineno); if (c->u->u_lineno_set) return; --- 496,499 ---- *************** *** 2160,2176 **** return 1; ! /* XXX for now */ ! assert(d_bytecode < 256); assert(d_lineno < 256); ! ! len = PyString_GET_SIZE(a->a_lnotab); ! if (a->a_lnotab_off + 2 >= len) { ! if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) ! return 0; } - lnotab = PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; *lnotab++ = d_bytecode; *lnotab++ = d_lineno; ! a->a_lnotab_off += 2; return 1; } --- 2159,2196 ---- return 1; ! /* XXX Need logic for line number gaps greater than 255. */ assert(d_lineno < 256); ! if (d_bytecode > 255) { ! int i, nbytes, ncodes = d_bytecode / 255; ! nbytes = a->a_lnotab_off + 2 * ncodes; ! len = PyString_GET_SIZE(a->a_lnotab); ! if (nbytes >= len) { ! if (len * 2 < nbytes) ! len = nbytes; ! else ! len *= 2; ! if (_PyString_Resize(&a->a_lnotab, len) < 0) ! return 0; ! } ! lnotab = PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; ! for (i = 0; i < ncodes; i++) { ! *lnotab++ = 255; ! *lnotab++ = 0; ! } ! d_bytecode -= ncodes * 255; ! a->a_lnotab_off += ncodes * 2; ! } ! else { ! len = PyString_GET_SIZE(a->a_lnotab); ! if (a->a_lnotab_off + 2 >= len) { ! if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) ! return 0; ! } ! lnotab = PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; ! a->a_lnotab_off += 2; } *lnotab++ = d_bytecode; *lnotab++ = d_lineno; ! a->a_lineno = i->i_lineno; return 1; } *************** *** 2331,2335 **** nil, nil, filename, c->u->u_name, ! 0, a->a_lnotab); error: --- 2351,2355 ---- nil, nil, filename, c->u->u_name, ! a->a_firstlineno, a->a_lnotab); error: *************** *** 2366,2369 **** --- 2386,2390 ---- goto error; + a.a_firstlineno = -1; /* Emit code in reverse postorder from dfs. */ for (i = a.a_nblocks - 1; i >= 0; i--) { *************** *** 2374,2377 **** --- 2395,2402 ---- b->b_next); for (j = 0; j < b->b_iused; j++) { + if (a.a_firstlineno < 0) { + a.a_firstlineno = b->b_instr[0].i_lineno; + a.a_lineno = a.a_firstlineno; + } if (!assemble_emit(&a, &b->b_instr[j])) goto error; From jhylton@users.sourceforge.net Mon Apr 28 18:22:16 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/tclmods tclSelectNotify.c,1.2,NONE tclMacNotify.c,1.5,NONE license-terms.txt,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/tclmods In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/tclmods Removed Files: Tag: ast-branch tclSelectNotify.c tclMacNotify.c license-terms.txt Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- tclSelectNotify.c DELETED --- --- tclMacNotify.c DELETED --- --- license-terms.txt DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:22:03 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:03 -0700 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec,NONE,1.2.4.1 python-2.2.spec,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Misc/RPM Added Files: Tag: ast-branch python-2.3.spec Removed Files: Tag: ast-branch python-2.2.spec Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: python-2.3.spec --- ########################## # User-modifiable configs ########################## # Is the resulting package and the installed binary named "python" or # "python2"? #WARNING: Commenting out doesn't work. Last line is what's used. %define config_binsuffix none %define config_binsuffix 2.3 # Build tkinter? "auto" enables it if /usr/bin/wish exists. #WARNING: Commenting out doesn't work. Last line is what's used. %define config_tkinter no %define config_tkinter yes %define config_tkinter auto # Use pymalloc? The last line (commented or not) determines wether # pymalloc is used. #WARNING: Commenting out doesn't work. Last line is what's used. %define config_pymalloc no %define config_pymalloc yes # Enable IPV6? #WARNING: Commenting out doesn't work. Last line is what's used. %define config_ipv6 yes %define config_ipv6 no ################################# # End of user-modifiable configs ################################# %define name python %define version 2.3b1 %define libvers 2.3 %define release 1pydotorg %define __prefix /usr # kludge to get around rpm define weirdness %define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi) %define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi) %define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi) %define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi) Summary: An interpreted, interactive, object-oriented programming language. Name: %{name}%{binsuffix} Version: %{version} Release: %{release} Copyright: Modified CNRI Open Source License Group: Development/Languages Source: Python-%{version}.tgz Source1: html-%{version}.tar.bz2 Patch0: Python-2.1-pythonpath.patch #Patch1: Python-2.1-expat.patch BuildRoot: /var/tmp/%{name}-%{version}-root BuildPrereq: expat-devel BuildPrereq: db4-devel BuildPrereq: gdbm-devel Prefix: %{__prefix} Packager: Sean Reifschneider %description Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the Mac. %package devel Summary: The libraries and header files needed for Python extension development. Prereq: python%{binsuffix} = %{PACKAGE_VERSION} Group: Development/Libraries %description devel The Python programming language's interpreter can be extended with dynamically loaded extensions and can be embedded in other programs. This package contains the header files and libraries needed to do these types of tasks. Install python-devel if you want to develop Python extensions. The python package will also need to be installed. You'll probably also want to install the python-docs package, which contains Python documentation. %if %{include_tkinter} %package tkinter Summary: A graphical user interface for the Python scripting language. Group: Development/Languages Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} %description tkinter The Tkinter (Tk interface) program is an graphical user interface for the Python scripting language. You should install the tkinter package if you'd like to use a graphical user interface for Python programming. %endif %package tools Summary: A collection of development tools included with Python. Group: Development/Tools Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} %description tools The Python package includes several development tools that are used to build python programs. This package contains a selection of those tools, including the IDLE Python IDE. Install python-tools if you want to use these tools to develop Python programs. You will also need to install the python and tkinter packages. %package docs Summary: Python-related documentation. Group: Development/Documentation %description docs Documentation relating to the Python programming language in HTML and info formats. %changelog * Mon Feb 24 2003 Sean Reifschneider [2.3b1-1pydotorg] - Updating to 2.3b1 release. * Mon Feb 17 2003 Sean Reifschneider [2.3a1-1] - Updating to 2.3 release. * Sun Dec 23 2001 Sean Reifschneider [Release 2.2-2] - Added -docs package. - Added "auto" config_tkinter setting which only enables tk if /usr/bin/wish exists. * Sat Dec 22 2001 Sean Reifschneider [Release 2.2-1] - Updated to 2.2. - Changed the extension to "2" from "2.2". * Tue Nov 18 2001 Sean Reifschneider [Release 2.2c1-1] - Updated to 2.2c1. * Thu Nov 1 2001 Sean Reifschneider [Release 2.2b1-3] - Changed the way the sed for fixing the #! in pydoc works. * Wed Oct 24 2001 Sean Reifschneider [Release 2.2b1-2] - Fixed missing "email" package, thanks to anonymous report on sourceforge. - Fixed missing "compiler" package. * Mon Oct 22 2001 Sean Reifschneider [Release 2.2b1-1] - Updated to 2.2b1. * Mon Oct 9 2001 Sean Reifschneider [Release 2.2a4-4] - otto@balinor.mat.unimi.it mentioned that the license file is missing. * Sun Sep 30 2001 Sean Reifschneider [Release 2.2a4-3] - Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in the spec files. Thanks. * Wed Jul 25 2001 Sean Reifschneider [Release 2.2a1-1] - Updated to 2.2a1 release. - Changed idle and pydoc to use binsuffix macro ####### # PREP ####### %prep %setup -n Python-%{version} %patch0 -p1 #%patch1 ######## # BUILD ######## %build ./configure %{ipv6} %{pymalloc} --prefix=%{__prefix} make ########## # INSTALL ########## %install # set the install path echo '[install_scripts]' >setup.cfg echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload make prefix=$RPM_BUILD_ROOT%{__prefix} install # REPLACE PATH IN PYDOC if [ ! -z "%{binsuffix}" ] then ( cd $RPM_BUILD_ROOT%{__prefix}/bin mv pydoc pydoc.old sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \ pydoc.old >pydoc chmod 755 pydoc rm -f pydoc.old ) fi # add the binsuffix if [ ! -z "%{binsuffix}" ] then ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*; mv -f python python"%{binsuffix}" ) ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 ) ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" ) ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" ) fi ######## # Tools echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} echo 'exec %{_prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/Tools/idle/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} cp -a Tools $RPM_BUILD_ROOT%{_prefix}/lib/python%{libvers} # MAKE FILE LISTS rm -f mainpkg.files find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f | sed "s|^${RPM_BUILD_ROOT}|/|" | grep -v -e '_tkinter.so$' >mainpkg.files find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f | sed "s|^${RPM_BUILD_ROOT}|/|" | grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files rm -f tools.files find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f | sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files ###### # Docs mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python ( cd "$RPM_BUILD_ROOT"/var/www/html/python bunzip2 < %{SOURCE1} | tar x ) ######## # CLEAN ######## %clean rm -fr $RPM_BUILD_ROOT rm -f mainpkg.files tools.files ######## # FILES ######## %files -f mainpkg.files %defattr(-,root,root) %doc Misc/README Misc/cheatsheet Misc/Porting %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS %{__prefix}/man/man1/python%{binsuffix}.1.gz %dir %{__prefix}/include/python%{libvers} %dir %{__prefix}/lib/python%{libvers}/ %{__prefix}/lib/python%{libvers}/*.txt %{__prefix}/lib/python%{libvers}/*.py* %{__prefix}/lib/python%{libvers}/pdb.doc %{__prefix}/lib/python%{libvers}/profile.doc %{__prefix}/lib/python%{libvers}/curses %{__prefix}/lib/python%{libvers}/distutils %{__prefix}/lib/python%{libvers}/encodings %dir %{__prefix}/lib/python%{libvers}/lib-old %{__prefix}/lib/python%{libvers}/plat-linux2 %{__prefix}/lib/python%{libvers}/site-packages %{__prefix}/lib/python%{libvers}/test %{__prefix}/lib/python%{libvers}/xml %{__prefix}/lib/python%{libvers}/email %{__prefix}/lib/python%{libvers}/compiler %{__prefix}/lib/python%{libvers}/bsddb %{__prefix}/lib/python%{libvers}/hotshot %{__prefix}/lib/python%{libvers}/logging %{__prefix}/lib/python%{libvers}/lib-old %files devel %defattr(-,root,root) %{__prefix}/include/python%{libvers}/*.h %{__prefix}/lib/python%{libvers}/config %files -f tools.files tools %defattr(-,root,root) %if %{include_tkinter} %files tkinter %defattr(-,root,root) %{__prefix}/lib/python%{libvers}/lib-tk %{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so* %endif %files docs %defattr(-,root,root) /var/www/html/python/* --- python-2.2.spec DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:22:21 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:21 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/projects/build.macfreeze templatefrozenconfig.c,1.1,NONE frozenbundle.rsrc,1.3,NONE frozen.prj,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/projects/build.macfreeze In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/mwerks/projects/build.macfreeze Removed Files: Tag: ast-branch templatefrozenconfig.c frozenbundle.rsrc frozen.prj Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- templatefrozenconfig.c DELETED --- --- frozenbundle.rsrc DELETED --- --- frozen.prj DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:22:22 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:22 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/projects README-Projectfiles,1.5,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/projects In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/mwerks/projects Removed Files: Tag: ast-branch README-Projectfiles Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- README-Projectfiles DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:22:24 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:24 -0700 Subject: [Python-checkins] python/dist/src/Mac/Unsupported/PythonScript testeudora.py,1.1,NONE printaete.py,1.1,NONE getaete.py,1.1,NONE baetypes.py,1.1,NONE baetools.py,1.1,NONE baepack.py,1.1,NONE ReadMe.txt,1.1,NONE PythonScript.py,1.1,NONE PyScriptTest.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Unsupported/PythonScript In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/Unsupported/PythonScript Removed Files: Tag: ast-branch testeudora.py printaete.py getaete.py baetypes.py baetools.py baepack.py ReadMe.txt PythonScript.py PyScriptTest.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- testeudora.py DELETED --- --- printaete.py DELETED --- --- getaete.py DELETED --- --- baetypes.py DELETED --- --- baetools.py DELETED --- --- baepack.py DELETED --- --- ReadMe.txt DELETED --- --- PythonScript.py DELETED --- --- PyScriptTest.py DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:22:26 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Unsupported unshar.py,NONE,1.1.6.1 run.py,1.1,NONE mkfrozenresources.py,1.2,NONE fixgusidir.py,1.1,NONE findmodulefiles.py,1.2,NONE binhextree.py,1.1,NONE RunLibScript.rsrc,1.1,NONE RunLibScript.py,1.1,NONE PackLibDir.rsrc,1.1,NONE PackLibDir.py,1.1,NONE FixCreator.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Unsupported In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/Unsupported Added Files: Tag: ast-branch unshar.py Removed Files: Tag: ast-branch run.py mkfrozenresources.py fixgusidir.py findmodulefiles.py binhextree.py RunLibScript.rsrc RunLibScript.py PackLibDir.rsrc PackLibDir.py FixCreator.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: unshar.py --- # Extract files from a SHAR archive. # Run this on the Mac. # Usage: # >>> import unshar # >>> f = open('SHAR') # >>> unshar.unshar(f) import string import EasyDialogs def unshar(fp, verbose=0, overwrite=0): ofp = None file = None while 1: line = fp.readline() if verbose > 3: print 'Got:', `line` if line[:1] == 'X': # Most common case first if ofp: ofp.write(line[1:]) continue if not line: if verbose: print 'EOF' if ofp: print 'Unterminated file -- closing' ofp.close() ofp = None break if line[0] == '#': if verbose: print line, continue if line[:14] == 'sed "s/^X//" >': if verbose: print "!!!", `line` i = string.find(line, "'") j = string.find(line, "'", i+1) if i >= 0 and j > i: file = line[i+1:j] if '/' in file: words = string.splitfields(file, '/') for funny in '', '.': while funny in words: words.remove(funny) for i in range(len(words)): if words[i] == '..': words[i] = '' words.insert(0, '') file = string.joinfields(words, ':') try: ofp = open(file, 'r') ofp.close() ofp = None over = 1 except IOError: over = 0 if over and not overwrite: print 'Skipping', file, '(already exists) ...' continue ofp = open(file, 'w') if over: print 'Overwriting', file, '...' else: print 'Writing', file, '...' continue if line == 'END_OF_FILE\n': if not file: print 'Unexpected END_OF_FILE marker' if ofp: print 'done' ofp.close() ofp = None else: print 'done skipping' file = None continue if verbose: print "...", `line` def main(): import sys import os if len(sys.argv) > 1: for fname in sys.argv[1:]: fp = open(fname, 'r') dir, fn = os.path.split(fname) if dir: os.chdir(dir) unshar(fp) else: import macfs fname = EasyDialogs.AskFileForOpen() if not fname: sys.exit(0) fp = open(fname, 'r') dirname = EasyDialogs.AskFolder(message='Folder to save files in:') if not dirname: sys.exit(0) os.chdir(dirname) unshar(fp) if __name__ == '__main__': main() --- run.py DELETED --- --- mkfrozenresources.py DELETED --- --- fixgusidir.py DELETED --- --- findmodulefiles.py DELETED --- --- binhextree.py DELETED --- --- RunLibScript.rsrc DELETED --- --- RunLibScript.py DELETED --- --- PackLibDir.rsrc DELETED --- --- PackLibDir.py DELETED --- --- FixCreator.py DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:22:37 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/iconsrc PythonWSource.psd,NONE,1.1.8.1 PackageManager.psd,NONE,1.1.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/iconsrc In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/OSXResources/iconsrc Added Files: Tag: ast-branch PythonWSource.psd PackageManager.psd Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: PythonWSource.psd --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PackageManager.psd --- (This appears to be a binary file; contents omitted.) From jhylton@users.sourceforge.net Mon Apr 28 18:22:38 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:22:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources PythonSource.icns,1.1,NONE PythonCompiled.icns,1.1,NONE Applet-InfoPlist.strings,1.1,NONE Applet-Info.plist,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Mac/OSXResources/app/Resources Removed Files: Tag: ast-branch PythonSource.icns PythonCompiled.icns Applet-InfoPlist.strings Applet-Info.plist Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- PythonSource.icns DELETED --- --- PythonCompiled.icns DELETED --- --- Applet-InfoPlist.strings DELETED --- --- Applet-Info.plist DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:27:28 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:27:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/data msg_29.txt,1.1,NONE msg_27.txt,1.1,NONE msg_26.txt,1.1,NONE msg_25.txt,1.1,NONE msg_24.txt,1.1,NONE msg_23.txt,1.1,NONE msg_22.txt,1.1,NONE msg_21.txt,1.1,NONE msg_20.txt,1.1,NONE msg_19.txt,1.1,NONE msg_18.txt,1.1,NONE msg_17.txt,1.1,NONE msg_16.txt,1.1,NONE msg_15.txt,1.1,NONE msg_14.txt,1.1,NONE msg_13.txt,1.1,NONE msg_12.txt,1.1,NONE msg_11.txt,1.1,NONE msg_10.txt,1.1,NONE msg_09.txt,1.1,NONE msg_08.txt,1.1,NONE msg_07.txt,1.1,NONE msg_06.txt,1.1,NONE msg_05.txt,1.1,NONE msg_04.txt,1.1,NONE msg_03.txt,1.1,NONE msg_02.txt,1.1,NONE msg_01.txt,1.1,NONE PyBanner048.gif,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/data In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Lib/test/data Removed Files: Tag: ast-branch msg_29.txt msg_27.txt msg_26.txt msg_25.txt msg_24.txt msg_23.txt msg_22.txt msg_21.txt msg_20.txt msg_19.txt msg_18.txt msg_17.txt msg_16.txt msg_15.txt msg_14.txt msg_13.txt msg_12.txt msg_11.txt msg_10.txt msg_09.txt msg_08.txt msg_07.txt msg_06.txt msg_05.txt msg_04.txt msg_03.txt msg_02.txt msg_01.txt PyBanner048.gif Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- msg_29.txt DELETED --- --- msg_27.txt DELETED --- --- msg_26.txt DELETED --- --- msg_25.txt DELETED --- --- msg_24.txt DELETED --- --- msg_23.txt DELETED --- --- msg_22.txt DELETED --- --- msg_21.txt DELETED --- --- msg_20.txt DELETED --- --- msg_19.txt DELETED --- --- msg_18.txt DELETED --- --- msg_17.txt DELETED --- --- msg_16.txt DELETED --- --- msg_15.txt DELETED --- --- msg_14.txt DELETED --- --- msg_13.txt DELETED --- --- msg_12.txt DELETED --- --- msg_11.txt DELETED --- --- msg_10.txt DELETED --- --- msg_09.txt DELETED --- --- msg_08.txt DELETED --- --- msg_07.txt DELETED --- --- msg_06.txt DELETED --- --- msg_05.txt DELETED --- --- msg_04.txt DELETED --- --- msg_03.txt DELETED --- --- msg_02.txt DELETED --- --- msg_01.txt DELETED --- --- PyBanner048.gif DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/html/icons pyfav.gif,NONE,1.1.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html/icons In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc/html/icons Added Files: Tag: ast-branch pyfav.gif Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: pyfav.gif --- (This appears to be a binary file; contents omitted.) From jhylton@users.sourceforge.net Mon Apr 28 18:38:18 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:18 -0700 Subject: [Python-checkins] python/dist/src/Demo/tkinter/guido ss1.py,NONE,1.4.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tkinter/guido In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/tkinter/guido Added Files: Tag: ast-branch ss1.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: ss1.py --- """SS1 -- a spreadsheet.""" import os import re import sys import cgi import rexec from xml.parsers import expat LEFT, CENTER, RIGHT = "LEFT", "CENTER", "RIGHT" def ljust(x, n): return x.ljust(n) def center(x, n): return x.center(n) def rjust(x, n): return x.rjust(n) align2action = {LEFT: ljust, CENTER: center, RIGHT: rjust} align2xml = {LEFT: "left", CENTER: "center", RIGHT: "right"} xml2align = {"left": LEFT, "center": CENTER, "right": RIGHT} align2anchor = {LEFT: "w", CENTER: "center", RIGHT: "e"} def sum(seq): total = 0 for x in seq: if x is not None: total += x return total class Sheet: def __init__(self): self.cells = {} # {(x, y): cell, ...} self.rexec = rexec.RExec() m = self.rexec.add_module('__main__') m.cell = self.cellvalue m.cells = self.multicellvalue m.sum = sum def cellvalue(self, x, y): cell = self.getcell(x, y) if hasattr(cell, 'recalc'): return cell.recalc(self.rexec) else: return cell def multicellvalue(self, x1, y1, x2, y2): if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 seq = [] for y in range(y1, y2+1): for x in range(x1, x2+1): seq.append(self.cellvalue(x, y)) return seq def getcell(self, x, y): return self.cells.get((x, y)) def setcell(self, x, y, cell): assert x > 0 and y > 0 assert isinstance(cell, BaseCell) self.cells[x, y] = cell def clearcell(self, x, y): try: del self.cells[x, y] except KeyError: pass def clearcells(self, x1, y1, x2, y2): for xy in self.selectcells(x1, y1, x2, y2): del self.cells[xy] def clearrows(self, y1, y2): self.clearcells(0, y1, sys.maxint, y2) def clearcolumns(self, x1, x2): self.clearcells(x1, 0, x2, sys.maxint) def selectcells(self, x1, y1, x2, y2): if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 return [(x, y) for x, y in self.cells if x1 <= x <= x2 and y1 <= y <= y2] def movecells(self, x1, y1, x2, y2, dx, dy): if dx == 0 and dy == 0: return if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 assert x1+dx > 0 and y1+dy > 0 new = {} for x, y in self.cells: cell = self.cells[x, y] if hasattr(cell, 'renumber'): cell = cell.renumber(x1, y1, x2, y2, dx, dy) if x1 <= x <= x2 and y1 <= y <= y2: x += dx y += dy new[x, y] = cell self.cells = new def insertrows(self, y, n): assert n > 0 self.movecells(0, y, sys.maxint, sys.maxint, 0, n) def deleterows(self, y1, y2): if y1 > y2: y1, y2 = y2, y1 self.clearrows(y1, y2) self.movecells(0, y2+1, sys.maxint, sys.maxint, 0, y1-y2-1) def insertcolumns(self, x, n): assert n > 0 self.movecells(x, 0, sys.maxint, sys.maxint, n, 0) def deletecolumns(self, x1, x2): if x1 > x2: x1, x2 = x2, x1 self.clearcells(x1, x2) self.movecells(x2+1, 0, sys.maxint, sys.maxint, x1-x2-1, 0) def getsize(self): maxx = maxy = 0 for x, y in self.cells: maxx = max(maxx, x) maxy = max(maxy, y) return maxx, maxy def reset(self): for cell in self.cells.itervalues(): if hasattr(cell, 'reset'): cell.reset() def recalc(self): self.reset() for cell in self.cells.itervalues(): if hasattr(cell, 'recalc'): cell.recalc(self.rexec) def display(self): maxx, maxy = self.getsize() width, height = maxx+1, maxy+1 colwidth = [1] * width full = {} # Add column heading labels in row 0 for x in range(1, width): full[x, 0] = text, alignment = colnum2name(x), RIGHT colwidth[x] = max(colwidth[x], len(text)) # Add row labels in column 0 for y in range(1, height): full[0, y] = text, alignment = str(y), RIGHT colwidth[0] = max(colwidth[0], len(text)) # Add sheet cells in columns with x>0 and y>0 for (x, y), cell in self.cells.iteritems(): if x <= 0 or y <= 0: continue if hasattr(cell, 'recalc'): cell.recalc(self.rexec) if hasattr(cell, 'format'): text, alignment = cell.format() assert isinstance(text, str) assert alignment in (LEFT, CENTER, RIGHT) else: text = str(cell) if isinstance(cell, str): alignment = LEFT else: alignment = RIGHT full[x, y] = (text, alignment) colwidth[x] = max(colwidth[x], len(text)) # Calculate the horizontal separator line (dashes and dots) sep = "" for x in range(width): if sep: sep += "+" sep += "-"*colwidth[x] # Now print The full grid for y in range(height): line = "" for x in range(width): text, alignment = full.get((x, y)) or ("", LEFT) text = align2action[alignment](text, colwidth[x]) if line: line += '|' line += text print line if y == 0: print sep def xml(self): out = [''] for (x, y), cell in self.cells.iteritems(): if hasattr(cell, 'xml'): cellxml = cell.xml() else: cellxml = '%s' % cgi.escape(cell) out.append('\n %s\n' % (y, x, cellxml)) out.append('') return '\n'.join(out) def save(self, filename): text = self.xml() f = open(filename, "w") f.write(text) if text and not text.endswith('\n'): f.write('\n') f.close() def load(self, filename): f = open(filename, 'r') SheetParser(self).parsefile(f) f.close() class SheetParser: def __init__(self, sheet): self.sheet = sheet def parsefile(self, f): parser = expat.ParserCreate() parser.StartElementHandler = self.startelement parser.EndElementHandler = self.endelement parser.CharacterDataHandler = self.data parser.ParseFile(f) def startelement(self, tag, attrs): method = getattr(self, 'start_'+tag, None) if method: for key, value in attrs.iteritems(): attrs[key] = str(value) # XXX Convert Unicode to 8-bit method(attrs) self.texts = [] def data(self, text): text = str(text) # XXX Convert Unicode to 8-bit self.texts.append(text) def endelement(self, tag): method = getattr(self, 'end_'+tag, None) if method: method("".join(self.texts)) def start_cell(self, attrs): self.y = int(attrs.get("row")) self.x = int(attrs.get("col")) def start_value(self, attrs): self.fmt = attrs.get('format') self.alignment = xml2align.get(attrs.get('align')) start_formula = start_value def end_int(self, text): try: self.value = int(text) except: self.value = None def end_long(self, text): try: self.value = long(text) except: self.value = None def end_double(self, text): try: self.value = float(text) except: self.value = None def end_complex(self, text): try: self.value = complex(text) except: self.value = None def end_string(self, text): try: self.value = text except: self.value = None def end_value(self, text): if isinstance(self.value, BaseCell): self.cell = self.value elif isinstance(self.value, str): self.cell = StringCell(self.value, self.fmt or "%s", self.alignment or LEFT) else: self.cell = NumericCell(self.value, self.fmt or "%s", self.alignment or RIGHT) def end_formula(self, text): self.cell = FormulaCell(text, self.fmt or "%s", self.alignment or RIGHT) def end_cell(self, text): self.sheet.setcell(self.x, self.y, self.cell) class BaseCell: __init__ = None # Must provide """Abstract base class for sheet cells. Subclasses may but needn't provide the following APIs: cell.reset() -- prepare for recalculation cell.recalc(rexec) -> value -- recalculate formula cell.format() -> (value, alignment) -- return formatted value cell.xml() -> string -- return XML """ class NumericCell(BaseCell): def __init__(self, value, fmt="%s", alignment=RIGHT): assert isinstance(value, (int, long, float, complex)) assert alignment in (LEFT, CENTER, RIGHT) self.value = value self.fmt = fmt self.alignment = alignment def recalc(self, rexec): return self.value def format(self): try: text = self.fmt % self.value except: text = str(self.value) return text, self.alignment def xml(self): method = getattr(self, '_xml_' + type(self.value).__name__) return '%s' % ( align2xml[self.alignment], self.fmt, method()) def _xml_int(self): if -2**31 <= self.value < 2**31: return '%s' % self.value else: return self._xml_long() def _xml_long(self): return '%s' % self.value def _xml_float(self): return '%s' % repr(self.value) def _xml_complex(self): return '%s' % repr(self.value) class StringCell(BaseCell): def __init__(self, text, fmt="%s", alignment=LEFT): assert isinstance(text, (str, unicode)) assert alignment in (LEFT, CENTER, RIGHT) self.text = text self.fmt = fmt self.alignment = alignment def recalc(self, rexec): return self.text def format(self): return self.text, self.alignment def xml(self): s = '%s' return s % ( align2xml[self.alignment], self.fmt, cgi.escape(self.text)) class FormulaCell(BaseCell): def __init__(self, formula, fmt="%s", alignment=RIGHT): assert alignment in (LEFT, CENTER, RIGHT) self.formula = formula self.translated = translate(self.formula) self.fmt = fmt self.alignment = alignment self.reset() def reset(self): self.value = None def recalc(self, rexec): if self.value is None: try: # A hack to evaluate expressions using true division rexec.r_exec("from __future__ import division\n" + "__value__ = eval(%s)" % repr(self.translated)) self.value = rexec.r_eval("__value__") except: exc = sys.exc_info()[0] if hasattr(exc, "__name__"): self.value = exc.__name__ else: self.value = str(exc) return self.value def format(self): try: text = self.fmt % self.value except: text = str(self.value) return text, self.alignment def xml(self): return '%s' % ( align2xml[self.alignment], self.fmt, self.formula) def renumber(self, x1, y1, x2, y2, dx, dy): out = [] for part in re.split('(\w+)', self.formula): m = re.match('^([A-Z]+)([1-9][0-9]*)$', part) if m is not None: sx, sy = m.groups() x = colname2num(sx) y = int(sy) if x1 <= x <= x2 and y1 <= y <= y2: part = cellname(x+dx, y+dy) out.append(part) return FormulaCell("".join(out), self.fmt, self.alignment) def translate(formula): """Translate a formula containing fancy cell names to valid Python code. Examples: B4 -> cell(2, 4) B4:Z100 -> cells(2, 4, 26, 100) """ out = [] for part in re.split(r"(\w+(?::\w+)?)", formula): m = re.match(r"^([A-Z]+)([1-9][0-9]*)(?::([A-Z]+)([1-9][0-9]*))?$", part) if m is None: out.append(part) else: x1, y1, x2, y2 = m.groups() x1 = colname2num(x1) if x2 is None: s = "cell(%s, %s)" % (x1, y1) else: x2 = colname2num(x2) s = "cells(%s, %s, %s, %s)" % (x1, y1, x2, y2) out.append(s) return "".join(out) def cellname(x, y): "Translate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1')." assert x > 0 # Column 0 has an empty name, so can't use that return colnum2name(x) + str(y) def colname2num(s): "Translate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27)." s = s.upper() n = 0 for c in s: assert 'A' <= c <= 'Z' n = n*26 + ord(c) - ord('A') + 1 return n def colnum2name(n): "Translate a column number to name (e.g. 1->'A', etc.)." assert n > 0 s = "" while n: n, m = divmod(n-1, 26) s = chr(m+ord('A')) + s return s import Tkinter as Tk class SheetGUI: """Beginnings of a GUI for a spreadsheet. TO DO: - clear multiple cells - Insert, clear, remove rows or columns - Show new contents while typing - Scroll bars - Grow grid when window is grown - Proper menus - Undo, redo - Cut, copy and paste - Formatting and alignment """ def __init__(self, filename="sheet1.xml", rows=10, columns=5): """Constructor. Load the sheet from the filename argument. Set up the Tk widget tree. """ # Create and load the sheet self.filename = filename self.sheet = Sheet() if os.path.isfile(filename): self.sheet.load(filename) # Calculate the needed grid size maxx, maxy = self.sheet.getsize() rows = max(rows, maxy) columns = max(columns, maxx) # Create the widgets self.root = Tk.Tk() self.root.wm_title("Spreadsheet: %s" % self.filename) self.beacon = Tk.Label(self.root, text="A1", font=('helvetica', 16, 'bold')) self.entry = Tk.Entry(self.root) self.savebutton = Tk.Button(self.root, text="Save", command=self.save) self.cellgrid = Tk.Frame(self.root) # Configure the widget lay-out self.cellgrid.pack(side="bottom", expand=1, fill="both") self.beacon.pack(side="left") self.savebutton.pack(side="right") self.entry.pack(side="left", expand=1, fill="x") # Bind some events self.entry.bind("", self.return_event) self.entry.bind("", self.shift_return_event) self.entry.bind("", self.tab_event) self.entry.bind("", self.shift_tab_event) self.entry.bind("", self.delete_event) self.entry.bind("", self.escape_event) # Now create the cell grid self.makegrid(rows, columns) # Select the top-left cell self.currentxy = None self.cornerxy = None self.setcurrent(1, 1) # Copy the sheet cells to the GUI cells self.sync() def delete_event(self, event): if self.cornerxy != self.currentxy and self.cornerxy is not None: self.sheet.clearcells(*(self.currentxy + self.cornerxy)) else: self.sheet.clearcell(*self.currentxy) self.sync() self.entry.delete(0, 'end') return "break" def escape_event(self, event): x, y = self.currentxy self.load_entry(x, y) def load_entry(self, x, y): cell = self.sheet.getcell(x, y) if cell is None: text = "" elif isinstance(cell, FormulaCell): text = '=' + cell.formula else: text, alignment = cell.format() self.entry.delete(0, 'end') self.entry.insert(0, text) self.entry.selection_range(0, 'end') def makegrid(self, rows, columns): """Helper to create the grid of GUI cells. The edge (x==0 or y==0) is filled with labels; the rest is real cells. """ self.rows = rows self.columns = columns self.gridcells = {} # Create the top left corner cell (which selects all) cell = Tk.Label(self.cellgrid, relief='raised') cell.grid_configure(column=0, row=0, sticky='NSWE') cell.bind("", self.selectall) # Create the top row of labels, and confiure the grid columns for x in range(1, columns+1): self.cellgrid.grid_columnconfigure(x, minsize=64) cell = Tk.Label(self.cellgrid, text=colnum2name(x), relief='raised') cell.grid_configure(column=x, row=0, sticky='WE') self.gridcells[x, 0] = cell cell.__x = x cell.__y = 0 cell.bind("", self.selectcolumn) cell.bind("", self.extendcolumn) cell.bind("", self.extendcolumn) cell.bind("", self.extendcolumn) # Create the leftmost column of labels for y in range(1, rows+1): cell = Tk.Label(self.cellgrid, text=str(y), relief='raised') cell.grid_configure(column=0, row=y, sticky='WE') self.gridcells[0, y] = cell cell.__x = 0 cell.__y = y cell.bind("", self.selectrow) cell.bind("", self.extendrow) cell.bind("", self.extendrow) cell.bind("", self.extendrow) # Create the real cells for x in range(1, columns+1): for y in range(1, rows+1): cell = Tk.Label(self.cellgrid, relief='sunken', bg='white', fg='black') cell.grid_configure(column=x, row=y, sticky='NSWE') self.gridcells[x, y] = cell cell.__x = x cell.__y = y # Bind mouse events cell.bind("", self.press) cell.bind("", self.motion) cell.bind("", self.release) cell.bind("", self.release) def selectall(self, event): self.setcurrent(1, 1) self.setcorner(sys.maxint, sys.maxint) def selectcolumn(self, event): x, y = self.whichxy(event) self.setcurrent(x, 1) self.setcorner(x, sys.maxint) def extendcolumn(self, event): x, y = self.whichxy(event) if x > 0: self.setcurrent(self.currentxy[0], 1) self.setcorner(x, sys.maxint) def selectrow(self, event): x, y = self.whichxy(event) self.setcurrent(1, y) self.setcorner(sys.maxint, y) def extendrow(self, event): x, y = self.whichxy(event) if y > 0: self.setcurrent(1, self.currentxy[1]) self.setcorner(sys.maxint, y) def press(self, event): x, y = self.whichxy(event) if x > 0 and y > 0: self.setcurrent(x, y) def motion(self, event): x, y = self.whichxy(event) if x > 0 and y > 0: self.setcorner(x, y) release = motion def whichxy(self, event): w = self.cellgrid.winfo_containing(event.x_root, event.y_root) if w is not None and isinstance(w, Tk.Label): try: return w.__x, w.__y except AttributeError: pass return 0, 0 def save(self): self.sheet.save(self.filename) def setcurrent(self, x, y): "Make (x, y) the current cell." if self.currentxy is not None: self.change_cell() self.clearfocus() self.beacon['text'] = cellname(x, y) self.load_entry(x, y) self.entry.focus_set() self.currentxy = x, y self.cornerxy = None gridcell = self.gridcells.get(self.currentxy) if gridcell is not None: gridcell['bg'] = 'yellow' def setcorner(self, x, y): if self.currentxy is None or self.currentxy == (x, y): self.setcurrent(x, y) return self.clearfocus() self.cornerxy = x, y x1, y1 = self.currentxy x2, y2 = self.cornerxy or self.currentxy if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 for (x, y), cell in self.gridcells.iteritems(): if x1 <= x <= x2 and y1 <= y <= y2: cell['bg'] = 'lightBlue' gridcell = self.gridcells.get(self.currentxy) if gridcell is not None: gridcell['bg'] = 'yellow' self.setbeacon(x1, y1, x2, y2) def setbeacon(self, x1, y1, x2, y2): if x1 == y1 == 1 and x2 == y2 == sys.maxint: name = ":" elif (x1, x2) == (1, sys.maxint): if y1 == y2: name = "%d" % y1 else: name = "%d:%d" % (y1, y2) elif (y1, y2) == (1, sys.maxint): if x1 == x2: name = "%s" % colnum2name(x1) else: name = "%s:%s" % (colnum2name(x1), colnum2name(x2)) else: name1 = cellname(*self.currentxy) name2 = cellname(*self.cornerxy) name = "%s:%s" % (name1, name2) self.beacon['text'] = name def clearfocus(self): if self.currentxy is not None: x1, y1 = self.currentxy x2, y2 = self.cornerxy or self.currentxy if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 for (x, y), cell in self.gridcells.iteritems(): if x1 <= x <= x2 and y1 <= y <= y2: cell['bg'] = 'white' def return_event(self, event): "Callback for the Return key." self.change_cell() x, y = self.currentxy self.setcurrent(x, y+1) return "break" def shift_return_event(self, event): "Callback for the Return key with Shift modifier." self.change_cell() x, y = self.currentxy self.setcurrent(x, max(1, y-1)) return "break" def tab_event(self, event): "Callback for the Tab key." self.change_cell() x, y = self.currentxy self.setcurrent(x+1, y) return "break" def shift_tab_event(self, event): "Callback for the Tab key with Shift modifier." self.change_cell() x, y = self.currentxy self.setcurrent(max(1, x-1), y) return "break" def change_cell(self): "Set the current cell from the entry widget." x, y = self.currentxy text = self.entry.get() cell = None if text.startswith('='): cell = FormulaCell(text[1:]) else: for cls in int, long, float, complex: try: value = cls(text) except: continue else: cell = NumericCell(value) break if cell is None and text: cell = StringCell(text) if cell is None: self.sheet.clearcell(x, y) else: self.sheet.setcell(x, y, cell) self.sync() def sync(self): "Fill the GUI cells from the sheet cells." self.sheet.recalc() for (x, y), gridcell in self.gridcells.iteritems(): if x == 0 or y == 0: continue cell = self.sheet.getcell(x, y) if cell is None: gridcell['text'] = "" else: if hasattr(cell, 'format'): text, alignment = cell.format() else: text, alignment = str(cell), LEFT gridcell['text'] = text gridcell['anchor'] = align2anchor[alignment] def test_basic(): "Basic non-gui self-test." import os a = Sheet() for x in range(1, 11): for y in range(1, 11): if x == 1: cell = NumericCell(y) elif y == 1: cell = NumericCell(x) else: c1 = cellname(x, 1) c2 = cellname(1, y) formula = "%s*%s" % (c1, c2) cell = FormulaCell(formula) a.setcell(x, y, cell) ## if os.path.isfile("sheet1.xml"): ## print "Loading from sheet1.xml" ## a.load("sheet1.xml") a.display() a.save("sheet1.xml") def test_gui(): "GUI test." if sys.argv[1:]: filename = sys.argv[1] else: filename = "sheet1.xml" g = SheetGUI(filename) g.root.mainloop() if __name__ == '__main__': #test_basic() test_gui() From jhylton@users.sourceforge.net Mon Apr 28 18:38:31 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:31 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/video watchcursor.py,1.2,NONE video2rgb.py,1.6,NONE video.doc,1.2,NONE svgrab24.c,1.1,NONE senddefs.py,1.1,NONE rgb2video.py,1.3,NONE imgconv.py,1.9,NONE cmif-film.ms,1.1,NONE aplay.py,1.3,NONE Vunjpeg.py,1.3,NONE Vtime.py,1.5,NONE Vstat.py,1.2,NONE Vsend.py,1.11,NONE Vreceive.py,1.8,NONE Vrecb.py,1.10,NONE Vrec.py,1.20,NONE Vplay.py,1.15,NONE Vmkjpeg.py,1.3,NONE Vinfo.py,1.13,NONE Viewer.py,1.4,NONE Vgeneric.py,1.1,NONE Vfix.py,1.3,NONE VeditForm.fd,1.3,NONE Vedit.py,1.9,NONE VcrIndex.py,1.2,NONE Vcopy.py,1.8,NONE VbForm.fd,1.7,NONE Vb.py,1.16,NONE Vaddcache.py,1.5,NONE VGrabber.py,1.3,NONE VFile.py,1.41,NONE VCR.py,1.7,NONE README,1.19,NONE OldVcopy.py,1.4,NONE LiveVideoOut.py,1.8,NONE LiveVideoIn.py,1.9,NONE Dsend.py,1.4,NONE DisplayVideoIn.py,1.2,NONE .cvsignore,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/video In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/video Removed Files: Tag: ast-branch watchcursor.py video2rgb.py video.doc svgrab24.c senddefs.py rgb2video.py imgconv.py cmif-film.ms aplay.py Vunjpeg.py Vtime.py Vstat.py Vsend.py Vreceive.py Vrecb.py Vrec.py Vplay.py Vmkjpeg.py Vinfo.py Viewer.py Vgeneric.py Vfix.py VeditForm.fd Vedit.py VcrIndex.py Vcopy.py VbForm.fd Vb.py Vaddcache.py VGrabber.py VFile.py VCR.py README OldVcopy.py LiveVideoOut.py LiveVideoIn.py Dsend.py DisplayVideoIn.py .cvsignore Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- watchcursor.py DELETED --- --- video2rgb.py DELETED --- --- video.doc DELETED --- --- svgrab24.c DELETED --- --- senddefs.py DELETED --- --- rgb2video.py DELETED --- --- imgconv.py DELETED --- --- cmif-film.ms DELETED --- --- aplay.py DELETED --- --- Vunjpeg.py DELETED --- --- Vtime.py DELETED --- --- Vstat.py DELETED --- --- Vsend.py DELETED --- --- Vreceive.py DELETED --- --- Vrecb.py DELETED --- --- Vrec.py DELETED --- --- Vplay.py DELETED --- --- Vmkjpeg.py DELETED --- --- Vinfo.py DELETED --- --- Viewer.py DELETED --- --- Vgeneric.py DELETED --- --- Vfix.py DELETED --- --- VeditForm.fd DELETED --- --- Vedit.py DELETED --- --- VcrIndex.py DELETED --- --- Vcopy.py DELETED --- --- VbForm.fd DELETED --- --- Vb.py DELETED --- --- Vaddcache.py DELETED --- --- VGrabber.py DELETED --- --- VFile.py DELETED --- --- VCR.py DELETED --- --- README DELETED --- --- OldVcopy.py DELETED --- --- LiveVideoOut.py DELETED --- --- LiveVideoIn.py DELETED --- --- Dsend.py DELETED --- --- DisplayVideoIn.py DELETED --- --- .cvsignore DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:32 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:32 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/sv simpleinput.py,1.1,NONE rgbgrab.py,1.1,NONE contcapt.py,1.2,NONE burstcapt.py,1.3,NONE README,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/sv In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/sv Removed Files: Tag: ast-branch simpleinput.py rgbgrab.py contcapt.py burstcapt.py README Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- simpleinput.py DELETED --- --- rgbgrab.py DELETED --- --- contcapt.py DELETED --- --- burstcapt.py DELETED --- --- README DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:34 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:34 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/gl zrgb.py,1.3,NONE nurbs.py,1.4,NONE mixing.py,1.3,NONE mclock.py,1.5,NONE mclock.doc,1.1,NONE kunst.py,1.5,NONE kites.py,1.4,NONE glinfo.py,1.2,NONE backface.py,1.3,NONE README,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/gl In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/gl Removed Files: Tag: ast-branch zrgb.py nurbs.py mixing.py mclock.py mclock.doc kunst.py kites.py glinfo.py backface.py README Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- zrgb.py DELETED --- --- nurbs.py DELETED --- --- mixing.py DELETED --- --- mclock.py DELETED --- --- mclock.doc DELETED --- --- kunst.py DELETED --- --- kites.py DELETED --- --- glinfo.py DELETED --- --- backface.py DELETED --- --- README DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:35 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:35 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/flp test_nocb.py,1.2,NONE test_nocb.fd,1.1,NONE test_cb.py,1.2,NONE test_cb.fd,1.1,NONE tcache.py,1.1,NONE tcache.fd,1.1,NONE .cvsignore,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/flp In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/flp Removed Files: Tag: ast-branch test_nocb.py test_nocb.fd test_cb.py test_cb.fd tcache.py tcache.fd .cvsignore Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- test_nocb.py DELETED --- --- test_nocb.fd DELETED --- --- test_cb.py DELETED --- --- test_cb.fd DELETED --- --- tcache.py DELETED --- --- tcache.fd DELETED --- --- .cvsignore DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:36 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:36 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/cd sendcd.py,1.4,NONE recvcd.py,1.3,NONE playcd.py,1.8,NONE listcd.py,1.3,NONE cdaiff.py,1.6,NONE README,1.5,NONE CD.doc,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/cd In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/cd Removed Files: Tag: ast-branch sendcd.py recvcd.py playcd.py listcd.py cdaiff.py README CD.doc Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- sendcd.py DELETED --- --- recvcd.py DELETED --- --- playcd.py DELETED --- --- listcd.py DELETED --- --- cdaiff.py DELETED --- --- README DELETED --- --- CD.doc DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:37 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:37 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/audio play.py,1.2,NONE README,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/audio In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/audio Removed Files: Tag: ast-branch play.py README Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- play.py DELETED --- --- README DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:39 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:39 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi/al x.py,1.1,NONE unicast.py,1.4,NONE record.py,1.1,NONE rec_play.py,1.2,NONE radio.py,1.4,NONE playold.py,1.3,NONE playback.py,1.1,NONE playaiff.py,1.3,NONE names.py,1.2,NONE listen.py,1.1,NONE intercom.py,1.7,NONE cmpaf_form.fd,1.1,NONE cmpaf.py,1.2,NONE broadcast.py,1.4,NONE alwatch.py,1.5,NONE README,1.2,NONE .cvsignore,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi/al In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi/al Removed Files: Tag: ast-branch x.py unicast.py record.py rec_play.py radio.py playold.py playback.py playaiff.py names.py listen.py intercom.py cmpaf_form.fd cmpaf.py broadcast.py alwatch.py README .cvsignore Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- x.py DELETED --- --- unicast.py DELETED --- --- record.py DELETED --- --- rec_play.py DELETED --- --- radio.py DELETED --- --- playold.py DELETED --- --- playback.py DELETED --- --- playaiff.py DELETED --- --- names.py DELETED --- --- listen.py DELETED --- --- intercom.py DELETED --- --- cmpaf_form.fd DELETED --- --- cmpaf.py DELETED --- --- broadcast.py DELETED --- --- alwatch.py DELETED --- --- README DELETED --- --- .cvsignore DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:38:40 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:38:40 -0700 Subject: [Python-checkins] python/dist/src/Demo/sgi README,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/sgi In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/sgi Removed Files: Tag: ast-branch README Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- README DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:39:43 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:39:43 -0700 Subject: [Python-checkins] python/dist/src/Demo/scripts find-uname.py,NONE,1.1.6.1 pp.py,1.4,1.4.30.1 README,1.18,1.18.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/scripts Modified Files: Tag: ast-branch pp.py README Added Files: Tag: ast-branch find-uname.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: find-uname.py --- #!/usr/bin/env python """ For each argument on the command line, look for it in the set of all Unicode names. Arguments are treated as case-insensitive regular expressions, e.g.: % find-uname 'small letter a$' 'horizontal line' *** small letter a$ matches *** LATIN SMALL LETTER A (97) COMBINING LATIN SMALL LETTER A (867) CYRILLIC SMALL LETTER A (1072) PARENTHESIZED LATIN SMALL LETTER A (9372) CIRCLED LATIN SMALL LETTER A (9424) FULLWIDTH LATIN SMALL LETTER A (65345) *** horizontal line matches *** HORIZONTAL LINE EXTENSION (9135) """ import unicodedata import sys import re def main(args): unicode_names= [] for ix in range(sys.maxunicode+1): try: unicode_names.append( (ix, unicodedata.name(unichr(ix))) ) except ValueError: # no name for the character pass for arg in args: pat = re.compile(arg, re.I) matches = [(x,y) for (x,y) in unicode_names if pat.search(y) is not None] if matches: print "***", arg, "matches", "***" for (x,y) in matches: print "%s (%d)" % (y,x) if __name__ == "__main__": main(sys.argv[1:]) Index: pp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/pp.py,v retrieving revision 1.4 retrieving revision 1.4.30.1 diff -C2 -d -r1.4 -r1.4.30.1 *** pp.py 27 Nov 1996 19:47:06 -0000 1.4 --- pp.py 28 Apr 2003 17:38:38 -0000 1.4.30.1 *************** *** 121,138 **** import tempfile ! tfn = tempfile.mktemp() ! try: ! fp = open(tfn, 'w') ! fp.write(program) ! fp.close() ! if DFLAG: ! import pdb ! pdb.run('execfile(' + `tfn` + ')') ! else: ! execfile(tfn) ! finally: ! import os ! try: ! os.unlink(tfn) ! except: ! pass --- 121,130 ---- import tempfile ! fp = tempfile.NamedTemporaryFile() ! fp.write(program) ! fp.flush() ! if DFLAG: ! import pdb ! pdb.run('execfile(' + `tfn` + ')') ! else: ! execfile(tfn) Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/README,v retrieving revision 1.18 retrieving revision 1.18.30.1 diff -C2 -d -r1.18 -r1.18.30.1 *** README 2 Mar 1995 16:00:55 -0000 1.18 --- README 28 Apr 2003 17:38:39 -0000 1.18.30.1 *************** *** 4,7 **** --- 4,8 ---- fact.py Factorize numbers + find-uname.py Search for Unicode characters using regexps. from.py Summarize mailbox ftpstats.py Summarize ftp daemon log file From jhylton@users.sourceforge.net Mon Apr 28 18:40:58 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:40:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tzinfo-examples.py,NONE,1.7.6.1 required_2.py,NONE,1.1.6.1 required_1.py,NONE,1.1.6.1 mimelib.tex,NONE,1.6.4.1 libtimeit.tex,NONE,1.2.4.1 libtarfile.tex,NONE,1.1.6.1 libstringprep.tex,NONE,1.1.4.1 libsets.tex,NONE,1.11.6.1 libpkgutil.tex,NONE,1.1.8.1 libossaudiodev.tex,NONE,1.6.4.1 liboptparse.tex,NONE,1.2.4.1 liblogging.tex,NONE,1.8.6.1 libitertools.tex,NONE,1.7.4.1 libhotshot.tex,NONE,1.4.4.1 libheapq.tex,NONE,1.5.8.1 libdummythreading.tex,NONE,1.2.8.1 libdummythread.tex,NONE,1.2.8.1 libdocxmlrpc.tex,NONE,1.2.4.1 libdatetime.tex,NONE,1.44.6.1 libcsv.tex,NONE,1.4.4.1 libconsts.tex,NONE,1.2.6.1 libbz2.tex,NONE,1.6.6.1 emailmimebase.tex,NONE,1.3.4.1 emailheaders.tex,NONE,1.4.4.1 emailcharsets.tex,NONE,1.3.4.1 email-unpack.py,NONE,1.1.10.1 email-simple.py,NONE,1.1.10.1 email-mime.py,NONE,1.1.10.1 email-dir.py,NONE,1.1.10.1 caseless.py,NONE,1.1.6.1 xmlsaxutils.tex,1.3,1.3.18.1 xmlsaxreader.tex,1.4,1.4.2.1 xmlsaxhandler.tex,1.9,1.9.2.1 xmlsax.tex,1.6,1.6.2.1 xmldomminidom.tex,1.6,1.6.2.1 xmldom.tex,1.19,1.19.8.1 tkinter.tex,1.12,1.12.2.1 markup.tex,1.1,1.1.26.1 libzipfile.tex,1.14,1.14.2.1 libxreadlines.tex,1.3,1.3.2.1 libxmlrpclib.tex,1.9,1.9.2.1 libxdrlib.tex,1.23,1.23.26.1 libweakref.tex,1.17,1.17.8.1 libwarnings.tex,1.9,1.9.2.1 libuu.tex,1.11,1.11.18.1 libuserdict.tex,1.21,1.21.2.1 liburlparse.tex,1.20,1.20.8.1 liburllib2.tex,1.6,1.6.10.1 liburllib.tex,1.43,1.43.2.1 libunittest.tex,1.9,1.9.2.1 libunicodedata.tex,1.3,1.3.24.1 libundoc.tex,1.81,1.81.8.1 libtypes.tex,1.54,1.54.2.1 libturtle.tex,1.4,1.4.10.1 libtraceback.tex,1.14,1.14.24.1 libtime.tex,1.48,1.48.8.1 libthreading.tex,1.12,1.12.2.1 libthread.tex,1.25,1.25.2.1 libtempfile.tex,1.17,1.17.8.1 libtelnetlib.tex,1.9,1.9.8.1 libsys.tex,1.58,1.58.2.1 libstringio.tex,1.6,1.6.20.1 libstring.tex,1.47,1.47.2.1 libstdtypes.tex,1.98,1.98.2.1 libsocksvr.tex,1.14,1.14.24.1 libsocket.tex,1.68,1.68.2.1 libsmtplib.tex,1.22,1.22.2.1 libsite.tex,1.23,1.23.2.1 libsimplexmlrpc.tex,1.3,1.3.8.1 libsignal.tex,1.24,1.24.2.1 libshutil.tex,1.10,1.10.2.1 libshlex.tex,1.12,1.12.20.1 libshelve.tex,1.14,1.14.26.1 librotor.tex,1.19,1.19.2.1 librlcompleter.tex,1.7,1.7.18.1 librfc822.tex,1.40,1.40.2.1 librexec.tex,1.19,1.19.2.1 libreadline.tex,1.8,1.8.12.1 libre.tex,1.84,1.84.2.1 librandom.tex,1.30,1.30.2.1 libqueue.tex,1.12,1.12.2.1 libpyexpat.tex,1.18,1.18.2.1 libpycompile.tex,1.2,1.2.28.1 libposixpath.tex,1.23,1.23.2.1 libpoplib.tex,1.14,1.14.8.1 libpopen2.tex,1.17,1.17.2.1 libpickle.tex,1.36,1.36.2.1 libpdb.tex,1.32,1.32.14.1 libos.tex,1.91,1.91.2.1 liboperator.tex,1.21,1.21.10.1 libobjs.tex,1.10,1.10.10.1 libnntplib.tex,1.27,1.27.12.1 libnetrc.tex,1.8,1.8.24.1 libmultifile.tex,1.11,1.11.24.1 libmimify.tex,1.12,1.12.2.1 libmimewriter.tex,1.2,1.2.28.1 libmimetypes.tex,1.10,1.10.10.1 libmimetools.tex,1.21,1.21.2.1 libmath.tex,1.26,1.26.2.1 libmailbox.tex,1.24,1.24.8.1 liblocale.tex,1.30,1.30.2.1 libimp.tex,1.32,1.32.2.1 libimaplib.tex,1.20,1.20.2.1 libhttplib.tex,1.31,1.31.2.1 libhtmlparser.tex,1.2,1.2.20.1 libhtmllib.tex,1.23,1.23.20.1 libgzip.tex,1.14,1.14.18.1 libgettext.tex,1.12,1.12.2.1 libgc.tex,1.10,1.10.2.1 libfuncs.tex,1.109,1.109.2.1 libfilecmp.tex,1.7,1.7.2.1 libfcntl.tex,1.29,1.29.2.1 libexcs.tex,1.46,1.46.2.1 libdoctest.tex,1.9,1.9.12.1 libdis.tex,1.37,1.37.2.1 libdifflib.tex,1.12,1.12.2.1 libcursespanel.tex,1.3,1.3.10.1 libcurses.tex,1.39,1.39.2.1 libcookie.tex,1.7,1.7.8.1 libcodeop.tex,1.5,1.5.16.1 libcodecs.tex,1.10,1.10.2.1 libcmd.tex,1.12,1.12.2.1 libcgi.tex,1.36,1.36.2.1 libcfgparser.tex,1.22,1.22.2.1 libcalendar.tex,1.15,1.15.2.1 libbsddb.tex,1.7,1.7.2.1 libatexit.tex,1.7,1.7.26.1 libasyncore.tex,1.13,1.13.2.1 libasynchat.tex,1.1,1.1.2.1 lib.tex,1.202,1.202.2.1 emailutil.tex,1.6,1.6.2.1 emailparser.tex,1.5,1.5.2.1 emailmessage.tex,1.5,1.5.2.1 emailiter.tex,1.2,1.2.14.1 emailgenerator.tex,1.3,1.3.10.1 emailexc.tex,1.2,1.2.14.1 emailencoders.tex,1.2,1.2.14.1 email.tex,1.11,1.11.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc/lib Modified Files: Tag: ast-branch xmlsaxutils.tex xmlsaxreader.tex xmlsaxhandler.tex xmlsax.tex xmldomminidom.tex xmldom.tex tkinter.tex markup.tex libzipfile.tex libxreadlines.tex libxmlrpclib.tex libxdrlib.tex libweakref.tex libwarnings.tex libuu.tex libuserdict.tex liburlparse.tex liburllib2.tex liburllib.tex libunittest.tex libunicodedata.tex libundoc.tex libtypes.tex libturtle.tex libtraceback.tex libtime.tex libthreading.tex libthread.tex libtempfile.tex libtelnetlib.tex libsys.tex libstringio.tex libstring.tex libstdtypes.tex libsocksvr.tex libsocket.tex libsmtplib.tex libsite.tex libsimplexmlrpc.tex libsignal.tex libshutil.tex libshlex.tex libshelve.tex librotor.tex librlcompleter.tex librfc822.tex librexec.tex libreadline.tex libre.tex librandom.tex libqueue.tex libpyexpat.tex libpycompile.tex libposixpath.tex libpoplib.tex libpopen2.tex libpickle.tex libpdb.tex libos.tex liboperator.tex libobjs.tex libnntplib.tex libnetrc.tex libmultifile.tex libmimify.tex libmimewriter.tex libmimetypes.tex libmimetools.tex libmath.tex libmailbox.tex liblocale.tex libimp.tex libimaplib.tex libhttplib.tex libhtmlparser.tex libhtmllib.tex libgzip.tex libgettext.tex libgc.tex libfuncs.tex libfilecmp.tex libfcntl.tex libexcs.tex libdoctest.tex libdis.tex libdifflib.tex libcursespanel.tex libcurses.tex libcookie.tex libcodeop.tex libcodecs.tex libcmd.tex libcgi.tex libcfgparser.tex libcalendar.tex libbsddb.tex libatexit.tex libasyncore.tex libasynchat.tex lib.tex emailutil.tex emailparser.tex emailmessage.tex emailiter.tex emailgenerator.tex emailexc.tex emailencoders.tex email.tex Added Files: Tag: ast-branch tzinfo-examples.py required_2.py required_1.py mimelib.tex libtimeit.tex libtarfile.tex libstringprep.tex libsets.tex libpkgutil.tex libossaudiodev.tex liboptparse.tex liblogging.tex libitertools.tex libhotshot.tex libheapq.tex libdummythreading.tex libdummythread.tex libdocxmlrpc.tex libdatetime.tex libcsv.tex libconsts.tex libbz2.tex emailmimebase.tex emailheaders.tex emailcharsets.tex email-unpack.py email-simple.py email-mime.py email-dir.py caseless.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: tzinfo-examples.py --- from datetime import tzinfo, timedelta, datetime ZERO = timedelta(0) HOUR = timedelta(hours=1) # A UTC class. class UTC(tzinfo): """UTC""" def utcoffset(self, dt): return ZERO def tzname(self, dt): return "UTC" def dst(self, dt): return ZERO utc = UTC() # A class building tzinfo objects for fixed-offset time zones. # Note that FixedOffset(0, "UTC") is a different way to build a # UTC tzinfo object. class FixedOffset(tzinfo): """Fixed offset in minutes east from UTC.""" def __init__(self, offset, name): self.__offset = timedelta(minutes = offset) self.__name = name def utcoffset(self, dt): return self.__offset def tzname(self, dt): return self.__name def dst(self, dt): return ZERO # A class capturing the platform's idea of local time. import time as _time STDOFFSET = timedelta(seconds = -_time.timezone) if _time.daylight: DSTOFFSET = timedelta(seconds = -_time.altzone) else: DSTOFFSET = STDOFFSET DSTDIFF = DSTOFFSET - STDOFFSET class LocalTimezone(tzinfo): def utcoffset(self, dt): if self._isdst(dt): return DSTOFFSET else: return STDOFFSET def dst(self, dt): if self._isdst(dt): return DSTDIFF else: return ZERO def tzname(self, dt): return _time.tzname[self._isdst(dt)] def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = _time.mktime(tt) tt = _time.localtime(stamp) return tt.tm_isdst > 0 Local = LocalTimezone() # A complete implementation of current DST rules for major US time zones. def first_sunday_on_or_after(dt): days_to_go = 6 - dt.weekday() if days_to_go: dt += timedelta(days_to_go) return dt # In the US, DST starts at 2am (standard time) on the first Sunday in April. DSTSTART = datetime(1, 4, 1, 2) # and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct. # which is the first Sunday on or after Oct 25. DSTEND = datetime(1, 10, 25, 1) class USTimeZone(tzinfo): def __init__(self, hours, reprname, stdname, dstname): self.stdoffset = timedelta(hours=hours) self.reprname = reprname self.stdname = stdname self.dstname = dstname def __repr__(self): return self.reprname def tzname(self, dt): if self.dst(dt): return self.dstname else: return self.stdname def utcoffset(self, dt): return self.stdoffset + self.dst(dt) def dst(self, dt): if dt is None or dt.tzinfo is None: # An exception may be sensible here, in one or both cases. # It depends on how you want to treat them. The default # fromutc() implementation (called by the default astimezone() # implementation) passes a datetime with dt.tzinfo is self. return ZERO assert dt.tzinfo is self # Find first Sunday in April & the last in October. start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) # Can't compare naive to aware objects, so strip the timezone from # dt first. if start <= dt.replace(tzinfo=None) < end: return HOUR else: return ZERO Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") Central = USTimeZone(-6, "Central", "CST", "CDT") Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") --- NEW FILE: required_2.py --- import optparse class Option (optparse.Option): ATTRS = optparse.Option.ATTRS + ['required'] def _check_required (self): if self.required and not self.takes_value(): raise OptionError( "required flag set for option that doesn't take a value", self) # Make sure _check_required() is called from the constructor! CHECK_METHODS = optparse.Option.CHECK_METHODS + [_check_required] def process (self, opt, value, values, parser): optparse.Option.process(self, opt, value, values, parser) parser.option_seen[self] = 1 class OptionParser (optparse.OptionParser): def _init_parsing_state (self): optparse.OptionParser._init_parsing_state(self) self.option_seen = {} def check_values (self, values, args): for option in self.option_list: if (isinstance(option, Option) and option.required and not self.option_seen.has_key(option)): self.error("%s not supplied" % option) return (values, args) parser = OptionParser(option_list=[ Option("-v", action="count", dest="verbose"), Option("-f", "--file", required=1)]) (options, args) = parser.parse_args() print "verbose:", options.verbose print "file:", options.file --- NEW FILE: required_1.py --- import optparse class OptionParser (optparse.OptionParser): def check_required (self, opt): option = self.get_option(opt) # Assumes the option's 'default' is set to None! if getattr(self.values, option.dest) is None: self.error("%s option not supplied" % option) parser = OptionParser() parser.add_option("-v", action="count", dest="verbose") parser.add_option("-f", "--file", default=None) (options, args) = parser.parse_args() print "verbose:", options.verbose print "file:", options.file parser.check_required("-f") --- NEW FILE: mimelib.tex --- % This document is largely a stub used to allow the email package docs % to be formatted separately from the rest of the Python % documentation. This allows the documentation to be released % independently of the rest of Python since the email package is being % maintained for multiple Python versions, and on an accelerated % schedule. \documentclass{howto} \title{email Package Reference} \author{Barry Warsaw} \authoraddress{\email{barry@zope.com}} \date{\today} \release{2.5} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.5} % major.minor only for software \begin{document} \maketitle \begin{abstract} The \module{email} package provides classes and utilities to create, parse, generate, and modify email messages, conforming to all the relevant email and MIME related RFCs. \end{abstract} % The ugly "%begin{latexonly}" pseudo-environment supresses the table % of contents for HTML generation. % %begin{latexonly} \tableofcontents %end{latexonly} \section{Introduction} The \module{email} package provides classes and utilities to create, parse, generate, and modify email messages, conforming to all the relevant email and MIME related RFCs. This document describes the current version of the \module{email} package, which is available to Python programmers in a number of ways. Python 2.2.2 and 2.3 come with \module{email} version 2, while earlier versions of Python 2.2.x come with \module{email} version 1. Python 2.1.x and earlier do not come with any version of the \module{email} package. The \module{email} package is also available as a standalone distutils package, and is compatible with Python 2.1.3 and beyond. Thus, if you're using Python 2.1.3 you can download the standalone package and install it in your \file{site-packages} directory. The standalone \module{email} package is available on the \ulink{SourceForge \module{mimelib} project}{http://mimelib.sf.net}. The documentation that follows was written for the Python project, so if you're reading this as part of the standalone \module{email} package documentation, there are a few notes to be aware of: \begin{itemize} \item Deprecation and ``version added'' notes are relative to the Python version a feature was added or deprecated. To find out what version of the \module{email} package a particular item was added, changed, or removed, refer to the package's \ulink{\file{NEWS} file}{http://cvs.sf.net/cgi-bin/viewcvs.cgi/mimelib/mimelib/NEWS?rev=1.36&content-type=text/vnd.viewcvs-markup}. \item The code samples are written with Python 2.2 in mind. For Python 2.1.3, some adjustments are necessary. For example, this code snippet; \begin{verbatim} if isinstance(s, str): # ... \end{verbatim} would need to be written this way in Python 2.1.3: \begin{verbatim} from types import StringType # ... if isinstance(s, StringType): # ... \end{verbatim} \item If you're reading this documentation as part of the standalone \module{email} package, some of the internal links to other sections of the Python standard library may not resolve. \end{itemize} \input{email} \end{document} --- NEW FILE: libtimeit.tex --- \section{\module{timeit} --- Measure execution time of small code snippets} \declaremodule{standard}{timeit} \modulesynopsis{Measure the execution time of small code snippets.} \versionadded{2.3} \index{Benchmarking} \index{Performance} This module provides a simple way to time small bits of Python code. It has both command line as well as callable interfaces. It avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the ``Algorithms'' chapter in the \citetitle{Python Cookbook}, published by O'Reilly. The module defines the following public class: \begin{classdesc}{Timer}{\optional{stmt=\code{'pass'} \optional{, setup=\code{'pass'} \optional{, timer=}}}} Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to \code{'pass'}; the timer function is platform-dependent (see the module doc string). The statements may contain newlines, as long as they don't contain multi-line string literals. To measure the execution time of the first statement, use the \method{timeit()} method. The \method{repeat()} method is a convenience to call \method{timeit()} multiple times and return a list of results. \end{classdesc} \begin{methoddesc}{print_exc}{\optional{file=\constant{None}}} Helper to print a traceback from the timed code. Typical use: \begin{verbatim} t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except: t.print_exc() \end{verbatim} The advantage over the standard traceback is that source lines in the compiled template will be displayed. The optional \var{file} argument directs where the traceback is sent; it defaults to \code{sys.stderr}. \end{methoddesc} \begin{methoddesc}{repeat}{\optional{repeat\code{=3}\optional{, number\code{=1000000}}}} Call \method{timeit()} a few times. This is a convenience function that calls the \method{timeit()} repeatedly, returning a list of results. The first argument specifies how many times to call \method{timeit()}. The second argument specifies the \var{number} argument for \function{timeit()}. \begin{notice} It's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run the given code snippet; higher values in the result vector are typically not caused by variability in Python's speed, but by other processes interfering with your timing accuracy. So the \function{min()} of the result is probably the only number you should be interested in. After that, you should look at the entire vector and apply common sense rather than statistics. \end{notice} \end{methoddesc} \begin{methoddesc}{timeit}{\optional{number\code{=1000000}}} Time \var{number} executions of the main statement. This executes the setup statement once, and then returns the time it takes to execute the main statement a number of times, measured in seconds as a float. The argument is the number of times through the loop, defaulting to one million. The main statement, the setup statement and the timer function to be used are passed to the constructor. \end{methoddesc} \subsection{Command Line Interface} When called as a program from the command line, the following form is used: \begin{verbatim} python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} where the following options are understood: \begin{description} \item[-n N/--number=N] how many times to execute 'statement' \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default \code{'pass'}) \item[-t/--time] use \function{time.time()} (default on all platforms but Windows) \item[-c/--clock] use \function{time.clock()} (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits precision \item[-h/--help] print a short usage message and exit \end{description} A multi-line statement may be given by specifying each line as a separate statement argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple \programopt{-s} options are treated similarly. If \programopt{-n} is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds. The default timer function is platform dependent. On Windows, \function{time.clock()} has microsecond granularity but \function{time.time()}'s granularity is 1/60th of a second; on \UNIX, \function{time.clock()} has 1/100th of a second granularity and \function{time.time()} is much more precise. On either platform, the default timer functions measures wall clock time, not the CPU time. This means that other processes running on the same computer may interfere with the timing. The best thing to do when accurate timing is necessary is to repeat the timing a few times and use the best time. The \programopt{-r} option is good for this; the default of 3 repetitions is probably enough in most cases. On \UNIX, you can use \function{time.clock()} to measure CPU time. \begin{notice} There is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should be aware of it. The baseline overhead can be measured by invoking the program without arguments. \end{notice} The baseline overhead differs between Python versions! Also, to fairly compare older Python versions to Python 2.3, you may want to use Python's \programopt{-O} option for the older versions to avoid timing \code{SET_LINENO} instructions. \subsection{Examples} Here are two example sessions (one using the command line, one using the module interface) that compare the cost of using \function{hasattr()} vs. \keyword{try}/\keyword{except} to test for missing and present object attributes. \begin{verbatim} % timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop % timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop % timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop % timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} \begin{verbatim} >>> import timeit >>> s = """\ ... try: ... str.__nonzero__ ... except AttributeError: ... pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 17.09 usec/pass >>> s = """\ ... if hasattr(str, '__nonzero__'): pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 4.85 usec/pass >>> s = """\ ... try: ... int.__nonzero__ ... except AttributeError: ... pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 1.97 usec/pass >>> s = """\ ... if hasattr(int, '__nonzero__'): pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 3.15 usec/pass \end{verbatim} --- NEW FILE: libtarfile.tex --- \section{\module{tarfile} --- Read and write tar archive files} \declaremodule{standard}{tarfile} \modulesynopsis{Read and write tar-format archive files.} \versionadded{2.3} \moduleauthor{Lars Gust\"abel}{lars@gustaebel.de} \sectionauthor{Lars Gust\"abel}{lars@gustaebel.de} The \module{tarfile} module makes it possible to read and create tar archives. Some facts and figures: \begin{itemize} \item reads and writes \module{gzip} and \module{bzip2} compressed archives. \item creates POSIX 1003.1-1990 compliant or GNU tar compatible archives. \item reads GNU tar extensions \emph{longname}, \emph{longlink} and \emph{sparse}. \item stores pathnames of unlimited length using GNU tar extensions. \item handles directories, regular files, hardlinks, symbolic links, fifos, character devices and block devices and is able to acquire and restore file information like timestamp, access permissions and owner. \item can handle tape devices. \end{itemize} \begin{funcdesc}{open}{\optional{name\optional{, mode \optional{, fileobj\optional{, bufsize}}}}} Return a \class{TarFile} object for the pathname \var{name}. For detailed information on \class{TarFile} objects, see \citetitle{TarFile Objects} (section \ref{tarfile-objects}). \var{mode} has to be a string of the form \code{'filemode[:compression]'}, it defaults to \code{'r'}. Here is a full list of mode combinations: \begin{tableii}{c|l}{code}{mode}{action} \lineii{'r'}{Open for reading with transparent compression (recommended).} \lineii{'r:'}{Open for reading exclusively without compression.} \lineii{'r:gz'}{Open for reading with gzip compression.} \lineii{'r:bz2'}{Open for reading with bzip2 compression.} \lineii{'a' or 'a:'}{Open for appending with no compression.} \lineii{'w' or 'w:'}{Open for uncompressed writing.} \lineii{'w:gz'}{Open for gzip compressed writing.} \lineii{'w:bz2'}{Open for bzip2 compressed writing.} \end{tableii} Note that \code{'a:gz'} or \code{'a:bz2'} is not possible. If \var{mode} is not suitable to open a certain (compressed) file for reading, \exception{ReadError} is raised. Use \var{mode} \code{'r'} to avoid this. If a compression method is not supported, \exception{CompressionError} is raised. If \var{fileobj} is specified, it is used as an alternative to a file object opened for \var{name}. For special purposes, there is a second format for \var{mode}: \code{'filemode|[compression]'}. \code{open} will return a \class{TarFile} object that processes its data as a stream of blocks. No random seeking will be done on the file. If given, \var{fileobj} may be any object that has a \code{read()} resp. \code{write()} method. \var{bufsize} specifies the blocksize and defaults to \code{20 * 512} bytes. Use this variant in combination with e.g. \code{sys.stdin}, a socket file object or a tape device. However, such a \class{TarFile} object is limited in that it does not allow to be accessed randomly, see \citetitle{Examples} (section \ref{tar-examples}). The currently possible modes: \begin{tableii}{c|l}{code}{mode}{action} \lineii{'r|'}{Open a \emph{stream} of uncompressed tar blocks for reading.} \lineii{'r|gz'}{Open a gzip compressed \emph{stream} for reading.} \lineii{'r|bz2'}{Open a bzip2 compressed \emph{stream} for reading.} \lineii{'w|'}{Open an uncompressed \emph{stream} for writing.} \lineii{'w|gz'}{Open an gzip compressed \emph{stream} for writing.} \lineii{'w|bz2'}{Open an bzip2 compressed \emph{stream} for writing.} \end{tableii} \end{funcdesc} \begin{classdesc*}{TarFile} Class for reading and writing tar archives. Do not use this class directly, better use \function{open()} instead. See \citetitle{TarFile Objects} (section \ref{tarfile-objects}). \end{classdesc*} \begin{funcdesc}{is_tarfile}{name} Return \code{True} if \var{name} is a tar archive file, that the \module{tarfile} module can read. \end{funcdesc} \begin{classdesc}{TarFileCompat}{filename\optional{, mode\optional{, compression}}} Class for limited access to tar archives with a \code{zipfile}-like interface. Please consult the documentation of \code{zipfile} for more details. \code{compression} must be one of the following constants: \begin{datadesc}{TAR_PLAIN} Constant for an uncompressed tar archive. \end{datadesc} \begin{datadesc}{TAR_GZIPPED} Constant for a \code{gzip} compressed tar archive. \end{datadesc} \end{classdesc} \begin{excdesc}{TarError} Base class for all \module{tarfile} exceptions. \end{excdesc} \begin{excdesc}{ReadError} Is raised when a tar archive is opened, that either cannot be handled by the \module{tarfile} module or is somehow invalid. \end{excdesc} \begin{excdesc}{CompressionError} Is raised when a compression method is not supported or when the data cannot be decoded properly. \end{excdesc} \begin{excdesc}{StreamError} Is raised for the limitations that are typical for stream-like \class{TarFile} objects. \end{excdesc} \begin{excdesc}{ExtractError} Is raised for \emph{non-fatal} errors when using \method{extract()}, but only if \member{TarFile.errorlevel}\code{ == 2}. \end{excdesc} \begin{seealso} \seemodule[module-zipfile]{zipfile}{Documentation of the \code{zipfile} standard module.} \seetitle[http://www.gnu.org/manual/tar/html_chapter/tar_8.html\#SEC118] {GNU tar manual, Standard Section}{Documentation for tar archive files, including GNU tar extensions.} \end{seealso} %----------------- % TarFile Objects %----------------- \subsection{TarFile Objects \label{tarfile-objects}} The \class{TarFile} object provides an interface to a tar archive. A tar archive is a sequence of blocks. An archive member (a stored file) is made up of a header block followed by data blocks. It is possible, to store a file in a tar archive several times. Each archive member is represented by a \class{TarInfo} object, see \citetitle{TarInfo Objects} (section \ref{tarinfo-objects}) for details. \begin{classdesc}{TarFile}{\optional{name \optional{, mode\optional{, fileobj}}}} Open an \emph{(uncompressed)} tar archive \var{name}. \var{mode} is either \code{'r'} to read from an existing archive, \code{'a'} to append data to an existing file or \code{'w'} to create a new file overwriting an existing one. \var{mode} defaults to \code{'r'}. If \var{fileobj} is given, it is used for reading or writing data. If it can be determined, \var{mode} is overridden by \var{fileobj}'s mode. \begin{notice} \var{fileobj} is not closed, when \class{TarFile} is closed. \end{notice} \end{classdesc} \begin{methoddesc}{open}{...} Alternative constructor. The \function{open()} function on module level is actually a shortcut to this classmethod. See section \ref{module-tarfile} for details. \end{methoddesc} \begin{methoddesc}{getmember}{name} Return a \class{TarInfo} object for member \var{name}. If \var{name} can not be found in the archive, \exception{KeyError} is raised. \begin{notice} If a member occurs more than once in the archive, its last occurence is assumed to be the most up-to-date version. \end{notice} \end{methoddesc} \begin{methoddesc}{getmembers}{} Return the members of the archive as a list of \class{TarInfo} objects. The list has the same order as the members in the archive. \end{methoddesc} \begin{methoddesc}{getnames}{} Return the members as a list of their names. It has the same order as the list returned by \method{getmembers()}. \end{methoddesc} \begin{methoddesc}{list}{verbose=True} Print a table of contents to \code{sys.stdout}. If \var{verbose} is \code{False}, only the names of the members are printed. If it is \code{True}, an \code{"ls -l"}-like output is produced. \end{methoddesc} \begin{methoddesc}{next}{} Return the next member of the archive as a \class{TarInfo} object, when \class{TarFile} is opened for reading. Return \code{None} if there is no more available. \end{methoddesc} \begin{methoddesc}{extract}{member\optional{, path}} Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. \var{member} may be a filename or a \class{TarInfo} object. You can specify a different directory using \var{path}. \end{methoddesc} \begin{methoddesc}{extractfile}{member} Extract a member from the archive as a file object. \var{member} may be a filename or a \class{TarInfo} object. If \var{member} is a regular file, a file-like object is returned. If \var{member} is a link, a file-like object is constructed from the link's target. If \var{member} is none of the above, \code{None} is returned. \begin{notice} The file-like object is read-only and provides the following methods: \method{read()}, \method{readline()}, \method{readlines()}, \method{seek()}, \method{tell()}. \end{notice} \end{methoddesc} \begin{methoddesc}{add}{name\optional{, arcname\optional{, recursive=True}}} Add the file \var{name} to the archive. \var{name} may be any type of file (directory, fifo, symbolic link, etc.). If given, \var{arcname} specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting \var{recursive} to \code{False}. \end{methoddesc} \begin{methoddesc}{addfile}{tarinfo\optional{, fileobj}} Add the \class{TarInfo} object \var{tarinfo} to the archive. If \var{fileobj} is given, \code{tarinfo.size} bytes are read from it and added to the archive. You can create \class{TarInfo} objects using \method{gettarinfo()}. \begin{notice} On Windows platforms, \var{fileobj} should always be opened with mode \code{'rb'} to avoid irritation about the file size. \end{notice} \end{methoddesc} \begin{methoddesc}{gettarinfo}{\optional{name\optional{, arcname \optional{, fileobj}}}} Create a \class{TarInfo} object for either the file \var{name} or the file object \var{fileobj} (using \code{os.fstat()} on its file descriptor). You can modify some of the \class{TarInfo}'s attributes before you add it using \method{addfile()}. If given, \var{arcname} specifies an alternative name for the file in the archive. \end{methoddesc} \begin{methoddesc}{close}{} Close the \class{TarFile}. In write-mode, two finishing zero blocks are appended to the archive. \end{methoddesc} \begin{memberdesc}{posix=True} If \code{True}, create a POSIX 1003.1-1990 compliant archive. GNU extensions are not used, because they are not part of the POSIX standard. This limits the length of filenames to at most 256 and linknames to 100 characters. A \exception{ValueError} is raised, if a pathname exceeds this limit. If \code{False}, create a GNU tar compatible archive. It will not be POSIX compliant, but can store pathnames of unlimited length. \end{memberdesc} \begin{memberdesc}{dereference=False} If \code{False}, add symbolic and hard links to archive. If \code{True}, add the content of the target files to the archive. This has no effect on systems that do not support links. \end{memberdesc} \begin{memberdesc}{ignore_zeros=False} If \code{False}, treat an empty block as the end of the archive. If \code{True}, skip empty (and invalid) blocks and try to get as many members as possible. This is only useful for concatenated or damaged archives. \end{memberdesc} \begin{memberdesc}{debug=0} To be set from \code{0}(no debug messages) up to \code{3}(all debug messages). The messages are written to \code{sys.stdout}. \end{memberdesc} \begin{memberdesc}{errorlevel=0} If \code{0}, all errors are ignored when using \method{extract()}. Nevertheless, they appear as error messages in the debug output, when debugging is enabled. If \code{1}, all \emph{fatal} errors are raised as \exception{OSError} or \exception{IOError} exceptions. If \code{2}, all \emph{non-fatal} errors are raised as \exception{TarError} exceptions as well. \end{memberdesc} %----------------- % TarInfo Objects %----------------- \subsection{TarInfo Objects \label{tarinfo-objects}} A \class{TarInfo} object represents one member in a \class{TarFile}. Aside from storing all required attributes of a file (like file type, size, time, permissions, owner etc.), it provides some useful methods to determine its type. It does \emph{not} contain the file's data itself. \class{TarInfo} objects are returned by \code{TarFile}'s methods \code{getmember()}, \code{getmembers()} and \code{gettarinfo()}. \begin{classdesc}{TarInfo}{\optional{name}} Create a \class{TarInfo} object. \end{classdesc} \begin{methoddesc}{frombuf}{} Create and return a \class{TarInfo} object from a string buffer. \end{methoddesc} \begin{methoddesc}{tobuf}{} Create a string buffer from a \class{TarInfo} object. \end{methoddesc} A \code{TarInfo} object has the following public data attributes: \begin{memberdesc}{name} Name of the archive member. \end{memberdesc} \begin{memberdesc}{size} Size in bytes. \end{memberdesc} \begin{memberdesc}{mtime} Time of last modification. \end{memberdesc} \begin{memberdesc}{mode} Permission bits. \end{memberdesc} \begin{memberdesc}{type} File type. \var{type} is usually one of these constants: \code{REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE}. To determine the type of a \class{TarInfo} object more conveniently, use the \code{is_*()} methods below. \end{memberdesc} \begin{memberdesc}{linkname} Name of the target file name, which is only present in \class{TarInfo} objects of type LNKTYPE and SYMTYPE. \end{memberdesc} \begin{memberdesc}{uid, gid} User and group ID of who originally stored this member. \end{memberdesc} \begin{memberdesc}{uname, gname} User and group name. \end{memberdesc} A \class{TarInfo} object also provides some convenient query methods: \begin{methoddesc}{isfile}{} Return \code{True} if the \class{Tarinfo} object is a regular file. \end{methoddesc} \begin{methoddesc}{isreg}{} Same as \method{isfile()}. \end{methoddesc} \begin{methoddesc}{isdir}{} Return \code{True} if it is a directory. \end{methoddesc} \begin{methoddesc}{issym}{} Return \code{True} if it is a symbolic link. \end{methoddesc} \begin{methoddesc}{islnk}{} Return \code{True} if it is a hard link. \end{methoddesc} \begin{methoddesc}{ischr}{} Return \code{True} if it is a character device. \end{methoddesc} \begin{methoddesc}{isblk}{} Return \code{True} if it is a block device. \end{methoddesc} \begin{methoddesc}{isfifo}{} Return \code{True} if it is a FIFO. \end{methoddesc} \begin{methoddesc}{isdev}{} Return \code{True} if it is one of character device, block device or FIFO. \end{methoddesc} %------------------------ % Examples %------------------------ \subsection{Examples \label{tar-examples}} How to create an uncompressed tar archive from a list of filenames: \begin{verbatim} import tarfile tar = tarfile.open("sample.tar", "w") for name in ["foo", "bar", "quux"]: tar.add(name) tar.close() \end{verbatim} How to read a gzip compressed tar archive and display some member information: \begin{verbatim} import tarfile tar = tarfile.open("sample.tar.gz", "r:gz") for tarinfo in tar: print tarinfo.name, "is", tarinfo.size, "bytes in size and is", if tarinfo.isreg(): print "a regular file." elif tarinfo.isdir(): print "a directory." else: print "something else." tar.close() \end{verbatim} How to create a tar archive with faked information: \begin{verbatim} import tarfile tar = tarfile.open("sample.tar.gz", "w:gz") for name in namelist: tarinfo = tar.gettarinfo(name, "fakeproj-1.0/" + name) tarinfo.uid = 123 tarinfo.gid = 456 tarinfo.uname = "johndoe" tarinfo.gname = "fake" tar.addfile(tarinfo, file(name)) tar.close() \end{verbatim} The \emph{only} way to extract an uncompressed tar stream from \code{sys.stdin}: \begin{verbatim} import sys import tarfile tar = tarfile.open(mode="r|", fileobj=sys.stdin) for tarinfo in tar: tar.extract(tarinfo) tar.close() \end{verbatim} --- NEW FILE: libstringprep.tex --- \section{\module{stringprep} --- Internet String Preparation} \declaremodule{standard}{stringprep} \modulesynopsis{String preparation, as per RFC 3453} \moduleauthor{Martin v. L\"owis}{martin@v.loewis.de} \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for ``equality''. Exactly how this comparison is executed may depend on the application domain, e.g. whether it should be case-insensitive or not. It may be also necessary to restrict the possible identifications, to allow only identifications consisting of ``printable'' characters. \rfc{3454} defines a procedure for ``preparing'' Unicode strings in internet protocols. Before passing strings onto the wire, they are processed with the preparation procedure, after which they have a certain normalized form. The RFC defines a set of tables, which can be combined into profiles. Each profile must define which tables it uses, and what other optional parts of the \code{stringprep} procedure are part of the profile. One example of a \code{stringprep} profile is \code{nameprep}, which is used for internationalized domain names. The module \module{stringprep} only exposes the tables from RFC 3454. As these tables would be very large to represent them as dictionaries or lists, the module uses the Unicode character database internally. The module source code itself was generated using the \code{mkstringprep.py} utility. As a result, these tables are exposed as functions, not as data structures. There are two kinds of tables in the RFC: sets and mappings. For a set, \module{stringprep} provides the ``characteristic function'', i.e. a function that returns true if the parameter is part of the set. For mappings, it provides the mapping function: given the key, it returns the associated value. Below is a list of all functions available in the module. \begin{funcdesc}{in_table_a1}{code} Determine whether \var{code} is in table{A.1} (Unassigned code points in Unicode 3.2). \end{funcdesc} \begin{funcdesc}{in_table_b1}{code} Determine whether \var{code} is in table{B.1} (Commonly mapped to nothing). \end{funcdesc} \begin{funcdesc}{map_table_b2}{code} Return the mapped value for \var{code} according to table{B.2} (Mapping for case-folding used with NFKC). \end{funcdesc} \begin{funcdesc}{map_table_b3}{code} Return the mapped value for \var{code} according to table{B.3} (Mapping for case-folding used with no normalization). \end{funcdesc} \begin{funcdesc}{in_table_c11}{code} Determine whether \var{code} is in table{C.1.1} (ASCII space characters). \end{funcdesc} \begin{funcdesc}{in_table_c12}{code} Determine whether \var{code} is in table{C.1.2} (Non-ASCII space characters). \end{funcdesc} \begin{funcdesc}{in_table_c11_c12}{code} Determine whether \var{code} is in table{C.1} (Space characters, union of C.1.1 and C.1.2). \end{funcdesc} \begin{funcdesc}{in_table_c21}{code} Determine whether \var{code} is in table{C.2.1} (ASCII control characters). \end{funcdesc} \begin{funcdesc}{in_table_c22}{code} Determine whether \var{code} is in table{C.2.2} (Non-ASCII control characters). \end{funcdesc} \begin{funcdesc}{in_table_c21_c22}{code} Determine whether \var{code} is in table{C.2} (Control characters, union of C.2.1 and C.2.2). \end{funcdesc} \begin{funcdesc}{in_table_c3}{code} Determine whether \var{code} is in table{C.3} (Private use). \end{funcdesc} \begin{funcdesc}{in_table_c4}{code} Determine whether \var{code} is in table{C.4} (Non-character code points). \end{funcdesc} \begin{funcdesc}{in_table_c5}{code} Determine whether \var{code} is in table{C.5} (Surrogate codes). \end{funcdesc} \begin{funcdesc}{in_table_c6}{code} Determine whether \var{code} is in table{C.6} (Inappropriate for plain text). \end{funcdesc} \begin{funcdesc}{in_table_c7}{code} Determine whether \var{code} is in table{C.7} (Inappropriate for canonical representation). \end{funcdesc} \begin{funcdesc}{in_table_c8}{code} Determine whether \var{code} is in table{C.8} (Change display properties or are deprecated). \end{funcdesc} \begin{funcdesc}{in_table_c9}{code} Determine whether \var{code} is in table{C.9} (Tagging characters). \end{funcdesc} \begin{funcdesc}{in_table_d1}{code} Determine whether \var{code} is in table{D.1} (Characters with bidirectional property ``R'' or ``AL''). \end{funcdesc} \begin{funcdesc}{in_table_d2}{code} Determine whether \var{code} is in table{D.2} (Characters with bidirectional property ``L''). \end{funcdesc} --- NEW FILE: libsets.tex --- \section{\module{sets} --- Unordered collections of unique elements} \declaremodule{standard}{sets} \modulesynopsis{Implementation of sets of unique elements.} \moduleauthor{Greg V. Wilson}{gvwilson@nevex.com} \moduleauthor{Alex Martelli}{aleax@aleax.it} \moduleauthor{Guido van Rossum}{guido@python.org} \sectionauthor{Raymond D. Hettinger}{python@rcn.com} \versionadded{2.3} The \module{sets} module provides classes for constructing and manipulating unordered collections of unique elements. Common uses include membership testing, removing duplicates from a sequence, and computing standard math operations on sets such as intersection, union, difference, and symmetric difference. Like other collections, sets support \code{\var{x} in \var{set}}, \code{len(\var{set})}, and \code{for \var{x} in \var{set}}. Being an unordered collection, sets do not record element position or order of insertion. Accordingly, sets do not support indexing, slicing, or other sequence-like behavior. Most set applications use the \class{Set} class which provides every set method except for \method{__hash__()}. For advanced applications requiring a hash method, the \class{ImmutableSet} class adds a \method{__hash__()} method but omits methods which alter the contents of the set. Both \class{Set} and \class{ImmutableSet} derive from \class{BaseSet}, an abstract class useful for determining whether something is a set: \code{isinstance(\var{obj}, BaseSet)}. The set classes are implemented using dictionaries. As a result, sets cannot contain mutable elements such as lists or dictionaries. However, they can contain immutable collections such as tuples or instances of \class{ImmutableSet}. For convenience in implementing sets of sets, inner sets are automatically converted to immutable form, for example, \code{Set([Set(['dog'])])} is transformed to \code{Set([ImmutableSet(['dog'])])}. \begin{classdesc}{Set}{\optional{iterable}} Constructs a new empty \class{Set} object. If the optional \var{iterable} parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or be transformable to an immutable using the protocol described in section~\ref{immutable-transforms}. \end{classdesc} \begin{classdesc}{ImmutableSet}{\optional{iterable}} Constructs a new empty \class{ImmutableSet} object. If the optional \var{iterable} parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or be transformable to an immutable using the protocol described in section~\ref{immutable-transforms}. Because \class{ImmutableSet} objects provide a \method{__hash__()} method, they can be used as set elements or as dictionary keys. \class{ImmutableSet} objects do not have methods for adding or removing elements, so all of the elements must be known when the constructor is called. \end{classdesc} \subsection{Set Objects \label{set-objects}} Instances of \class{Set} and \class{ImmutableSet} both provide the following operations: \begin{tableii}{c|l}{code}{Operation}{Result} \lineii{len(\var{s})}{cardinality of set \var{s}} \hline \lineii{\var{x} in \var{s}} {test \var{x} for membership in \var{s}} \lineii{\var{x} not in \var{s}} {test \var{x} for non-membership in \var{s}} \lineii{\var{s}.issubset(\var{t})} {test whether every element in \var{s} is in \var{t}; \code{\var{s} <= \var{t}} is equivalent} \lineii{\var{s}.issuperset(\var{t})} {test whether every element in \var{t} is in \var{s}; \code{\var{s} >= \var{t}} is equivalent} \hline \lineii{\var{s} | \var{t}} {new set with elements from both \var{s} and \var{t}} \lineii{\var{s}.union(\var{t})} {new set with elements from both \var{s} and \var{t}} \lineii{\var{s} \&\ \var{t}} {new set with elements common to \var{s} and \var{t}} \lineii{\var{s}.intersection(\var{t})} {new set with elements common to \var{s} and \var{t}} \lineii{\var{s} - \var{t}} {new set with elements in \var{s} but not in \var{t}} \lineii{\var{s}.difference(\var{t})} {new set with elements in \var{s} but not in \var{t}} \lineii{\var{s} \^\ \var{t}} {new set with elements in either \var{s} or \var{t} but not both} \lineii{\var{s}.symmetric_difference(\var{t})} {new set with elements in either \var{s} or \var{t} but not both} \lineii{\var{s}.copy()} {new set with a shallow copy of \var{s}} \end{tableii} In addition, both \class{Set} and \class{ImmutableSet} support set to set comparisons. Two sets are equal if and only if every element of each set is contained in the other (each is a subset of the other). A set is less than another set if and only if the first set is a proper subset of the second set (is a subset, but is not equal). A set is greater than another set if and only if the first set is a proper superset of the second set (is a superset, but is not equal). The subset and equality comparisons do not generalize to a complete ordering function. For example, any two disjoint sets are not equal and are not subsets of each other, so \emph{none} of the following are true: \code{\var{a}<\var{b}}, \code{\var{a}==\var{b}}, or \code{\var{a}>\var{b}}. Accordingly, sets do not implement the \method{__cmp__} method. Since sets only define partial ordering (subset relationships), the output of the \method{list.sort()} method is undefined for lists of sets. The following table lists operations available in \class{ImmutableSet} but not found in \class{Set}: \begin{tableii}{c|l|c}{code}{Operation}{Result} \lineii{hash(\var{s})}{returns a hash value for \var{s}} \end{tableii} The following table lists operations available in \class{Set} but not found in \class{ImmutableSet}: \begin{tableii}{c|l}{code}{Operation}{Result} \lineii{\var{s} |= \var{t}} {return set \var{s} with elements added from \var{t}} \lineii{\var{s}.union_update(\var{t})} {return set \var{s} with elements added from \var{t}} \lineii{\var{s} \&= \var{t}} {return set \var{s} keeping only elements also found in \var{t}} \lineii{\var{s}.intersection_update(\var{t})} {return set \var{s} keeping only elements also found in \var{t}} \lineii{\var{s} -= \var{t}} {return set \var{s} after removing elements found in \var{t}} \lineii{\var{s}.difference_update(\var{t})} {return set \var{s} after removing elements found in \var{t}} \lineii{\var{s} \textasciicircum= \var{t}} {return set \var{s} with elements from \var{s} or \var{t} but not both} \lineii{\var{s}.symmetric_difference_update(\var{t})} {return set \var{s} with elements from \var{s} or \var{t} but not both} \hline \lineii{\var{s}.add(\var{x})} {add element \var{x} to set \var{s}} \lineii{\var{s}.remove(\var{x})} {remove \var{x} from set \var{s}} \lineii{\var{s}.discard(\var{x})} {removes \var{x} from set \var{s} if present} \lineii{\var{s}.pop()} {remove and return an arbitrary element from \var{s}} \lineii{\var{s}.update(\var{t})} {add elements from \var{t} to set \var{s}} \lineii{\var{s}.clear()} {remove all elements from set \var{s}} \end{tableii} \subsection{Example \label{set-example}} \begin{verbatim} >>> from sets import Set >>> engineers = Set(['John', 'Jane', 'Jack', 'Janice']) >>> programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) >>> management = Set(['Jane', 'Jack', 'Susan', 'Zack']) >>> employees = engineers | programmers | management # union >>> engineering_management = engineers & programmers # intersection >>> fulltime_management = management - engineers - programmers # difference >>> engineers.add('Marvin') # add element >>> print engineers Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) >>> employees.issuperset(engineers) # superset test False >>> employees.update(engineers) # update from another set >>> employees.issuperset(engineers) True >>> for group in [engineers, programmers, management, employees]: ... group.discard('Susan') # unconditionally remove element ... print group ... Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) Set(['Janice', 'Jack', 'Sam']) Set(['Jane', 'Zack', 'Jack']) Set(['Jack', 'Sam', 'Jane', 'Marvin', 'Janice', 'John', 'Zack']) \end{verbatim} \subsection{Protocol for automatic conversion to immutable \label{immutable-transforms}} Sets can only contain immutable elements. For convenience, mutable \class{Set} objects are automatically copied to an \class{ImmutableSet} before being added as a set element. The mechanism is to always add a hashable element, or if it is not hashable, the element is checked to see if it has an \method{__as_immutable__()} method which returns an immutable equivalent. Since \class{Set} objects have a \method{__as_immutable__()} method returning an instance of \class{ImmutableSet}, it is possible to construct sets of sets. A similar mechanism is needed by the \method{__contains__()} and \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability and, if not, check for a \method{__as_temporarily_immutable__()} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. The alternate mechanism spares the need to build a separate copy of the original mutable object. \class{Set} objects implement the \method{__as_temporarily_immutable__()} method which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. The two mechanisms for adding hashability are normally invisible to the user; however, a conflict can arise in a multi-threaded environment where one thread is updating a set while another has temporarily wrapped it in \class{_TemporarilyImmutableSet}. In other words, sets of mutable sets are not thread-safe. --- NEW FILE: libpkgutil.tex --- \section{\module{pkgutil} --- Package extension utility} \declaremodule{standard}{pkgutil} \modulesynopsis{Utilities to support extension of packages.} \versionadded{2.3} \begin{notice}[warning] This is an experimental module. It may be withdrawn or completely changed up to an including the release of Python 2.3 beta 1. \end{notice} This module provides a single function: \begin{funcdesc}{extend_path}{path, name} Extend the search path for the modules which comprise a package. Intended use is to place the following code in a package's \file{__init__.py}: \begin{verbatim} from pkgutil import extend_path __path__ = extend_path(__path__, __name__) \end{verbatim} This will add to the package's \code{__path__} all subdirectories of directories on \code{sys.path} named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories. It also looks for \file{*.pkg} files beginning where \code{*} matches the \var{name} argument. This feature is similar to \file{*.pth} files (see the \refmodule{site} module for more information), except that it doesn't special-case lines starting with \code{import}. A \file{*.pkg} file is trusted at face value: apart from checking for duplicates, all entries found in a \file{*.pkg} file are added to the path, regardless of whether they exist the filesystem. (This is a feature.) If the input path is not a list (as is the case for frozen packages) it is returned unchanged. The input path is not modified; an extended copy is returned. Items are only appended to the copy at the end. It is assumed that \code{sys.path} is a sequence. Items of \code{sys.path} that are not (Unicode or 8-bit) strings referring to existing directories are ignored. Unicode items on \code{sys.path} that cause errors when used as filenames may cause this function to raise an exception (in line with \function{os.path.isdir()} behavior). \end{funcdesc} --- NEW FILE: libossaudiodev.tex --- \section{\module{ossaudiodev} --- Access to OSS-compatible audio devices} \declaremodule{builtin}{ossaudiodev} \platform{Linux, FreeBSD} \modulesynopsis{Access to OSS-compatible audio devices.} % XXX OSS is standard for Linux and FreeBSD -- what about NetBSD? % OpenBSD? others? This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and commercial Unices, and is the standard audio interface for Linux (up to kernel 2.4) and FreeBSD. \begin{seealso} \seetitle[http://www.opensound.com/pguide/oss.pdf] {Open Sound System Programmer's Guide} {the official documentation for the OSS C API} \seetext{The module defines a large number of constants supplied by the OSS device driver; see \file{} on either Linux or FreeBSD for a listing .} \end{seealso} \module{ossaudiodev} defines the following variables and functions: \begin{excdesc}{error} This exception is raised on certain errors. The argument is a string describing what went wrong. (If \module{ossaudiodev} receives an error from a system call such as \cfunction{open()}, \cfunction{write()}, or \cfunction{ioctl()}, it raises \exception{IOError}. Errors detected directly by \module{ossaudiodev} result in \exception{ossaudiodev.error}.) \end{excdesc} \begin{funcdesc}{open}{\optional{device, }mode} Open an audio device and return an OSS audio device object. This object supports many file-like methods, such as \method{read()}, \method{write()}, and \method{fileno()} (although there are subtle differences between conventional Unix read/write semantics and those of OSS audio devices). It also supports a number of audio-specific methods; see below for the complete list of methods. Note the unusual calling syntax: the \emph{first} argument is optional, and the second is required. This is a historical artifact for compatibility with the older \module{linuxaudiodev} module which \module{ossaudiodev} supersedes. % XXX it might also be motivated % by my unfounded-but-still-possibly-true belief that the default % audio device varies unpredictably across operating systems. -GW \var{device} is the audio device filename to use. If it is not specified, this module first looks in the environment variable \envvar{AUDIODEV} for a device to use. If not found, it falls back to \file{/dev/dsp}. \var{mode} is one of \code{'r'} for read-only (record) access, \code{'w'} for write-only (playback) access and \code{'rw'} for both. Since many soundcards only allow one process to have the recorder or player open at a time it is a good idea to open the device only for the activity needed. Further, some soundcards are half-duplex: they can be opened for reading or writing, but not both at once. \end{funcdesc} \begin{funcdesc}{openmixer}{\optional{device}} Open a mixer device and return an OSS mixer device object. \var{device} is the mixer device filename to use. If it is not specified, this module first looks in the environment variable \envvar{MIXERDEV} for a device to use. If not found, it falls back to \file{/dev/mixer}. \end{funcdesc} \subsection{Audio Device Objects \label{ossaudio-device-objects}} Setting up the device To set up the device, three functions must be called in the correct sequence: \begin{enumerate} \item \method{setfmt()} to set the output format, \item \method{channels()} to set the number of channels, and \item \method{speed()} to set the sample rate. \end{enumerate} The audio device objects are returned by \function{open()} define the following methods: \begin{methoddesc}[audio device]{close}{} This method explicitly closes the device. It is useful in situations where deleting the object does not immediately close it since there are other references to it. A closed device should not be used again. \end{methoddesc} \begin{methoddesc}[audio device]{fileno}{} Returns the file descriptor associated with the device. \end{methoddesc} \begin{methoddesc}[audio device]{read}{size} Reads \var{size} samples from the audio input and returns them as a Python string. The function blocks until enough data is available. \end{methoddesc} \begin{methoddesc}[audio device]{write}{data} Writes Python string \var{data} to the audio device and returns the number of bytes written. If the audio device is opened in blocking mode, the entire string is always written. If the device is opened in nonblocking mode, some data may not be written---see \method{writeall()}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} Writes the entire Python string \var{data} to the audio device. If the device is opened in blocking mode, behaves identially to \method{write()}; in nonblocking mode, waits until the device becomes available before feeding it more data. Returns \code{None}, since the amount of data written is always equal to the amount of data supplied. \end{methoddesc} Simple IOCTLs: \begin{methoddesc}[audio device]{nonblock}{} Attempts to put the device into nonblocking mode. Once in nonblocking mode there is no way to return to blocking mode. Raises \exception{IOError} if the IOCTL failed. \end{methoddesc} \begin{methoddesc}[audio device]{getfmts}{} Returns a bitmask of the audio output formats supported by the soundcard. On a typical Linux system, these formats are: \begin{tableii}{l|l}{constant}{Format}{Description} \lineii{AFMT_MU_LAW} {a logarithmic encoding. This is the default format on \file{/dev/audio} and is the format used by Sun .au files.} \lineii{AFMT_A_LAW} {a logarithmic encoding} \lineii{AFMT_IMA_ADPCM} {a 4:1 compressed format defined by the Interactive Multimedia Association.} \lineii{AFMT_U8} {Unsigned, 8-bit audio.} \lineii{AFMT_S16_LE} {Unsigned, 16-bit audio, little-endian byte order (as used by Intel processors)} \lineii{AFMT_S16_BE} {Unsigned, 16-bit audio, big-endian byte order (as used by 68k, PowerPC, Sparc)} \lineii{AFMT_S8} {Signed, 8 bit audio.} \lineii{AFMT_U16_LE} {Signed, 16-bit little-endian audio} \lineii{AFMT_U16_BE} {Signed, 16-bit big-endian audio} \end{tableii} Most systems support only a subset of these formats. Many devices only support \constant{AFMT_U8}; the most common format used today is \constant{AFMT_S16_LE}. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} Used to set the current audio format to \var{format}---see \method{getfmts()} for a list. May also be used to return the current audio format---do this by passing an ``audio format'' of \constant{AFMT_QUERY}. Returns the audio format that the device was set to, which may not be the requested format. \end{methoddesc} \begin{methoddesc}[audio device]{channels}{num_channels} Sets the number of output channels to \var{num_channels}. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. Returns the number of channels the device was set to. \end{methoddesc} \begin{methoddesc}[audio device]{speed}{samplerate} Sets the samplerate to \var{samplerate} samples per second and returns the rate actually set. Most sound devices don't support arbitrary sample rates. Common rates are: 8000---default rate 11025---speech recording 22050 44100---Audio CD-quality (at 16 bits/sample and 2 channels) 96000---DVD-quality \end{methoddesc} \begin{methoddesc}[audio device]{sync} Waits until the sound device has played every byte in its buffer and returns. This also occurs when the sound device is closed. The OSS documentation recommends simply closing and re-opening the device rather than using \method{sync()}. \end{methoddesc} \begin{methoddesc}[audio device]{reset} Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends closing and re-opening the device after calling \method{reset()}. \end{methoddesc} \begin{methoddesc}[audio device]{post} To be used like a lightweight \method{sync()}, the \method{post()} IOCTL informs the audio device that there is a likely to be a pause in the audio output---i.e., after playing a spot sound effect, before waiting for user input, or before doing disk I/O. \end{methoddesc} Convenience methods \begin{methoddesc}[audio device]{setparameters}{samplerate,num_channels,format,emulate} Initialise the sound device in one method. \var{samplerate}, \var{channels} and \var{format} should be as specified in the \method{speed()}, \method{channels()} and \method{setfmt()} methods. If \var{emulate} is true, attempt to find the closest matching format instead, otherwise raise ValueError if the device does not support the format. The default is to raise ValueError on unsupported formats. \end{methoddesc} \begin{methoddesc}[audio device]{bufsize}{} Returns the size of the hardware buffer, in samples. \end{methoddesc} \begin{methoddesc}[audio device]{obufcount}{} Returns the number of samples that are in the hardware buffer yet to be played. \end{methoddesc} \begin{methoddesc}[audio device]{obuffree}{} Returns the number of samples that could be queued into the hardware buffer to be played without blocking. \end{methoddesc} \subsection{Mixer Device Objects \label{mixer-device-objects}} File-like interface \begin{methoddesc}[mixer device]{close}{} This method closes the open mixer device file. Any further attempts to use the mixer after this file is closed will raise an IOError. \end{methoddesc} \begin{methoddesc}[mixer device]{fileno}{} Returns the file handle number of the open mixer device file. \end{methoddesc} Mixer interface \begin{methoddesc}[mixer device]{controls}{} This method returns a bitmask specifying the available mixer controls (``Control'' being a specific mixable ``channel'', such as \constant{SOUND_MIXER_PCM} or \constant{SOUND_MIXER_SYNTH}). This bitmask indicates a subset of all available mixer channels---the \constant{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the following Python code: \begin{verbatim} mixer=ossaudiodev.openmixer() if mixer.channels() & (1 << ossaudiodev.SOUND_MIXER_PCM): # PCM is supported \end{verbatim} For most purposes, the \constant{SOUND_MIXER_VOLUME} (Master volume) and \constant{SOUND_MIXER_PCM} channels should suffice---but code that uses the mixer should be flexible when it comes to choosing sound channels. On the Gravis Ultrasound, for example, \constant{SOUND_MIXER_VOLUME} does not exist. \end{methoddesc} \begin{methoddesc}[mixer device]{stereocontrols}{} Returns a bitmask indicating stereo mixer channels. If a bit is set, the corresponding channel is stereo; if it is unset, the channel is either monophonic or not supported by the mixer (use in combination with \method{channels()} to determine which). See the code example for the \method{channels()} function for an example of getting data from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{reccontrols}{} Returns a bitmask specifying the mixer controls that may be used to record. See the code example for \method{controls()} for an example of reading from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{get}{channel} Returns the volume of a given mixer channel. The returned volume is a 2-tuple \code{(left_volume,right_volume)}. Volumes are specified as numbers from 0 (silent) to 100 (full volume). If the channel is monophonic, a 2-tuple is still returned, but both channel volumes are the same. If an unknown channel is specified, \exception{error} is raised. \end{methoddesc} \begin{methoddesc}[mixer device]{set}{channel, (left, right)} Sets the volume for a given mixer channel to \code{(left,right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. Note that this may not be exactly the same as the volume specified, because of the limited resolution of some soundcard's mixers. Raises \exception{IOError} if an invalid mixer channel was specified; \exception{TypeError} if the argument format was incorrect, and \exception{error} if the specified volumes were out-of-range. \end{methoddesc} \begin{methoddesc}[mixer device]{get_recsrc}{} This method returns a bitmask indicating which channel or channels are currently being used as a recording source. \end{methoddesc} \begin{methoddesc}[mixer device]{set_recsrc}{bitmask} Call this function to specify a recording source. Returns a bitmask indicating the new recording source (or sources) if successful; raises \exception{IOError} if an invalid source was specified. To set the current recording source to the microphone input: \begin{verbatim} mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC) \end{verbatim} \end{methoddesc} --- NEW FILE: liboptparse.tex --- \section{\module{optparse} --- Powerful parser for command line options.} \declaremodule{standard}{optparse} \moduleauthor{Greg Ward}{gward@python.net} \sectionauthor{Johannes Gijsbers}{jlgijsbers@users.sf.net} \sectionauthor{Greg Ward}{gward@python.net} \modulesynopsis{Powerful, flexible, extensible, easy-to-use command-line parsing library.} \versionadded{2.3} The \module{optparse} module is a powerful, flexible, extensible, easy-to-use command-line parsing library for Python. Using \module{optparse}, you can add intelligent, sophisticated handling of command-line options to your scripts with very little overhead. Here's an example of using \module{optparse} to add some command-line [...1691 lines suppressed...] Here are a few examples of extending the \module{optparse} module. First, let's change the option-parsing to be case-insensitive: \verbatiminput{caseless.py} And two ways of implementing ``required options'' with \module{optparse}. Version 1: Add a method to \class{OptionParser} which applications must call after parsing arguments: \verbatiminput{required_1.py} Version 2: Extend \class{Option} and add a \member{required} attribute; extend \class{OptionParser} to ensure that required options are present after parsing: \verbatiminput{required_2.py} --- NEW FILE: liblogging.tex --- \section{\module{logging} --- Logging facility for Python} \declaremodule{standard}{logging} % standard library, in Python % These apply to all modules, and may be given more than once: \moduleauthor{Vinay Sajip}{vinay_sajip@red-dove.com} \sectionauthor{Vinay Sajip}{vinay_sajip@red-dove.com} \modulesynopsis{Logging module for Python based on \pep{282}.} \indexii{Errors}{logging} \versionadded{2.3} This module defines functions and classes which implement a flexible error logging system for applications. Logging is performed by calling methods on instances of the [...1072 lines suppressed...] level=NOTSET formatter=form09 args=('localhost:9022', '/log', 'GET') \end{verbatim} Sections which specify formatter configuration are typified by the following. \begin{verbatim} [formatter_form01] format=F1 %(asctime)s %(levelname)s %(message)s datefmt= \end{verbatim} The \code{format} entry is the overall format string, and the \code{datefmt} entry is the \function{strftime()}-compatible date/time format string. If empty, the package substitutes ISO8601 format date/times, which is almost equivalent to specifying the date format string "%Y-%m-%d %H:%M:%S". The ISO8601 format also specifies milliseconds, which are appended to the result of using the above format string, with a comma separator. An example time in ISO8601 format is \code{2003-01-23 00:29:50,411}. --- NEW FILE: libitertools.tex --- \section{\module{itertools} --- Functions creating iterators for efficient looping} \declaremodule{standard}{itertools} \modulesynopsis{Functions creating iterators for efficient looping.} \moduleauthor{Raymond Hettinger}{python@rcn.com} \sectionauthor{Raymond Hettinger}{python@rcn.com} \versionadded{2.3} This module implements a number of iterator building blocks inspired by constructs from the Haskell and SML programming languages. Each has been recast in a form suitable for Python. The module standardizes a core set of fast, memory efficient tools that are useful by themselves or in combination. Standardization helps avoid the readability and reliability problems which arise when many different individuals create their own slightly varying implementations, each with their own quirks and naming conventions. The tools are designed to combine readily with one another. This makes it easy to construct more specialized tools succinctly and efficiently in pure Python. For instance, SML provides a tabulation tool: \code{tabulate(f)} which produces a sequence \code{f(0), f(1), ...}. This toolbox provides \function{imap()} and \function{count()} which can be combined to form \code{imap(f, count())} and produce an equivalent result. Likewise, the functional tools are designed to work well with the high-speed functions provided by the \refmodule{operator} module. The module author welcomes suggestions for other basic building blocks to be added to future versions of the module. Whether cast in pure python form or C code, tools that use iterators are more memory efficient (and faster) than their list based counterparts. Adopting the principles of just-in-time manufacturing, they create data when and where needed instead of consuming memory with the computer equivalent of ``inventory''. The performance advantage of iterators becomes more acute as the number of elements increases -- at some point, lists grow large enough to to severely impact memory cache performance and start running slowly. \begin{seealso} \seetext{The Standard ML Basis Library, \citetitle[http://www.standardml.org/Basis/] {The Standard ML Basis Library}.} \seetext{Haskell, A Purely Functional Language, \citetitle[http://www.haskell.org/definition/] {Definition of Haskell and the Standard Libraries}.} \end{seealso} \subsection{Itertool functions \label{itertools-functions}} The following module functions all construct and return iterators. Some provide streams of infinite length, so they should only be accessed by functions or loops that truncate the stream. \begin{funcdesc}{chain}{*iterables} Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence. Equivalent to: \begin{verbatim} def chain(*iterables): for it in iterables: for element in it: yield element \end{verbatim} \end{funcdesc} \begin{funcdesc}{count}{\optional{n}} Make an iterator that returns consecutive integers starting with \var{n}. Does not currently support python long integers. Often used as an argument to \function{imap()} to generate consecutive data points. Also, used in \function{izip()} to add sequence numbers. Equivalent to: \begin{verbatim} def count(n=0): while True: yield n n += 1 \end{verbatim} Note, \function{count()} does not check for overflow and will return negative numbers after exceeding \code{sys.maxint}. This behavior may change in the future. \end{funcdesc} \begin{funcdesc}{cycle}{iterable} Make an iterator returning elements from the iterable and saving a copy of each. When the iterable is exhausted, return elements from the saved copy. Repeats indefinitely. Equivalent to: \begin{verbatim} def cycle(iterable): saved = [] for element in iterable: yield element saved.append(element) if len(saved) == 0: return while True: for element in saved: yield element \end{verbatim} Note, this is the only member of the toolkit that may require significant auxiliary storage (depending on the length of the iterable). \end{funcdesc} \begin{funcdesc}{dropwhile}{predicate, iterable} Make an iterator that drops elements from the iterable as long as the predicate is true; afterwards, returns every element. Note, the iterator does not produce \emph{any} output until the predicate is true, so it may have a lengthy start-up time. Equivalent to: \begin{verbatim} def dropwhile(predicate, iterable): iterable = iter(iterable) while True: x = iterable.next() if predicate(x): continue # drop when predicate is true yield x break while True: yield iterable.next() \end{verbatim} \end{funcdesc} \begin{funcdesc}{ifilter}{predicate, iterable} Make an iterator that filters elements from iterable returning only those for which the predicate is \code{True}. If \var{predicate} is \code{None}, return the items that are true. Equivalent to: \begin{verbatim} def ifilter(predicate, iterable): if predicate is None: def predicate(x): return x for x in iterable: if predicate(x): yield x \end{verbatim} \end{funcdesc} \begin{funcdesc}{ifilterfalse}{predicate, iterable} Make an iterator that filters elements from iterable returning only those for which the predicate is \code{False}. If \var{predicate} is \code{None}, return the items that are false. Equivalent to: \begin{verbatim} def ifilterfalse(predicate, iterable): if predicate is None: def predicate(x): return x for x in iterable: if not predicate(x): yield x \end{verbatim} \end{funcdesc} \begin{funcdesc}{imap}{function, *iterables} Make an iterator that computes the function using arguments from each of the iterables. If \var{function} is set to \code{None}, then \function{imap()} returns the arguments as a tuple. Like \function{map()} but stops when the shortest iterable is exhausted instead of filling in \code{None} for shorter iterables. The reason for the difference is that infinite iterator arguments are typically an error for \function{map()} (because the output is fully evaluated) but represent a common and useful way of supplying arguments to \function{imap()}. Equivalent to: \begin{verbatim} def imap(function, *iterables): iterables = map(iter, iterables) while True: args = [i.next() for i in iterables] if function is None: yield tuple(args) else: yield function(*args) \end{verbatim} \end{funcdesc} \begin{funcdesc}{islice}{iterable, \optional{start,} stop \optional{, step}} Make an iterator that returns selected elements from the iterable. If \var{start} is non-zero, then elements from the iterable are skipped until start is reached. Afterward, elements are returned consecutively unless \var{step} is set higher than one which results in items being skipped. If \var{stop} is specified, then iteration stops at the specified element position; otherwise, it continues indefinitely or until the iterable is exhausted. Unlike regular slicing, \function{islice()} does not support negative values for \var{start}, \var{stop}, or \var{step}. Can be used to extract related fields from data where the internal structure has been flattened (for example, a multi-line report may list a name field on every third line). Equivalent to: \begin{verbatim} def islice(iterable, *args): s = slice(*args) next = s.start or 0 stop = s.stop step = s.step or 1 for cnt, element in enumerate(iterable): if cnt < next: continue if cnt >= stop: break yield element next += step \end{verbatim} \end{funcdesc} \begin{funcdesc}{izip}{*iterables} Make an iterator that aggregates elements from each of the iterables. Like \function{zip()} except that it returns an iterator instead of a list. Used for lock-step iteration over several iterables at a time. Equivalent to: \begin{verbatim} def izip(*iterables): iterables = map(iter, iterables) while True: result = [i.next() for i in iterables] yield tuple(result) \end{verbatim} \end{funcdesc} \begin{funcdesc}{repeat}{object\optional{, times}} Make an iterator that returns \var{object} over and over again. Runs indefinitely unless the \var{times} argument is specified. Used as argument to \function{imap()} for invariant parameters to the called function. Also used with \function{izip()} to create an invariant part of a tuple record. Equivalent to: \begin{verbatim} def repeat(object, times=None): if times is None: while True: yield object else: for i in xrange(times): yield object \end{verbatim} \end{funcdesc} \begin{funcdesc}{starmap}{function, iterable} Make an iterator that computes the function using arguments tuples obtained from the iterable. Used instead of \function{imap()} when argument parameters are already grouped in tuples from a single iterable (the data has been ``pre-zipped''). The difference between \function{imap()} and \function{starmap()} parallels the distinction between \code{function(a,b)} and \code{function(*c)}. Equivalent to: \begin{verbatim} def starmap(function, iterable): iterable = iter(iterable) while True: yield function(*iterable.next()) \end{verbatim} \end{funcdesc} \begin{funcdesc}{takewhile}{predicate, iterable} Make an iterator that returns elements from the iterable as long as the predicate is true. Equivalent to: \begin{verbatim} def takewhile(predicate, iterable): iterable = iter(iterable) while True: x = iterable.next() if predicate(x): yield x else: break \end{verbatim} \end{funcdesc} \subsection{Examples \label{itertools-example}} The following examples show common uses for each tool and demonstrate ways they can be combined. \begin{verbatim} >>> amounts = [120.15, 764.05, 823.14] >>> for checknum, amount in izip(count(1200), amounts): ... print 'Check %d is for $%.2f' % (checknum, amount) ... Check 1200 is for $120.15 Check 1201 is for $764.05 Check 1202 is for $823.14 >>> import operator >>> for cube in imap(operator.pow, xrange(1,4), repeat(3)): ... print cube ... 1 8 27 >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] >>> for name in islice(reportlines, 3, len(reportlines), 2): ... print name.title() ... Alex Laura Martin Walter Samuele \end{verbatim} This section has further examples of how itertools can be combined. Note that \function{enumerate()} and \method{iteritems()} already have highly efficient implementations in Python. They are only included here to illustrate how higher level tools can be created from building blocks. \begin{verbatim} >>> def enumerate(iterable): ... return izip(count(), iterable) >>> def tabulate(function): ... "Return function(0), function(1), ..." ... return imap(function, count()) >>> def iteritems(mapping): ... return izip(mapping.iterkeys(), mapping.itervalues()) >>> def nth(iterable, n): ... "Returns the nth item" ... return list(islice(iterable, n, n+1)) >>> def all(pred, seq): ... "Returns True if pred(x) is True for every element in the iterable" ... return not nth(ifilterfalse(pred, seq), 0) >>> def some(pred, seq): ... "Returns True if pred(x) is True at least one element in the iterable" ... return bool(nth(ifilter(pred, seq), 0)) >>> def no(pred, seq): ... "Returns True if pred(x) is False for every element in the iterable" ... return not nth(ifilter(pred, seq), 0) >>> def pairwise(seq): ... "s -> (s0,s1), (s1,s2), (s2, s3), ..." ... return izip(seq, islice(seq,1,len(seq))) >>> def padnone(seq): ... "Returns the sequence elements and then returns None indefinitely" ... return chain(seq, repeat(None)) >>> def ncycles(seq, n): ... "Returns the sequence elements n times" ... return chain(*repeat(seq, n)) >>> def dotproduct(vec1, vec2): ... return sum(imap(operator.mul, vec1, vec2)) \end{verbatim} --- NEW FILE: libhotshot.tex --- \section{\module{hotshot} --- High performance logging profiler} \declaremodule{standard}{hotshot} \modulesynopsis{High performance logging profiler, mostly written in C.} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} \versionadded{2.2} This module provides a nicer interface to the \module{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's written mostly in C, it should result in a much smaller performance impact than the existing \refmodule{profile} module. \begin{classdesc}{Profile}{logfile\optional{, lineevents\code{=0}\optional{, linetimings\code{=1}}}} The profiler object. The argument \var{logfile} is the name of a log file to use for logged profile data. The argument \var{lineevents} specifies whether to generate events for every source line, or just on function call/return. It defaults to \code{0} (only log function call/return). The argument \var{linetimings} specifies whether to record timing information. It defaults to \code{1} (store timing information). \end{classdesc} \subsection{Profile Objects \label{hotshot-objects}} Profile objects have the following methods: \begin{methoddesc}{addinfo}{key, value} Add an arbitrary labelled value to the profile output. \end{methoddesc} \begin{methoddesc}{close}{} Close the logfile and terminate the profiler. \end{methoddesc} \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. \end{methoddesc} \begin{methoddesc}{run}{cmd} Profile an \keyword{exec}-compatible string in the script environment. The globals from the \refmodule[main]{__main__} module are used as both the globals and locals for the script. \end{methoddesc} \begin{methoddesc}{runcall}{func, *args, **keywords} Profile a single call of a callable. Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are allowed to propogate cleanly, while ensuring that profiling is disabled on the way out. \end{methoddesc} \begin{methoddesc}{runctx}{cmd, globals, locals} Evaluate an \keyword{exec}-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} \begin{methoddesc}{start}{} Start the profiler. \end{methoddesc} \begin{methoddesc}{stop}{} Stop the profiler. \end{methoddesc} \subsection{Using hotshot data} \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} \seemodule{profile}{The \module{profile} module's \class{Stats} class} \end{seealso} \subsection{Example Usage \label{hotshot-example}} Note that this example runs the python ``benchmark'' pystones. It can take some time to run, and will produce large output files. \begin{verbatim} >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") >>> benchtime, stones = prof.runcall(test.pystone.pystones) >>> prof.close() >>> stats = hotshot.stats.load("stones.prof") >>> stats.strip_dirs() >>> stats.sort_stats('time', 'calls') >>> stats.print_stats(20) 850004 function calls in 10.090 CPU seconds Ordered by: internal time, call count ncalls tottime percall cumtime percall filename:lineno(function) 1 3.295 3.295 10.090 10.090 pystone.py:79(Proc0) 150000 1.315 0.000 1.315 0.000 pystone.py:203(Proc7) 50000 1.313 0.000 1.463 0.000 pystone.py:229(Func2) . . . \end{verbatim} --- NEW FILE: libheapq.tex --- \section{\module{heapq} --- Heap queue algorithm} \declaremodule{standard}{heapq} \modulesynopsis{Heap queue algorithm (a.k.a. priority queue).} \moduleauthor{Kevin O'Connor}{} \sectionauthor{Guido van Rossum}{guido@python.org} % Theoretical explanation: \sectionauthor{Fran\c cois Pinard}{} \versionadded{2.3} This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm. Heaps are arrays for which \code{\var{heap}[\var{k}] <= \var{heap}[2*\var{k}+1]} and \code{\var{heap}[\var{k}] <= \var{heap}[2*\var{k}+2]} for all \var{k}, counting elements from zero. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that \code{\var{heap}[0]} is always its smallest element. The API below differs from textbook heap algorithms in two aspects: (a) We use zero-based indexing. This makes the relationship between the index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses zero-based indexing. (b) Our pop method returns the smallest item, not the largest (called a "min heap" in textbooks; a "max heap" is more common in texts because of its suitability for in-place sorting). These two make it possible to view the heap as a regular Python list without surprises: \code{\var{heap}[0]} is the smallest item, and \code{\var{heap}.sort()} maintains the heap invariant! To create a heap, use a list initialized to \code{[]}, or you can transform a populated list into a heap via function \function{heapify()}. The following functions are provided: \begin{funcdesc}{heappush}{heap, item} Push the value \var{item} onto the \var{heap}, maintaining the heap invariant. \end{funcdesc} \begin{funcdesc}{heappop}{heap} Pop and return the smallest item from the \var{heap}, maintaining the heap invariant. If the heap is empty, \exception{IndexError} is raised. \end{funcdesc} \begin{funcdesc}{heapify}{x} Transform list \var{x} into a heap, in-place, in linear time. \end{funcdesc} \begin{funcdesc}{heapreplace}{heap, item} Pop and return the smallest item from the \var{heap}, and also push the new \var{item}. The heap size doesn't change. If the heap is empty, \exception{IndexError} is raised. This is more efficient than \function{heappop()} followed by \function{heappush()}, and can be more appropriate when using a fixed-size heap. Note that the value returned may be larger than \var{item}! That constrains reasonable uses of this routine. \end{funcdesc} Example of use: \begin{verbatim} >>> from heapq import heappush, heappop >>> heap = [] >>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] >>> for item in data: ... heappush(heap, item) ... >>> sorted = [] >>> while heap: ... sorted.append(heappop(heap)) ... >>> print sorted [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> data.sort() >>> print data == sorted True >>> \end{verbatim} \subsection{Theory} (This explanation is due to François Pinard. The Python code for this module was contributed by Kevin O'Connor.) Heaps are arrays for which \code{a[\var{k}] <= a[2*\var{k}+1]} and \code{a[\var{k}] <= a[2*\var{k}+2]} for all \var{k}, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that \code{a[0]} is always its smallest element. The strange invariant above is meant to be an efficient memory representation for a tournament. The numbers below are \var{k}, not \code{a[\var{k}]}: \begin{verbatim} 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 \end{verbatim} In the tree above, each cell \var{k} is topping \code{2*\var{k}+1} and \code{2*\var{k}+2}. In an usual binary tournament we see in sports, each cell is the winner over the two cells it tops, and we can trace the winner down the tree to see all opponents s/he had. However, in many computer applications of such tournaments, we do not need to trace the history of a winner. To be more memory efficient, when a winner is promoted, we try to replace it by something else at a lower level, and the rule becomes that a cell and the two cells it tops contain three different items, but the top cell "wins" over the two topped cells. If this heap invariant is protected at all time, index 0 is clearly the overall winner. The simplest algorithmic way to remove it and find the "next" winner is to move some loser (let's say cell 30 in the diagram above) into the 0 position, and then percolate this new 0 down the tree, exchanging values, until the invariant is re-established. This is clearly logarithmic on the total number of items in the tree. By iterating over all items, you get an O(n log n) sort. A nice feature of this sort is that you can efficiently insert new items while the sort is going on, provided that the inserted items are not "better" than the last 0'th element you extracted. This is especially useful in simulation contexts, where the tree holds all incoming events, and the "win" condition means the smallest scheduled time. When an event schedule other events for execution, they are scheduled into the future, so they can easily go into the heap. So, a heap is a good structure for implementing schedulers (this is what I used for my MIDI sequencer :-). Various structures for implementing schedulers have been extensively studied, and heaps are good for this, as they are reasonably speedy, the speed is almost constant, and the worst case is not much different than the average case. However, there are other representations which are more efficient overall, yet the worst cases might be terrible. Heaps are also very useful in big disk sorts. You most probably all know that a big sort implies producing "runs" (which are pre-sorted sequences, which size is usually related to the amount of CPU memory), followed by a merging passes for these runs, which merging is often very cleverly organised\footnote{The disk balancing algorithms which are current, nowadays, are more annoying than clever, and this is a consequence of the seeking capabilities of the disks. On devices which cannot seek, like big tape drives, the story was quite different, and one had to be very clever to ensure (far in advance) that each tape movement will be the most effective possible (that is, will best participate at "progressing" the merge). Some tapes were even able to read backwards, and this was also used to avoid the rewinding time. Believe me, real good tape sorts were quite spectacular to watch! >From all times, sorting has always been a Great Art! :-)}. It is very important that the initial sort produces the longest runs possible. Tournaments are a good way to that. If, using all the memory available to hold a tournament, you replace and percolate items that happen to fit the current run, you'll produce runs which are twice the size of the memory for random input, and much better for input fuzzily ordered. Moreover, if you output the 0'th item on disk and get an input which may not fit in the current tournament (because the value "wins" over the last output value), it cannot fit in the heap, so the size of the heap decreases. The freed memory could be cleverly reused immediately for progressively building a second heap, which grows at exactly the same rate the first heap is melting. When the first heap completely vanishes, you switch heaps and start a new run. Clever and quite effective! In a word, heaps are useful memory structures to know. I use them in a few applications, and I think it is good to keep a `heap' module around. :-) --- NEW FILE: libdummythreading.tex --- \section{\module{dummy_threading} --- Drop-in replacement for the \module{threading} module} \declaremodule[dummythreading]{standard}{dummy_threading} \modulesynopsis{Drop-in replacement for the \refmodule{threading} module.} This module provides a duplicate interface to the \refmodule{threading} module. It is meant to be imported when the \refmodule{thread} module is not provided on a platform. Suggested usage is: \begin{verbatim} try: import threading as _threading except ImportError: import dummy_threading as _threading \end{verbatim} Be careful to not use this module where deadlock might occur from a thread being created that blocks waiting for another thread to be created. This often occurs with blocking I/O. --- NEW FILE: libdummythread.tex --- \section{\module{dummy_thread} --- Drop-in replacement for the \module{thread} module} \declaremodule[dummythread]{standard}{dummy_thread} \modulesynopsis{Drop-in replacement for the \refmodule{thread} module.} This module provides a duplicate interface to the \refmodule{thread} module. It is meant to be imported when the \refmodule{thread} module is not provided on a platform. Suggested usage is: \begin{verbatim} try: import thread as _thread except ImportError: import dummy_thread as _thread \end{verbatim} Be careful to not use this module where deadlock might occur from a thread being created that blocks waiting for another thread to be created. This often occurs with blocking I/O. --- NEW FILE: libdocxmlrpc.tex --- \section{\module{DocXMLRPCServer} --- Self-documenting XML-RPC server} \declaremodule{standard}{DocXMLRPCServer} \modulesynopsis{Self-documenting XML-RPC server implementation.} \moduleauthor{Brian Quinlan}{brianq@activestate.com} \sectionauthor{Brian Quinlan}{brianq@activestate.com} \versionadded{2.3} The \module{DocXMLRPCServer} module extends the classes found in \module{SimpleXMLRPCServer} to serve HTML documentation in response to HTTP GET requests. Servers can either be free standing, using \class{DocXMLRPCServer}, or embedded in a CGI environment, using \class{DocCGIXMLRPCRequestHandler}. \begin{classdesc}{DocXMLRPCServer}{addr\optional{, requestHandler\optional{, logRequests}}} Create a new server instance. All parameters have the same meaning as for \class{SimpleXMLRPCServer.SimpleXMLRPCServer}; \var{requestHandler} defaults to \class{DocXMLRPCRequestHandler}. \end{classdesc} \begin{classdesc}{DocCGIXMLRPCRequestHandler}{} Create a new instance to handle XML-RPC requests in a CGI environment. \end{classdesc} \begin{classdesc}{DocXMLRPCRequestHandler}{} Create a new request handler instance. This request handler supports XML-RPC POST requests, documentation GET requests, and modifies logging so that the \var{logRequests} parameter to the \class{DocXMLRPCServer} constructor parameter is honored. \end{classdesc} \subsection{DocXMLRPCServer Objects \label{doc-xmlrpc-servers}} The \class{DocXMLRPCServer} class is derived from \class{SimpleXMLRPCServer.SimpleXMLRPCServer} and provides a means of creating self-documenting, stand alone XML-RPC servers. HTTP POST requests are handled as XML-RPC method calls. HTTP GET requests are handled by generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. \begin{methoddesc}{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} \begin{methoddesc}{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" element. \end{methoddesc} \begin{methoddesc}{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the documentation. \end{methoddesc} \subsection{DocCGIXMLRPCRequestHandler} The \class{DocCGIXMLRPCRequestHandler} class is derived from \class{SimpleXMLRPCServer.CGIXMLRPCRequestHandler} and provides a means of creating self-documenting, XML-RPC CGI scripts. HTTP POST requests are handled as XML-RPC method calls. HTTP GET requests are handled by generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. \begin{methoddesc}{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} \begin{methoddesc}{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" element. \end{methoddesc} \begin{methoddesc}{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the documentation. \end{methoddesc} --- NEW FILE: libdatetime.tex --- % XXX what order should the types be discussed in? \section{\module{datetime} --- Basic date and time types} \declaremodule{builtin}{datetime} \modulesynopsis{Basic date and time types.} \moduleauthor{Tim Peters}{tim@zope.com} \sectionauthor{Tim Peters}{tim@zope.com} \sectionauthor{A.M. Kuchling}{amk@amk.ca} \versionadded{2.3} The \module{datetime} module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient member extraction for output formatting and manipulation. [...1415 lines suppressed...] return ints: For \class{date} and \class{datetime} instances: PyDateTime_GET_YEAR(o) PyDateTime_GET_MONTH(o) PyDateTime_GET_DAY(o) For \class{datetime} instances: PyDateTime_DATE_GET_HOUR(o) PyDateTime_DATE_GET_MINUTE(o) PyDateTime_DATE_GET_SECOND(o) PyDateTime_DATE_GET_MICROSECOND(o) For \class{time} instances: PyDateTime_TIME_GET_HOUR(o) PyDateTime_TIME_GET_MINUTE(o) PyDateTime_TIME_GET_SECOND(o) PyDateTime_TIME_GET_MICROSECOND(o) \end{comment} --- NEW FILE: libcsv.tex --- \section{\module{csv} --- CSV File Reading and Writing} \declaremodule{standard}{csv} \modulesynopsis{Write and read tabular data to and from delimited files.} \versionadded{2.3} \index{csv} \indexii{data}{tabular} The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. There is no ``CSV standard'', so the format is operationally defined by the many applications which read and write it. The lack of a standard means that subtle differences often exist in the data produced and consumed by different applications. These differences can make it annoying to process CSV files from multiple sources. Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer. The \module{csv} module implements classes to read and write tabular data in CSV format. It allows programmers to say, ``write this data in the format preferred by Excel,'' or ``read data from this file which was generated by Excel,'' without knowing the precise details of the CSV format used by Excel. Programmers can also describe the CSV formats understood by other applications or define their own special-purpose CSV formats. The \module{csv} module's \class{reader} and \class{writer} objects read and write sequences. Programmers can also read and write data in dictionary form using the \class{DictReader} and \class{DictWriter} classes. \note{The first version of the \module{csv} module doesn't support Unicode input. Also, there are currently some issues regarding \ASCII{} NUL characters. Accordingly, all input should generally be plain \ASCII{} to be safe. These restrictions will be removed in the future.} \begin{seealso} % \seemodule{array}{Arrays of uniformly types numeric values.} \seepep{305}{CSV File API} {The Python Enhancement Proposal which proposed this addition to Python.} \end{seealso} \subsection{Module Contents} The \module{csv} module defines the following functions: \begin{funcdesc}{reader}{csvfile\optional{, dialect=\code{'excel'}\optional{, fmtparam}}} Return a reader object which will iterate over lines in the given {}\var{csvfile}. \var{csvfile} can be any object which supports the iterator protocol and returns a string each time its \method{next} method is called. An optional \var{dialect} parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the \class{Dialect} class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual formatting parameters in the current dialect. For more information about the dialect and formatting parameters, see section~\ref{fmt-params}, ``Dialects and Formatting Parameters'' for details of these parameters. All data read are returned as strings. No automatic data type conversion is performed. \end{funcdesc} \begin{funcdesc}{writer}{csvfile\optional{, dialect=\code{'excel'}\optional{, fmtparam}}} Return a writer object responsible for converting the user's data into delimited strings on the given file-like object. An optional {}\var{dialect} parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the \class{Dialect} class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual formatting parameters in the current dialect. For more information about the dialect and formatting parameters, see section~\ref{fmt-params}, ``Dialects and Formatting Parameters'' for details of these parameters. To make it as easy as possible to interface with modules which implement the DB API, the value \constant{None} is written as the empty string. While this isn't a reversible transformation, it makes it easier to dump SQL NULL data values to CSV files without preprocessing the data returned from a \code{cursor.fetch*()} call. All other non-string data are stringified with \function{str()} before being written. \end{funcdesc} \begin{funcdesc}{register_dialect}{name, dialect} Associate \var{dialect} with \var{name}. \var{dialect} must be a subclass of \class{csv.Dialect}. \var{name} must be a string or Unicode object. \end{funcdesc} \begin{funcdesc}{unregister_dialect}{name} Delete the dialect associated with \var{name} from the dialect registry. An \exception{Error} is raised if \var{name} is not a registered dialect name. \end{funcdesc} \begin{funcdesc}{get_dialect}{name} Return the dialect associated with \var{name}. An \exception{Error} is raised if \var{name} is not a registered dialect name. \end{funcdesc} \begin{funcdesc}{list_dialects}{} Return the names of all registered dialects. \end{funcdesc} The \module{csv} module defines the following classes: \begin{classdesc}{DictReader}{csvfile, fieldnames\optional{, restkey=\code{None}\optional{, restval=\code{None}\optional{, dialect=\code{'excel'}\optional{, fmtparam}}}}} Create an object which operates like a regular reader but maps the information read into a dict whose keys are given by the \var{fieldnames} parameter. If the row read has fewer fields than the fieldnames sequence, the value of \var{restval} will be used as the default value. If the row read has more fields than the fieldnames sequence, the remaining data is added as a sequence keyed by the value of \var{restkey}. If the row read has fewer fields than the fieldnames sequence, the remaining keys take the value of the optiona \var{restval} parameter. All other parameters are interpreted as for regular readers. \end{classdesc} \begin{classdesc}{DictWriter}{csvfile, fieldnames\optional{, restval=""\optional{, extrasaction=\code{'raise'}\optional{, dialect=\code{'excel'}\optional{, fmtparam}}}}} Create an object which operates like a regular writer but maps dictionaries onto output rows. The \var{fieldnames} parameter identifies the order in which values in the dictionary passed to the \method{writerow()} method are written to the \var{csvfile}. The optional \var{restval} parameter specifies the value to be written if the dictionary is missing a key in \var{fieldnames}. If the dictionary passed to the \method{writerow()} method contains a key not found in \var{fieldnames}, the optional \var{extrasaction} parameter indicates what action to take. If it is set to \code{'raise'} a \exception{ValueError} is raised. If it is set to \code{'ignore'}, extra values in the dictionary are ignored. All other parameters are interpreted as for regular writers. \end{classdesc} \begin{classdesc*}{Dialect}{} The \class{Dialect} class is a container class relied on primarily for its attributes, which are used to define the parameters for a specific \class{reader} or \class{writer} instance. Dialect objects support the following data attributes: \begin{memberdesc}[string]{delimiter} A one-character string used to separate fields. It defaults to \code{","}. \end{memberdesc} \begin{memberdesc}[boolean]{doublequote} Controls how instances of \var{quotechar} appearing inside a field should be themselves be quoted. When \constant{True}, the character is doubledd. When \constant{False}, the \var{escapechar} must be a one-character string which is used as a prefix to the \var{quotechar}. It defaults to \constant{True}. \end{memberdesc} \begin{memberdesc}{escapechar} A one-character string used to escape the \var{delimiter} if \var{quoting} is set to \constant{QUOTE_NONE}. It defaults to \constant{None}. \end{memberdesc} \begin{memberdesc}[string]{lineterminator} The string used to terminate lines in the CSV file. It defaults to \code{"\e r\e n"}. \end{memberdesc} \begin{memberdesc}[string]{quotechar} A one-character string used to quote elements containing the \var{delimiter} or which start with the \var{quotechar}. It defaults to \code{'"'}. \end{memberdesc} \begin{memberdesc}[integer]{quoting} Controls when quotes should be generated by the writer. It can take on any of the \code{QUOTE_*} constants defined below and defaults to \constant{QUOTE_MINIMAL}. \end{memberdesc} \begin{memberdesc}[boolean]{skipinitialspace} When \constant{True}, whitespace immediately following the \var{delimiter} is ignored. The default is \constant{False}. \end{memberdesc} \end{classdesc*} The \module{csv} module defines the following constants: \begin{datadesc}{QUOTE_ALWAYS} Instructs \class{writer} objects to quote all fields. \end{datadesc} \begin{datadesc}{QUOTE_MINIMAL} Instructs \class{writer} objects to only quote those fields which contain the current \var{delimiter} or begin with the current \var{quotechar}. \end{datadesc} \begin{datadesc}{QUOTE_NONNUMERIC} Instructs \class{writer} objects to quote all non-numeric fields. \end{datadesc} \begin{datadesc}{QUOTE_NONE} Instructs \class{writer} objects to never quote fields. When the current \var{delimiter} occurs in output data it is preceded by the current \var{escapechar} character. When \constant{QUOTE_NONE} is in effect, it is an error not to have a single-character \var{escapechar} defined, even if no data to be written contains the \var{delimiter} character. \end{datadesc} The \module{csv} module defines the following exception: \begin{excdesc}{Error} Raised by any of the functions when an error is detected. \end{excdesc} \subsection{Dialects and Formatting Parameters\label{fmt-params}} To make it easier to specify the format of input and output records, specific formatting parameters are grouped together into dialects. A dialect is a subclass of the \class{Dialect} class having a set of specific methods and a single \method{validate()} method. When creating \class{reader} or \class{writer} objects, the programmer can specify a string or a subclass of the \class{Dialect} class as the dialect parameter. In addition to, or instead of, the \var{dialect} parameter, the programmer can also specify individual formatting parameters, which have the same names as the attributes defined above for the \class{Dialect} class. \subsection{Reader Objects} \class{DictReader} and \var{reader} objects have the following public methods: \begin{methoddesc}{next}{} Return the next row of the reader's iterable object as a list, parsed according to the current dialect. \end{methoddesc} \subsection{Writer Objects} \class{DictWriter} and \var{writer} objects have the following public methods: \begin{methoddesc}{writerow}{row} Write the \var{row} parameter to the writer's file object, formatted according to the current dialect. \end{methoddesc} \begin{methoddesc}{writerows}{rows} Write all the \var{rows} parameters to the writer's file object, formatted according to the current dialect. \end{methoddesc} \subsection{Examples} The ``Hello, world'' of csv reading is \begin{verbatim} reader = csv.reader(file("some.csv")) for row in reader: print row \end{verbatim} The corresponding simplest possible writing example is \begin{verbatim} writer = csv.writer(file("some.csv", "w")) for row in someiterable: writer.writerow(row) \end{verbatim} --- NEW FILE: libconsts.tex --- \section{Built-in Constants} A small number of constants live in the built-in namespace. They are: \begin{datadesc}{False} The false value of the \class{bool} type. \versionadded{2.3} \end{datadesc} \begin{datadesc}{True} The true value of the \class{bool} type. \versionadded{2.3} \end{datadesc} \begin{datadesc}{None} The sole value of \code{\refmodule{types}.NoneType}. \code{None} is frequently used to represent the absence of a value, as when default arguments are not passed to a function. \end{datadesc} \begin{datadesc}{NotImplemented} Special value which can be returned by the ``rich comparison'' special methods (\method{__eq__()}, \method{__lt__()}, and friends), to indicate that the comparison is not implemented with respect to the other type. \end{datadesc} \begin{datadesc}{Ellipsis} Special value used in conjunction with extended slicing syntax. % XXX Someone who understands extended slicing should fill in here. \end{datadesc} --- NEW FILE: libbz2.tex --- \section{\module{bz2} --- Compression compatible with \program{bzip2}} \declaremodule{builtin}{bz2} \modulesynopsis{Interface to compression and decompression routines compatible with \program{bzip2}.} \moduleauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \sectionauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \versionadded{2.3} This module provides a comprehensive interface for the bz2 compression library. It implements a complete file interface, one-shot (de)compression functions, and types for sequential (de)compression. Here is a resume of the features offered by the bz2 module: \begin{itemize} \item \class{BZ2File} class implements a complete file interface, including \method{readline()}, \method{readlines()}, \method{writelines()}, \method{seek()}, etc; \item \class{BZ2File} class implements emulated \method{seek()} support; \item \class{BZ2File} class implements universal newline support; \item \class{BZ2File} class offers an optimized line iteration using the readahead algorithm borrowed from file objects; \item Sequential (de)compression supported by \class{BZ2Compressor} and \class{BZ2Decompressor} classes; \item One-shot (de)compression supported by \function{compress()} and \function{decompress()} functions; \item Thread safety uses individual locking mechanism; \item Complete inline documentation; \end{itemize} \subsection{(De)compression of files} Handling of compressed files is offered by the \class{BZ2File} class. \begin{classdesc}{BZ2File}{filename\optional{, mode\optional{, buffering\optional{, compresslevel}}}} Open a bz2 file. Mode can be either \code{'r'} or \code{'w'}, for reading (default) or writing. When opened for writing, the file will be created if it doesn't exist, and truncated otherwise. If \var{buffering} is given, \code{0} means unbuffered, and larger numbers specify the buffer size; the default is \code{0}. If \var{compresslevel} is given, it must be a number between \code{1} and \code{9}; the default is \code{9}. Add a \character{U} to mode to open the file for input with universal newline support. Any line ending in the input file will be seen as a \character{\e n} in Python. Also, a file so opened gains the attribute \member{newlines}; the value for this attribute is one of \code{None} (no newline read yet), \code{'\e r'}, \code{'\e n'}, \code{'\e r\e n'} or a tuple containing all the newline types seen. Universal newlines are available only when reading. Instances support iteration in the same way as normal \class{file} instances. \end{classdesc} \begin{methoddesc}[BZ2File]{close}{} Close the file. Sets data attribute \member{closed} to true. A closed file cannot be used for further I/O operations. \method{close()} may be called more than once without error. \end{methoddesc} \begin{methoddesc}[BZ2File]{read}{\optional{size}} Read at most \var{size} uncompressed bytes, returned as a string. If the \var{size} argument is negative or omitted, read until EOF is reached. \end{methoddesc} \begin{methoddesc}[BZ2File]{readline}{\optional{size}} Return the next line from the file, as a string, retaining newline. A non-negative \var{size} argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF. \end{methoddesc} \begin{methoddesc}[BZ2File]{readlines}{\optional{size}} Return a list of lines read. The optional \var{size} argument, if given, is an approximate bound on the total number of bytes in the lines returned. \end{methoddesc} \begin{methoddesc}[BZ2File]{xreadlines}{} For backward compatibility. \class{BZ2File} objects now include the performance optimizations previously implemented in the \refmodule{xreadlines} module. \deprecated{2.3}{This exists only for compatibility with the method by this name on \class{file} objects, which is deprecated. Use \code{for line in file} instead.} \end{methoddesc} \begin{methoddesc}[BZ2File]{seek}{offset\optional{, whence}} Move to new file position. Argument \var{offset} is a byte count. Optional argument \var{whence} defaults to \code{0} (offset from start of file, offset should be \code{>= 0}); other values are \code{1} (move relative to current position, positive or negative), and \code{2} (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). Note that seeking of bz2 files is emulated, and depending on the parameters the operation may be extremely slow. \end{methoddesc} \begin{methoddesc}[BZ2File]{tell}{} Return the current file position, an integer (may be a long integer). \end{methoddesc} \begin{methoddesc}[BZ2File]{write}{data} Write string \var{data} to file. Note that due to buffering, \method{close()} may be needed before the file on disk reflects the data written. \end{methoddesc} \begin{methoddesc}[BZ2File]{writelines}{sequence_of_strings} Write the sequence of strings to the file. Note that newlines are not added. The sequence can be any iterable object producing strings. This is equivalent to calling write() for each string. \end{methoddesc} \subsection{Sequential (de)compression} Sequential compression and decompression is done using the classes \class{BZ2Compressor} and \class{BZ2Decompressor}. \begin{classdesc}{BZ2Compressor}{\optional{compresslevel}} Create a new compressor object. This object may be used to compress data sequentially. If you want to compress data in one shot, use the \function{compress()} function instead. The \var{compresslevel} parameter, if given, must be a number between \code{1} and \code{9}; the default is \code{9}. \end{classdesc} \begin{methoddesc}[BZ2Compressor]{compress}{data} Provide more data to the compressor object. It will return chunks of compressed data whenever possible. When you've finished providing data to compress, call the \method{flush()} method to finish the compression process, and return what is left in internal buffers. \end{methoddesc} \begin{methoddesc}[BZ2Compressor]{flush}{} Finish the compression process and return what is left in internal buffers. You must not use the compressor object after calling this method. \end{methoddesc} \begin{classdesc}{BZ2Decompressor}{} Create a new decompressor object. This object may be used to decompress data sequentially. If you want to decompress data in one shot, use the \function{decompress()} function instead. \end{classdesc} \begin{methoddesc}[BZ2Decompressor]{decompress}{data} Provide more data to the decompressor object. It will return chunks of decompressed data whenever possible. If you try to decompress data after the end of stream is found, \exception{EOFError} will be raised. If any data was found after the end of stream, it'll be ignored and saved in \member{unused\_data} attribute. \end{methoddesc} \subsection{One-shot (de)compression} One-shot compression and decompression is provided through the \function{compress()} and \function{decompress()} functions. \begin{funcdesc}{compress}{data\optional{, compresslevel}} Compress \var{data} in one shot. If you want to compress data sequentially, use an instance of \class{BZ2Compressor} instead. The \var{compresslevel} parameter, if given, must be a number between \code{1} and \code{9}; the default is \code{9}. \end{funcdesc} \begin{funcdesc}{decompress}{data} Decompress \var{data} in one shot. If you want to decompress data sequentially, use an instance of \class{BZ2Decompressor} instead. \end{funcdesc} --- NEW FILE: emailmimebase.tex --- Ordinarily, you get a message object structure by passing a file or some text to a parser, which parses the text and returns the root message object. However you can also build a complete message structure from scratch, or even individual \class{Message} objects by hand. In fact, you can also take an existing structure and add new \class{Message} objects, move them around, etc. This makes a very convenient interface for slicing-and-dicing MIME messages. You can create a new object structure by creating \class{Message} instances, adding attachments and all the appropriate headers manually. For MIME messages though, the \module{email} package provides some convenient subclasses to make things easier. Each of these classes should be imported from a module with the same name as the class, from within the \module{email} package. E.g.: \begin{verbatim} import email.MIMEImage.MIMEImage \end{verbatim} or \begin{verbatim} from email.MIMEText import MIMEText \end{verbatim} Here are the classes: \begin{classdesc}{MIMEBase}{_maintype, _subtype, **_params} This is the base class for all the MIME-specific subclasses of \class{Message}. Ordinarily you won't create instances specifically of \class{MIMEBase}, although you could. \class{MIMEBase} is provided primarily as a convenient base class for more specific MIME-aware subclasses. \var{_maintype} is the \mailheader{Content-Type} major type (e.g. \mimetype{text} or \mimetype{image}), and \var{_subtype} is the \mailheader{Content-Type} minor type (e.g. \mimetype{plain} or \mimetype{gif}). \var{_params} is a parameter key/value dictionary and is passed directly to \method{Message.add_header()}. The \class{MIMEBase} class always adds a \mailheader{Content-Type} header (based on \var{_maintype}, \var{_subtype}, and \var{_params}), and a \mailheader{MIME-Version} header (always set to \code{1.0}). \end{classdesc} \begin{classdesc}{MIMENonMultipart}{} A subclass of \class{MIMEBase}, this is an intermediate base class for MIME messages that are not \mimetype{multipart}. The primary purpose of this class is to prevent the use of the \method{attach()} method, which only makes sense for \mimetype{multipart} messages. If \method{attach()} is called, a \exception{MultipartConversionError} exception is raised. \versionadded{2.2.2} \end{classdesc} \begin{classdesc}{MIMEMultipart}{\optional{subtype\optional{, boundary\optional{, _subparts\optional{, _params}}}}} A subclass of \class{MIMEBase}, this is an intermediate base class for MIME messages that are \mimetype{multipart}. Optional \var{_subtype} defaults to \mimetype{mixed}, but can be used to specify the subtype of the message. A \mailheader{Content-Type} header of \mimetype{multipart/}\var{_subtype} will be added to the message object. A \mailheader{MIME-Version} header will also be added. Optional \var{boundary} is the multipart boundary string. When \code{None} (the default), the boundary is calculated when needed. \var{_subparts} is a sequence of initial subparts for the payload. It must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the \method{Message.attach()} method. Additional parameters for the \mailheader{Content-Type} header are taken from the keyword arguments, or passed into the \var{_params} argument, which is a keyword dictionary. \versionadded{2.2.2} \end{classdesc} \begin{classdesc}{MIMEAudio}{_audiodata\optional{, _subtype\optional{, _encoder\optional{, **_params}}}} A subclass of \class{MIMENonMultipart}, the \class{MIMEAudio} class is used to create MIME message objects of major type \mimetype{audio}. \var{_audiodata} is a string containing the raw audio data. If this data can be decoded by the standard Python module \refmodule{sndhdr}, then the subtype will be automatically included in the \mailheader{Content-Type} header. Otherwise you can explicitly specify the audio subtype via the \var{_subtype} parameter. If the minor type could not be guessed and \var{_subtype} was not given, then \exception{TypeError} is raised. Optional \var{_encoder} is a callable (i.e. function) which will perform the actual encoding of the audio data for transport. This callable takes one argument, which is the \class{MIMEAudio} instance. It should use \method{get_payload()} and \method{set_payload()} to change the payload to encoded form. It should also add any \mailheader{Content-Transfer-Encoding} or other headers to the message object as necessary. The default encoding is base64. See the \refmodule{email.Encoders} module for a list of the built-in encoders. \var{_params} are passed straight through to the base class constructor. \end{classdesc} \begin{classdesc}{MIMEImage}{_imagedata\optional{, _subtype\optional{, _encoder\optional{, **_params}}}} A subclass of \class{MIMENonMultipart}, the \class{MIMEImage} class is used to create MIME message objects of major type \mimetype{image}. \var{_imagedata} is a string containing the raw image data. If this data can be decoded by the standard Python module \refmodule{imghdr}, then the subtype will be automatically included in the \mailheader{Content-Type} header. Otherwise you can explicitly specify the image subtype via the \var{_subtype} parameter. If the minor type could not be guessed and \var{_subtype} was not given, then \exception{TypeError} is raised. Optional \var{_encoder} is a callable (i.e. function) which will perform the actual encoding of the image data for transport. This callable takes one argument, which is the \class{MIMEImage} instance. It should use \method{get_payload()} and \method{set_payload()} to change the payload to encoded form. It should also add any \mailheader{Content-Transfer-Encoding} or other headers to the message object as necessary. The default encoding is base64. See the \refmodule{email.Encoders} module for a list of the built-in encoders. \var{_params} are passed straight through to the \class{MIMEBase} constructor. \end{classdesc} \begin{classdesc}{MIMEMessage}{_msg\optional{, _subtype}} A subclass of \class{MIMENonMultipart}, the \class{MIMEMessage} class is used to create MIME objects of main type \mimetype{message}. \var{_msg} is used as the payload, and must be an instance of class \class{Message} (or a subclass thereof), otherwise a \exception{TypeError} is raised. Optional \var{_subtype} sets the subtype of the message; it defaults to \mimetype{rfc822}. \end{classdesc} \begin{classdesc}{MIMEText}{_text\optional{, _subtype\optional{, _charset\optional{, _encoder}}}} A subclass of \class{MIMENonMultipart}, the \class{MIMEText} class is used to create MIME objects of major type \mimetype{text}. \var{_text} is the string for the payload. \var{_subtype} is the minor type and defaults to \mimetype{plain}. \var{_charset} is the character set of the text and is passed as a parameter to the \class{MIMENonMultipart} constructor; it defaults to \code{us-ascii}. No guessing or encoding is performed on the text data. \deprecated{2.2.2}{The \var{_encoding} argument has been deprecated. Encoding now happens implicitly based on the \var{_charset} argument.} \end{classdesc} --- NEW FILE: emailheaders.tex --- \declaremodule{standard}{email.Header} \modulesynopsis{Representing non-ASCII headers} \rfc{2822} is the base standard that describes the format of email messages. It derives from the older \rfc{822} standard which came into widespread use at a time when most email was composed of \ASCII{} characters only. \rfc{2822} is a specification written assuming email contains only 7-bit \ASCII{} characters. Of course, as email has been deployed worldwide, it has become internationalized, such that language specific character sets can now be used in email messages. The base standard still requires email messages to be transfered using only 7-bit \ASCII{} characters, so a slew of RFCs have been written describing how to encode email containing non-\ASCII{} characters into \rfc{2822}-compliant format. These RFCs include \rfc{2045}, \rfc{2046}, \rfc{2047}, and \rfc{2231}. The \module{email} package supports these standards in its \module{email.Header} and \module{email.Charset} modules. If you want to include non-\ASCII{} characters in your email headers, say in the \mailheader{Subject} or \mailheader{To} fields, you should use the \class{Header} class and assign the field in the \class{Message} object to an instance of \class{Header} instead of using a string for the header value. For example: \begin{verbatim} >>> from email.Message import Message >>> from email.Header import Header >>> msg = Message() >>> h = Header('p\xf6stal', 'iso-8859-1') >>> msg['Subject'] = h >>> print msg.as_string() Subject: =?iso-8859-1?q?p=F6stal?= \end{verbatim} Notice here how we wanted the \mailheader{Subject} field to contain a non-\ASCII{} character? We did this by creating a \class{Header} instance and passing in the character set that the byte string was encoded in. When the subsequent \class{Message} instance was flattened, the \mailheader{Subject} field was properly \rfc{2047} encoded. MIME-aware mail readers would show this header using the embedded ISO-8859-1 character. \versionadded{2.2.2} Here is the \class{Header} class description: \begin{classdesc}{Header}{\optional{s\optional{, charset\optional{, maxlinelen\optional{, header_name\optional{, continuation_ws\optional{, errors}}}}}}} Create a MIME-compliant header that can contain strings in different character sets. Optional \var{s} is the initial header value. If \code{None} (the default), the initial header value is not set. You can later append to the header with \method{append()} method calls. \var{s} may be a byte string or a Unicode string, but see the \method{append()} documentation for semantics. Optional \var{charset} serves two purposes: it has the same meaning as the \var{charset} argument to the \method{append()} method. It also sets the default character set for all subsequent \method{append()} calls that omit the \var{charset} argument. If \var{charset} is not provided in the constructor (the default), the \code{us-ascii} character set is used both as \var{s}'s initial charset and as the default for subsequent \method{append()} calls. The maximum line length can be specified explicit via \var{maxlinelen}. For splitting the first line to a shorter value (to account for the field header which isn't included in \var{s}, e.g. \mailheader{Subject}) pass in the name of the field in \var{header_name}. The default \var{maxlinelen} is 76, and the default value for \var{header_name} is \code{None}, meaning it is not taken into account for the first line of a long, split header. Optional \var{continuation_ws} must be \rfc{2822}-compliant folding whitespace, and is usually either a space or a hard tab character. This character will be prepended to continuation lines. \end{classdesc} Optional \var{errors} is passed straight through to the \method{append()} method. \begin{methoddesc}[Header]{append}{s\optional{, charset\optional{, errors}}} Append the string \var{s} to the MIME header. Optional \var{charset}, if given, should be a \class{Charset} instance (see \refmodule{email.Charset}) or the name of a character set, which will be converted to a \class{Charset} instance. A value of \code{None} (the default) means that the \var{charset} given in the constructor is used. \var{s} may be a byte string or a Unicode string. If it is a byte string (i.e. \code{isinstance(s, str)} is true), then \var{charset} is the encoding of that byte string, and a \exception{UnicodeError} will be raised if the string cannot be decoded with that character set. If \var{s} is a Unicode string, then \var{charset} is a hint specifying the character set of the characters in the string. In this case, when producing an \rfc{2822}-compliant header using \rfc{2047} rules, the Unicode string will be encoded using the following charsets in order: \code{us-ascii}, the \var{charset} hint, \code{utf-8}. The first character set to not provoke a \exception{UnicodeError} is used. Optional \var{errors} is passed through to any \function{unicode()} or \function{ustr.encode()} call, and defaults to ``strict''. \end{methoddesc} \begin{methoddesc}[Header]{encode}{\optional{splitchars}} Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-\ASCII{} parts in base64 or quoted-printable encodings. Optional \var{splitchars} is a string containing characters to split long ASCII lines on, in rough support of \rfc{2822}'s \emph{highest level syntactic breaks}. This doesn't affect \rfc{2047} encoded lines. \end{methoddesc} The \class{Header} class also provides a number of methods to support standard operators and built-in functions. \begin{methoddesc}[Header]{__str__}{} A synonym for \method{Header.encode()}. Useful for \code{str(aHeader)}. \end{methoddesc} \begin{methoddesc}[Header]{__unicode__}{} A helper for the built-in \function{unicode()} function. Returns the header as a Unicode string. \end{methoddesc} \begin{methoddesc}[Header]{__eq__}{other} This method allows you to compare two \class{Header} instances for equality. \end{methoddesc} \begin{methoddesc}[Header]{__ne__}{other} This method allows you to compare two \class{Header} instances for inequality. \end{methoddesc} The \module{email.Header} module also provides the following convenient functions. \begin{funcdesc}{decode_header}{header} Decode a message header value without converting the character set. The header value is in \var{header}. This function returns a list of \code{(decoded_string, charset)} pairs containing each of the decoded parts of the header. \var{charset} is \code{None} for non-encoded parts of the header, otherwise a lower case string containing the name of the character set specified in the encoded string. Here's an example: \begin{verbatim} >>> from email.Header import decode_header >>> decode_header('=?iso-8859-1?q?p=F6stal?=') [('p\\xf6stal', 'iso-8859-1')] \end{verbatim} \end{funcdesc} \begin{funcdesc}{make_header}{decoded_seq\optional{, maxlinelen\optional{, header_name\optional{, continuation_ws}}}} Create a \class{Header} instance from a sequence of pairs as returned by \function{decode_header()}. \function{decode_header()} takes a header value string and returns a sequence of pairs of the format \code{(decoded_string, charset)} where \var{charset} is the name of the character set. This function takes one of those sequence of pairs and returns a \class{Header} instance. Optional \var{maxlinelen}, \var{header_name}, and \var{continuation_ws} are as in the \class{Header} constructor. \end{funcdesc} --- NEW FILE: emailcharsets.tex --- \declaremodule{standard}{email.Charset} \modulesynopsis{Character Sets} This module provides a class \class{Charset} for representing character sets and character set conversions in email messages, as well as a character set registry and several convenience methods for manipulating this registry. Instances of \class{Charset} are used in several other modules within the \module{email} package. \versionadded{2.2.2} \begin{classdesc}{Charset}{\optional{input_charset}} Map character sets to their email properties. This class provides information about the requirements imposed on email for a specific character set. It also provides convenience routines for converting between character sets, given the availability of the applicable codecs. Given a character set, it will do its best to provide information on how to use that character set in an email message in an RFC-compliant way. Certain character sets must be encoded with quoted-printable or base64 when used in email headers or bodies. Certain character sets must be converted outright, and are not allowed in email. Optional \var{input_charset} is as described below; it is always coerced to lower case. After being alias normalized it is also used as a lookup into the registry of character sets to find out the header encoding, body encoding, and output conversion codec to be used for the character set. For example, if \var{input_charset} is \code{iso-8859-1}, then headers and bodies will be encoded using quoted-printable and no output conversion codec is necessary. If \var{input_charset} is \code{euc-jp}, then headers will be encoded with base64, bodies will not be encoded, but output text will be converted from the \code{euc-jp} character set to the \code{iso-2022-jp} character set. \end{classdesc} \class{Charset} instances have the following data attributes: \begin{datadesc}{input_charset} The initial character set specified. Common aliases are converted to their \emph{official} email names (e.g. \code{latin_1} is converted to \code{iso-8859-1}). Defaults to 7-bit \code{us-ascii}. \end{datadesc} \begin{datadesc}{header_encoding} If the character set must be encoded before it can be used in an email header, this attribute will be set to \code{Charset.QP} (for quoted-printable), \code{Charset.BASE64} (for base64 encoding), or \code{Charset.SHORTEST} for the shortest of QP or BASE64 encoding. Otherwise, it will be \code{None}. \end{datadesc} \begin{datadesc}{body_encoding} Same as \var{header_encoding}, but describes the encoding for the mail message's body, which indeed may be different than the header encoding. \code{Charset.SHORTEST} is not allowed for \var{body_encoding}. \end{datadesc} \begin{datadesc}{output_charset} Some character sets must be converted before they can be used in email headers or bodies. If the \var{input_charset} is one of them, this attribute will contain the name of the character set output will be converted to. Otherwise, it will be \code{None}. \end{datadesc} \begin{datadesc}{input_codec} The name of the Python codec used to convert the \var{input_charset} to Unicode. If no conversion codec is necessary, this attribute will be \code{None}. \end{datadesc} \begin{datadesc}{output_codec} The name of the Python codec used to convert Unicode to the \var{output_charset}. If no conversion codec is necessary, this attribute will have the same value as the \var{input_codec}. \end{datadesc} \class{Charset} instances also have the following methods: \begin{methoddesc}[Charset]{get_body_encoding}{} Return the content transfer encoding used for body encoding. This is either the string \samp{quoted-printable} or \samp{base64} depending on the encoding used, or it is a function, in which case you should call the function with a single argument, the Message object being encoded. The function should then set the \mailheader{Content-Transfer-Encoding} header itself to whatever is appropriate. Returns the string \samp{quoted-printable} if \var{body_encoding} is \code{QP}, returns the string \samp{base64} if \var{body_encoding} is \code{BASE64}, and returns the string \samp{7bit} otherwise. \end{methoddesc} \begin{methoddesc}{convert}{s} Convert the string \var{s} from the \var{input_codec} to the \var{output_codec}. \end{methoddesc} \begin{methoddesc}{to_splittable}{s} Convert a possibly multibyte string to a safely splittable format. \var{s} is the string to split. Uses the \var{input_codec} to try and convert the string to Unicode, so it can be safely split on character boundaries (even for multibyte characters). Returns the string as-is if it isn't known how to convert \var{s} to Unicode with the \var{input_charset}. Characters that could not be converted to Unicode will be replaced with the Unicode replacement character \character{U+FFFD}. \end{methoddesc} \begin{methoddesc}{from_splittable}{ustr\optional{, to_output}} Convert a splittable string back into an encoded string. \var{ustr} is a Unicode string to ``unsplit''. This method uses the proper codec to try and convert the string from Unicode back into an encoded format. Return the string as-is if it is not Unicode, or if it could not be converted from Unicode. Characters that could not be converted from Unicode will be replaced with an appropriate character (usually \character{?}). If \var{to_output} is \code{True} (the default), uses \var{output_codec} to convert to an encoded format. If \var{to_output} is \code{False}, it uses \var{input_codec}. \end{methoddesc} \begin{methoddesc}{get_output_charset}{} Return the output character set. This is the \var{output_charset} attribute if that is not \code{None}, otherwise it is \var{input_charset}. \end{methoddesc} \begin{methoddesc}{encoded_header_len}{} Return the length of the encoded header string, properly calculating for quoted-printable or base64 encoding. \end{methoddesc} \begin{methoddesc}{header_encode}{s\optional{, convert}} Header-encode the string \var{s}. If \var{convert} is \code{True}, the string will be converted from the input charset to the output charset automatically. This is not useful for multibyte character sets, which have line length issues (multibyte characters must be split on a character, not a byte boundary); use the higher-level \class{Header} class to deal with these issues (see \refmodule{email.Header}). \var{convert} defaults to \code{False}. The type of encoding (base64 or quoted-printable) will be based on the \var{header_encoding} attribute. \end{methoddesc} \begin{methoddesc}{body_encode}{s\optional{, convert}} Body-encode the string \var{s}. If \var{convert} is \code{True} (the default), the string will be converted from the input charset to output charset automatically. Unlike \method{header_encode()}, there are no issues with byte boundaries and multibyte charsets in email bodies, so this is usually pretty safe. The type of encoding (base64 or quoted-printable) will be based on the \var{body_encoding} attribute. \end{methoddesc} The \class{Charset} class also provides a number of methods to support standard operations and built-in functions. \begin{methoddesc}[Charset]{__str__}{} Returns \var{input_charset} as a string coerced to lower case. \method{__repr__()} is an alias for \method{__str__()}. \end{methoddesc} \begin{methoddesc}[Charset]{__eq__}{other} This method allows you to compare two \class{Charset} instances for equality. \end{methoddesc} \begin{methoddesc}[Header]{__ne__}{other} This method allows you to compare two \class{Charset} instances for inequality. \end{methoddesc} The \module{email.Charset} module also provides the following functions for adding new entries to the global character set, alias, and codec registries: \begin{funcdesc}{add_charset}{charset\optional{, header_enc\optional{, body_enc\optional{, output_charset}}}} Add character properties to the global registry. \var{charset} is the input character set, and must be the canonical name of a character set. Optional \var{header_enc} and \var{body_enc} is either \code{Charset.QP} for quoted-printable, \code{Charset.BASE64} for base64 encoding, \code{Charset.SHORTEST} for the shortest of quoted-printable or base64 encoding, or \code{None} for no encoding. \code{SHORTEST} is only valid for \var{header_enc}. The default is \code{None} for no encoding. Optional \var{output_charset} is the character set that the output should be in. Conversions will proceed from input charset, to Unicode, to the output charset when the method \method{Charset.convert()} is called. The default is to output in the same character set as the input. Both \var{input_charset} and \var{output_charset} must have Unicode codec entries in the module's character set-to-codec mapping; use \function{add_codec()} to add codecs the module does not know about. See the \refmodule{codecs} module's documentation for more information. The global character set registry is kept in the module global dictionary \code{CHARSETS}. \end{funcdesc} \begin{funcdesc}{add_alias}{alias, canonical} Add a character set alias. \var{alias} is the alias name, e.g. \code{latin-1}. \var{canonical} is the character set's canonical name, e.g. \code{iso-8859-1}. The global charset alias registry is kept in the module global dictionary \code{ALIASES}. \end{funcdesc} \begin{funcdesc}{add_codec}{charset, codecname} Add a codec that map characters in the given character set to and from Unicode. \var{charset} is the canonical name of a character set. \var{codecname} is the name of a Python codec, as appropriate for the second argument to the \function{unicode()} built-in, or to the \method{encode()} method of a Unicode string. \end{funcdesc} --- NEW FILE: email-unpack.py --- #!/usr/bin/env python """Unpack a MIME message into a directory of files. Usage: unpackmail [options] msgfile Options: -h / --help Print this message and exit. -d directory --directory=directory Unpack the MIME message into the named directory, which will be created if it doesn't already exist. msgfile is the path to the file containing the MIME message. """ import sys import os import getopt import errno import mimetypes import email def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hd:', ['help', 'directory=']) except getopt.error, msg: usage(1, msg) dir = os.curdir for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-d', '--directory'): dir = arg try: msgfile = args[0] except IndexError: usage(1) try: os.mkdir(dir) except OSError, e: # Ignore directory exists error if e.errno <> errno.EEXIST: raise fp = open(msgfile) msg = email.message_from_file(fp) fp.close() counter = 1 for part in msg.walk(): # multipart/* are just containers if part.get_content_maintype() == 'multipart': continue # Applications should really sanitize the given filename so that an # email message can't be used to overwrite important files filename = part.get_filename() if not filename: ext = mimetypes.guess_extension(part.get_type()) if not ext: # Use a generic bag-of-bits extension ext = '.bin' filename = 'part-%03d%s' % (counter, ext) counter += 1 fp = open(os.path.join(dir, filename), 'wb') fp.write(part.get_payload(decode=1)) fp.close() if __name__ == '__main__': main() --- NEW FILE: email-simple.py --- # Import smtplib for the actual sending function import smtplib # Import the email modules we'll need from email.MIMEText import MIMEText # Open a plain text file for reading. For this example, assume that # the text file contains only ASCII characters. fp = open(textfile, 'rb') # Create a text/plain message msg = MIMEText(fp.read()) fp.close() # me == the sender's email address # you == the recipient's email address msg['Subject'] = 'The contents of %s' % textfile msg['From'] = me msg['To'] = you # Send the message via our own SMTP server, but don't include the # envelope header. s = smtplib.SMTP() s.connect() s.sendmail(me, [you], msg.as_string()) s.close() --- NEW FILE: email-mime.py --- # Import smtplib for the actual sending function import smtplib # Here are the email pacakge modules we'll need from email.MIMEImage import MIMEImage from email.MIMEMultipart import MIMEMultipart COMMASPACE = ', ' # Create the container (outer) email message. msg = MIMEMultipart() msg['Subject'] = 'Our family reunion' # me == the sender's email address # family = the list of all recipients' email addresses msg['From'] = me msg['To'] = COMMASPACE.join(family) msg.preamble = 'Our family reunion' # Guarantees the message ends in a newline msg.epilogue = '' # Assume we know that the image files are all in PNG format for file in pngfiles: # Open the files in binary mode. Let the MIMEImage class automatically # guess the specific image type. fp = open(file, 'rb') img = MIMEImage(fp.read()) fp.close() msg.attach(img) # Send the email via our own SMTP server. s = smtplib.SMTP() s.connect() s.sendmail(me, family, msg.as_string()) s.close() --- NEW FILE: email-dir.py --- #!/usr/bin/env python """Send the contents of a directory as a MIME message. Usage: dirmail [options] from to [to ...]* Options: -h / --help Print this message and exit. -d directory --directory=directory Mail the contents of the specified directory, otherwise use the current directory. Only the regular files in the directory are sent, and we don't recurse to subdirectories. `from' is the email address of the sender of the message. `to' is the email address of the recipient of the message, and multiple recipients may be given. The email is sent by forwarding to your local SMTP server, which then does the normal delivery process. Your local machine must be running an SMTP server. """ import sys import os import getopt import smtplib # For guessing MIME type based on file name extension import mimetypes from email import Encoders from email.Message import Message from email.MIMEAudio import MIMEAudio from email.MIMEMultipart import MIMEMultipart from email.MIMEImage import MIMEImage from email.MIMEText import MIMEText COMMASPACE = ', ' def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hd:', ['help', 'directory=']) except getopt.error, msg: usage(1, msg) dir = os.curdir for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-d', '--directory'): dir = arg if len(args) < 2: usage(1) sender = args[0] recips = args[1:] # Create the enclosing (outer) message outer = MIMEMultipart() outer['Subject'] = 'Contents of directory %s' % os.path.abspath(dir) outer['To'] = COMMASPACE.join(recips) outer['From'] = sender outer.preamble = 'You will not see this in a MIME-aware mail reader.\n' # To guarantee the message ends with a newline outer.epilogue = '' for filename in os.listdir(dir): path = os.path.join(dir, filename) if not os.path.isfile(path): continue # Guess the content type based on the file's extension. Encoding # will be ignored, although we should check for simple things like # gzip'd or compressed files. ctype, encoding = mimetypes.guess_type(path) if ctype is None or encoding is not None: # No guess could be made, or the file is encoded (compressed), so # use a generic bag-of-bits type. ctype = 'application/octet-stream' maintype, subtype = ctype.split('/', 1) if maintype == 'text': fp = open(path) # Note: we should handle calculating the charset msg = MIMEText(fp.read(), _subtype=subtype) fp.close() elif maintype == 'image': fp = open(path, 'rb') msg = MIMEImage(fp.read(), _subtype=subtype) fp.close() elif maintype == 'audio': fp = open(path, 'rb') msg = MIMEAudio(fp.read(), _subtype=subtype) fp.close() else: fp = open(path, 'rb') msg = MIMEBase(maintype, subtype) msg.set_payload(fp.read()) fp.close() # Encode the payload using Base64 Encoders.encode_base64(msg) # Set the filename parameter msg.add_header('Content-Disposition', 'attachment', filename=filename) outer.attach(msg) # Now send the message s = smtplib.SMTP() s.connect() s.sendmail(sender, recips, outer.as_string()) s.close() if __name__ == '__main__': main() --- NEW FILE: caseless.py --- from optparse import Option, OptionParser, _match_abbrev # This case-insensitive option parser relies on having a # case-insensitive dictionary type available. Here's one # for Python 2.2. Note that a *real* case-insensitive # dictionary type would also have to implement __new__(), # update(), and setdefault() -- but that's not the point # of this exercise. class caseless_dict (dict): def __setitem__ (self, key, value): dict.__setitem__(self, key.lower(), value) def __getitem__ (self, key): return dict.__getitem__(self, key.lower()) def get (self, key, default=None): return dict.get(self, key.lower()) def has_key (self, key): return dict.has_key(self, key.lower()) class CaselessOptionParser (OptionParser): def _create_option_list (self): self.option_list = [] self._short_opt = caseless_dict() self._long_opt = caseless_dict() self._long_opts = [] self.defaults = {} def _match_long_opt (self, opt): return _match_abbrev(opt.lower(), self._long_opt.keys()) if __name__ == "__main__": from optik.errors import OptionConflictError # test 1: no options to start with parser = CaselessOptionParser() try: parser.add_option("-H", dest="blah") except OptionConflictError: print "ok: got OptionConflictError for -H" else: print "not ok: no conflict between -h and -H" parser.add_option("-f", "--file", dest="file") #print `parser.get_option("-f")` #print `parser.get_option("-F")` #print `parser.get_option("--file")` #print `parser.get_option("--fIlE")` (options, args) = parser.parse_args(["--FiLe", "foo"]) assert options.file == "foo", options.file print "ok: case insensitive long options work" (options, args) = parser.parse_args(["-F", "bar"]) assert options.file == "bar", options.file print "ok: case insensitive short options work" Index: xmlsaxutils.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxutils.tex,v retrieving revision 1.3 retrieving revision 1.3.18.1 diff -C2 -d -r1.3 -r1.3.18.1 *** xmlsaxutils.tex 10 Aug 2001 22:14:17 -0000 1.3 --- xmlsaxutils.tex 28 Apr 2003 17:33:52 -0000 1.3.18.1 *************** *** 4,8 **** \declaremodule{standard}{xml.sax.saxutils} \modulesynopsis{Convenience functions and classes for use with SAX.} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} --- 4,8 ---- \declaremodule{standard}{xml.sax.saxutils} \modulesynopsis{Convenience functions and classes for use with SAX.} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} *************** *** 21,24 **** --- 21,35 ---- optional \var{entities} parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. + \end{funcdesc} + + \begin{funcdesc}{unescape}{data\optional{, entities}} + Unescape \character{\&}, \character{\<}, and \character{\>} + in a string of data. + + You can unescape other strings of data by passing a dictionary as the + optional \var{entities} parameter. The keys and values must all be + strings; each key will be replaced with its corresponding value. + + \versionadded{2.3} \end{funcdesc} Index: xmlsaxreader.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxreader.tex,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** xmlsaxreader.tex 25 Jun 2002 17:10:50 -0000 1.4 --- xmlsaxreader.tex 28 Apr 2003 17:33:53 -0000 1.4.2.1 *************** *** 4,8 **** \declaremodule{standard}{xml.sax.xmlreader} \modulesynopsis{Interface which SAX-compliant XML parsers must implement.} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} --- 4,8 ---- \declaremodule{standard}{xml.sax.xmlreader} \modulesynopsis{Interface which SAX-compliant XML parsers must implement.} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} Index: xmlsaxhandler.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxhandler.tex,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** xmlsaxhandler.tex 25 Jun 2002 17:10:49 -0000 1.9 --- xmlsaxhandler.tex 28 Apr 2003 17:33:54 -0000 1.9.2.1 *************** *** 4,8 **** \declaremodule{standard}{xml.sax.handler} \modulesynopsis{Base classes for SAX event handlers.} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} --- 4,8 ---- \declaremodule{standard}{xml.sax.handler} \modulesynopsis{Base classes for SAX event handlers.} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} Index: xmlsax.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsax.tex,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** xmlsax.tex 25 Jun 2002 16:58:58 -0000 1.6 --- xmlsax.tex 28 Apr 2003 17:33:55 -0000 1.6.2.1 *************** *** 7,11 **** \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \versionadded{2.0} --- 7,11 ---- \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \versionadded{2.0} Index: xmldomminidom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldomminidom.tex,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** xmldomminidom.tex 30 Jun 2002 15:04:59 -0000 1.6 --- xmldomminidom.tex 28 Apr 2003 17:33:56 -0000 1.6.2.1 *************** *** 6,10 **** \moduleauthor{Paul Prescod}{paul@prescod.net} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \versionadded{2.0} --- 6,10 ---- \moduleauthor{Paul Prescod}{paul@prescod.net} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \versionadded{2.0} *************** *** 28,32 **** \end{verbatim} ! The parse function can take either a filename or an open file object. \begin{funcdesc}{parse}{filename_or_file{, parser}} --- 28,33 ---- \end{verbatim} ! The \function{parse()} function can take either a filename or an open ! file object. \begin{funcdesc}{parse}{filename_or_file{, parser}} *************** *** 51,64 **** content of the document. ! You can also create a \class{Document} node merely by instantiating a ! document object. Then you could add child nodes to it to populate the DOM: \begin{verbatim} ! from xml.dom.minidom import Document ! newdoc = Document() ! newel = newdoc.createElement("some_tag") ! newdoc.appendChild(newel) \end{verbatim} --- 52,84 ---- content of the document. ! What the \function{parse()} and \function{parseString()} functions do ! is connect an XML parser with a ``DOM builder'' that can accept parse ! events from any SAX parser and convert them into a DOM tree. The name ! of the functions are perhaps misleading, but are easy to grasp when ! learning the interfaces. The parsing of the document will be ! completed before these functions return; it's simply that these ! functions do not provide a parser implementation themselves. ! ! You can also create a \class{Document} by calling a method on a ``DOM ! Implementation'' object. You can get this object either by calling ! the \function{getDOMImplementation()} function in the ! \refmodule{xml.dom} package or the \module{xml.dom.minidom} module. ! Using the implementation from the \module{xml.dom.minidom} module will ! always return a \class{Document} instance from the minidom ! implementation, while the version from \refmodule{xml.dom} may provide ! an alternate implementation (this is likely if you have the ! \ulink{PyXML package}{http://pyxml.sourceforge.net/} installed). Once ! you have a \class{Document}, you can add child nodes to it to populate the DOM: \begin{verbatim} ! from xml.dom.minidom import getDOMImplementation ! impl = getDOMImplementation() ! ! newdoc = impl.createDocument(None, "some_tag", None) ! top_element = newdoc.documentElement ! text = newdoc.createTextNode('Some textual content.') ! top_element.appendChild(text) \end{verbatim} *************** *** 101,105 **** ! \subsection{DOM objects \label{dom-objects}} The definition of the DOM API for Python is given as part of the --- 121,125 ---- ! \subsection{DOM Objects \label{dom-objects}} The definition of the DOM API for Python is given as part of the Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.19 retrieving revision 1.19.8.1 diff -C2 -d -r1.19 -r1.19.8.1 *** xmldom.tex 30 Nov 2001 16:58:15 -0000 1.19 --- xmldom.tex 28 Apr 2003 17:33:56 -0000 1.19.8.1 *************** *** 5,9 **** \modulesynopsis{Document Object Model API for Python.} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de} \versionadded{2.0} --- 5,9 ---- \modulesynopsis{Document Object Model API for Python.} \sectionauthor{Paul Prescod}{paul@prescod.net} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \versionadded{2.0} *************** *** 40,58 **** The Document Object Model is being defined by the W3C in stages, or ``levels'' in their terminology. The Python mapping of the API is ! substantially based on the DOM Level 2 recommendation. Some aspects ! of the API will only become available in Python 2.1, or may only be ! available in particular DOM implementations. DOM applications typically start by parsing some XML into a DOM. How ! this is accomplished is not covered at all by DOM Level 1, and Level 2 ! provides only limited improvements. There is a \class{DOMImplementation} object class which provides access to ! \class{Document} creation methods, but these methods were only added ! in DOM Level 2 and were not implemented in time for Python 2.0. There ! is also no well-defined way to access these methods without an ! existing \class{Document} object. For Python 2.0, consult the ! documentation for each particular DOM implementation to determine the ! bootstrap procedure needed to create and initialize \class{Document} ! and \class{DocumentType} instances. Once you have a DOM document object, you can access the parts of your --- 40,62 ---- The Document Object Model is being defined by the W3C in stages, or ``levels'' in their terminology. The Python mapping of the API is ! substantially based on the DOM Level~2 recommendation. The mapping of ! the Level~3 specification, currently only available in draft form, is ! being developed by the \ulink{Python XML Special Interest ! Group}{http://www.python.org/sigs/xml-sig/} as part of the ! \ulink{PyXML package}{http://pyxml.sourceforge.net/}. Refer to the ! documentation bundled with that package for information on the current ! state of DOM Level~3 support. DOM applications typically start by parsing some XML into a DOM. How ! this is accomplished is not covered at all by DOM Level~1, and Level~2 ! provides only limited improvements: There is a \class{DOMImplementation} object class which provides access to ! \class{Document} creation methods, but no way to access an XML ! reader/parser/Document builder in an implementation-independent way. ! There is also no well-defined way to access these methods without an ! existing \class{Document} object. In Python, each DOM implementation ! will provide a function \function{getDOMImplementation()}. DOM Level~3 ! adds a Load/Store specification, which defines an interface to the ! reader, but this is not yet available in the Python standard library. Once you have a DOM document object, you can access the parts of your *************** *** 71,79 **** \begin{seealso} \seetitle[http://www.w3.org/TR/DOM-Level-2-Core/]{Document Object ! Model (DOM) Level 2 Specification} {The W3C recommendation upon which the Python DOM API is based.} \seetitle[http://www.w3.org/TR/REC-DOM-Level-1/]{Document Object ! Model (DOM) Level 1 Specification} {The W3C recommendation for the DOM supported by \module{xml.dom.minidom}.} --- 75,83 ---- \begin{seealso} \seetitle[http://www.w3.org/TR/DOM-Level-2-Core/]{Document Object ! Model (DOM) Level~2 Specification} {The W3C recommendation upon which the Python DOM API is based.} \seetitle[http://www.w3.org/TR/REC-DOM-Level-1/]{Document Object ! Model (DOM) Level~1 Specification} {The W3C recommendation for the DOM supported by \module{xml.dom.minidom}.} *************** *** 138,142 **** The namespace URI for namespace declarations, as defined by \citetitle[http://www.w3.org/TR/DOM-Level-2-Core/core.html]{Document ! Object Model (DOM) Level 2 Core Specification} (section~1.1.8). \versionadded{2.2} \end{datadesc} --- 142,146 ---- The namespace URI for namespace declarations, as defined by \citetitle[http://www.w3.org/TR/DOM-Level-2-Core/core.html]{Document ! Object Model (DOM) Level~2 Core Specification} (section~1.1.8). \versionadded{2.2} \end{datadesc} *************** *** 205,209 **** The \class{DOMImplementation} interface provides a way for applications to determine the availability of particular features in ! the DOM they are using. DOM Level 2 added the ability to create new \class{Document} and \class{DocumentType} objects using the \class{DOMImplementation} as well. --- 209,213 ---- The \class{DOMImplementation} interface provides a way for applications to determine the availability of particular features in ! the DOM they are using. DOM Level~2 added the ability to create new \class{Document} and \class{DocumentType} objects using the \class{DOMImplementation} as well. *************** *** 320,328 **** same node). ! \note{This is based on a proposed DOM Level 3 API which is ! still in the ``working draft'' stage, but this particular interface ! appears uncontroversial. Changes from the W3C will not necessarily ! affect this method in the Python DOM interface (though any new W3C ! API for this would also be supported).} \end{methoddesc} --- 324,334 ---- same node). ! \begin{notice} ! This is based on a proposed DOM Level~3 API which is still in the ! ``working draft'' stage, but this particular interface appears ! uncontroversial. Changes from the W3C will not necessarily affect ! this method in the Python DOM interface (though any new W3C API for ! this would also be supported). ! \end{notice} \end{methoddesc} *************** *** 368,377 **** A \class{NodeList} represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: the ! \class{Element} objects provides one as it's list of child nodes, and the \method{getElementsByTagName()} and \method{getElementsByTagNameNS()} methods of \class{Node} return objects with this interface to represent query results. ! The DOM Level 2 recommendation defines one method and one attribute for these objects: --- 374,383 ---- A \class{NodeList} represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: the ! \class{Element} objects provides one as its list of child nodes, and the \method{getElementsByTagName()} and \method{getElementsByTagNameNS()} methods of \class{Node} return objects with this interface to represent query results. ! The DOM Level~2 recommendation defines one method and one attribute for these objects: *************** *** 668,677 **** \end{memberdesc} ! \note{The use of a \class{CDATASection} node does not ! indicate that the node represents a complete CDATA marked section, ! only that the content of the node was part of a CDATA section. A ! single CDATA section may be represented by more than one node in the ! document tree. There is no way to determine whether two adjacent ! \class{CDATASection} nodes represent different CDATA marked sections.} --- 674,686 ---- \end{memberdesc} ! \begin{notice} ! The use of a \class{CDATASection} node does not indicate that the ! node represents a complete CDATA marked section, only that the ! content of the node was part of a CDATA section. A single CDATA ! section may be represented by more than one node in the document ! tree. There is no way to determine whether two adjacent ! \class{CDATASection} nodes represent different CDATA marked ! sections. ! \end{notice} *************** *** 696,700 **** \versionadded{2.1} ! The DOM Level 2 recommendation defines a single exception, \exception{DOMException}, and a number of constants that allow applications to determine what sort of error occurred. --- 705,709 ---- \versionadded{2.1} ! The DOM Level~2 recommendation defines a single exception, \exception{DOMException}, and a number of constants that allow applications to determine what sort of error occurred. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** tkinter.tex 31 May 2002 18:21:56 -0000 1.12 --- tkinter.tex 28 Apr 2003 17:33:58 -0000 1.12.2.1 *************** *** 39,45 **** The \module{Tkinter} module (``Tk interface'') is the standard Python ! interface to the Tk GUI toolkit, now maintained at ActiveState. Both ! Tk and \module{Tkinter} are available on most \UNIX{} platforms, as well ! as on Windows and Macintosh systems. \begin{seealso} --- 39,46 ---- The \module{Tkinter} module (``Tk interface'') is the standard Python ! interface to the Tk GUI toolkit. Both Tk and \module{Tkinter} are ! available on most \UNIX{} platforms, as well as on Windows and ! Macintosh systems. (Tk itself is not part of Python; it is maintained ! at ActiveState.) \begin{seealso} *************** *** 472,486 **** The options supported by a given widget are listed in that widget's man page, or can be queried at runtime by calling the ! \kbd{config()} method with arguments, or by calling the keys() ! method on that widget. The return value of these calls is a dictionary ! whose key is the name of the option (e.g. \kbd{relief}) and whose ! values are 5 tuples. ! (Some options, like \kbd{bg} are synonyms for common options with ! hard-to-type names (\kbd{bg} is shorthand for "background"). ! Passing the \kbd{config()} method the name of a ! shorthand option will return a 2-tuple, not 5-tuple. The 2-tuple ! passed back will contain the name of the synonym ``real'' ! option. (\kbd{bg}, \kbd{background})) \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example} --- 473,487 ---- The options supported by a given widget are listed in that widget's man page, or can be queried at runtime by calling the ! \method{config()} method without arguments, or by calling the ! \method{keys()} method on that widget. The return value of these ! calls is a dictionary whose key is the name of the option as a string ! (for example, \code{'relief'}) and whose values are 5-tuples. ! Some options, like \code{bg} are synonyms for common options with long ! names (\code{bg} is shorthand for "background"). Passing the ! \code{config()} method the name of a shorthand option will return a ! 2-tuple, not 5-tuple. The 2-tuple passed back will contain the name of ! the synonym and the ``real'' option (such as \code{('bg', ! 'background')}). \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example} *************** *** 692,696 **** \item[boolean] ! You can pass integers 0 or 1 or the stings \code{"yes"} or \code{"no"} . \item[callback] --- 693,697 ---- \item[boolean] ! You can pass integers 0 or 1 or the strings \code{"yes"} or \code{"no"} . \item[callback] *************** *** 881,884 **** --- 882,903 ---- \end{description} + \subsubsection{Images} + + Bitmap/Pixelmap images can be created through the subclasses of + \class{Tkinter.Image}: + + \begin{itemize} + \item \class{BitmapImage} can be used for X11 bitmap data. + \item \class{PhotoImage} can be used for GIF and PPM/PGM color bitmaps. + \end{itemize} + + Either type of image is created through either the \code{file} or the + \code{data} option (other options are available as well). + + The image object can then be used wherever an \code{image} option is + supported by some widget (e.g. labels, buttons, menus). In these + cases, Tk will not keep a reference to the image. When the last Python + reference to the image object is deleted, the image data is deleted as + well, and Tk will display an empty box wherever the image was used. \section{\module{Tix} --- *************** *** 1819,1831 **** derived class which simply adds or redefines the desired behavior. } ! \seetitle[http://www.daa.com.au/\~james/pygtk/]{PyGTK}{ is a set of bindings for the \ulink{GTK}{http://www.gtk.org/} widget set. It provides an object oriented interface that is slightly higher level than the C one. It automatically does all the type casting and reference counting that you would have to do normally with the C ! API. There are also \ulink{bindings}{http://www.daa.com.au/\~james/gnome/} to \ulink{GNOME}{http://www.gnome.org}, and a \ulink{tutorial} ! {http://laguna.fmedic.unam.mx/\~daniel/pygtutorial/pygtutorial/index.html} is available. } --- 1838,1851 ---- derived class which simply adds or redefines the desired behavior. } ! \seetitle[http://www.daa.com.au/\textasciitilde james/pygtk/]{PyGTK}{ is a set of bindings for the \ulink{GTK}{http://www.gtk.org/} widget set. It provides an object oriented interface that is slightly higher level than the C one. It automatically does all the type casting and reference counting that you would have to do normally with the C ! API. There are also ! \ulink{bindings}{http://www.daa.com.au/\textasciitilde james/gnome/} to \ulink{GNOME}{http://www.gnome.org}, and a \ulink{tutorial} ! {http://laguna.fmedic.unam.mx/\textasciitilde daniel/pygtutorial/pygtutorial/index.html} is available. } Index: markup.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/markup.tex,v retrieving revision 1.1 retrieving revision 1.1.26.1 diff -C2 -d -r1.1 -r1.1.26.1 *** markup.tex 5 Jul 2000 02:24:38 -0000 1.1 --- markup.tex 28 Apr 2003 17:34:02 -0000 1.1.26.1 *************** *** 8,10 **** --- 8,29 ---- Extensible Markup Language (XML). + It is important to note that modules in the \module{xml} package + require that there be at least one SAX-compliant XML parser available. + Starting with Python 2.3, the Expat parser is included with Python, so + the \refmodule{xml.parsers.expat} module will always be available. + You may still want to be aware of the \ulink{PyXML add-on + package}{http://pyxml.sourceforge.net/}; that package provides an + extended set of XML libraries for Python. + + The documentation for the \module{xml.dom} and \module{xml.sax} + packages are the definition of the Python bindings for the DOM and SAX + interfaces. + \localmoduletable + + \begin{seealso} + \seetitle[http://pyxml.sourceforge.net/] + {Python/XML Libraries} + {Home page for the PyXML package, containing an extension + of \module{xml} package bundled with Python.} + \end{seealso} Index: libzipfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzipfile.tex,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** libzipfile.tex 9 Apr 2002 18:15:00 -0000 1.14 --- libzipfile.tex 28 Apr 2003 17:34:03 -0000 1.14.2.1 *************** *** 147,155 **** \end{methoddesc} ! \begin{methoddesc}{writestr}{zinfo, bytes} ! Write the string \var{bytes} to the archive; meta-information is ! given as the \class{ZipInfo} instance \var{zinfo}. At least the ! filename, date, and time must be given by \var{zinfo}. The archive ! must be opened with mode \code{'w'} or \code{'a'}. \end{methoddesc} --- 147,157 ---- \end{methoddesc} ! \begin{methoddesc}{writestr}{zinfo_or_arcname, bytes} ! Write the string \var{bytes} to the archive; \var{zinfo_or_arcname} ! is either the file name it will be given in the archive, or a ! \class{ZipInfo} instance. If it's an instance, at least the ! filename, date, and time must be given. If it's a name, the date ! and time is set to the current date and time. The archive must be ! opened with mode \code{'w'} or \code{'a'}. \end{methoddesc} Index: libxreadlines.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxreadlines.tex,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** libxreadlines.tex 6 May 2002 16:02:42 -0000 1.3 --- libxreadlines.tex 28 Apr 2003 17:34:05 -0000 1.3.2.1 *************** *** 7,10 **** --- 7,11 ---- \versionadded{2.1} + \deprecated{2.3}{Use \code{for line in file} instead.} This module defines a new object type which can efficiently iterate Index: libxmlrpclib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxmlrpclib.tex,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** libxmlrpclib.tex 14 Jun 2002 00:33:02 -0000 1.9 --- libxmlrpclib.tex 28 Apr 2003 17:34:05 -0000 1.9.2.1 *************** *** 3,7 **** \declaremodule{standard}{xmlrpclib} \modulesynopsis{XML-RPC client access.} ! \moduleauthor{Fredrik Lundh}{effbot@telia.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} --- 3,7 ---- \declaremodule{standard}{xmlrpclib} \modulesynopsis{XML-RPC client access.} ! \moduleauthor{Fredrik Lundh}{fredrik@pythonware.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} *************** *** 28,31 **** --- 28,38 ---- optional third argument is an encoding, by default UTF-8. The optional fourth argument is a debugging flag. + + Both the HTTP and HTTPS transports support the URL syntax extension for + HTTP Basic Authentication: \code{http://user:pass@host:port/path}. The + \code{user:pass} portion will be base64-encoded as an HTTP `Authorization' + header, and sent to the remote server as part of the connection process + when invoking an XML-RPC method. You only need to use this if the + remote server requires a Basic Authentication user and password. The returned instance is a proxy object with methods that can be used Index: libxdrlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxdrlib.tex,v retrieving revision 1.23 retrieving revision 1.23.26.1 diff -C2 -d -r1.23 -r1.23.26.1 *** libxdrlib.tex 10 Oct 2000 17:02:34 -0000 1.23 --- libxdrlib.tex 28 Apr 2003 17:34:06 -0000 1.23.26.1 *************** *** 34,38 **** defined the encoding of data which was XDR at the time this module was originally written. It has ! appearantly been obsoleted by \rfc{1832}.} \seerfc{1832}{XDR: External Data Representation Standard}{Newer RFC --- 34,38 ---- defined the encoding of data which was XDR at the time this module was originally written. It has ! apparently been obsoleted by \rfc{1832}.} \seerfc{1832}{XDR: External Data Representation Standard}{Newer RFC Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.17 retrieving revision 1.17.8.1 diff -C2 -d -r1.17 -r1.17.8.1 *** libweakref.tex 8 Dec 2001 18:02:49 -0000 1.17 --- libweakref.tex 28 Apr 2003 17:34:06 -0000 1.17.8.1 *************** *** 218,222 **** object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. ! For example, the instance type is defined with the following structure: \begin{verbatim} --- 218,224 ---- object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. ! Also, it needs to add \constant{Py_TPFLAGS_HAVE_WEAKREFS} to the ! tp_flags slot. For example, the instance type is defined with the ! following structure: \begin{verbatim} *************** *** 239,244 **** /* Lots of stuff omitted for brevity... */ ! offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */ }; \end{verbatim} --- 241,265 ---- /* Lots of stuff omitted for brevity... */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ }; + \end{verbatim} + + The type constructor is responsible for initializing the weak reference + list to \NULL: + + \begin{verbatim} + static PyObject * + instance_new() { + /* Other initialization stuff omitted for brevity */ + + self->in_weakreflist = NULL; + + return (PyObject *) self; + } \end{verbatim} Index: libwarnings.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwarnings.tex,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** libwarnings.tex 21 Mar 2002 12:58:54 -0000 1.9 --- libwarnings.tex 28 Apr 2003 17:34:08 -0000 1.9.2.1 *************** *** 69,72 **** --- 69,75 ---- runtime features.} + \lineii{FutureWarning}{Base category for warnings about constructs + that will change semantically in the future.} + \end{tableii} *************** *** 114,125 **** \end{tableii} ! \item \var{message} is a compiled regular expression that the warning ! message must match (the match is case-insensitive) \item \var{category} is a class (a subclass of \exception{Warning}) of which the warning category must be a subclass in order to match ! \item \var{module} is a compiled regular expression that the module ! name must match \item \var{lineno} is an integer that the line number where the --- 117,129 ---- \end{tableii} ! \item \var{message} is a string containing a regular expression that ! the warning message must match (the match is compiled to always be ! case-insensitive) \item \var{category} is a class (a subclass of \exception{Warning}) of which the warning category must be a subclass in order to match ! \item \var{module} is a string containing a regular expression that the module ! name must match (the match is compiled to be case-sensitive) \item \var{lineno} is an integer that the line number where the Index: libuu.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libuu.tex,v retrieving revision 1.11 retrieving revision 1.11.18.1 diff -C2 -d -r1.11 -r1.11.18.1 *** libuu.tex 17 Aug 2001 20:01:06 -0000 1.11 --- libuu.tex 28 Apr 2003 17:34:08 -0000 1.11.18.1 *************** *** 15,19 **** standard input or output. However, this interface is deprecated; it's better for the caller to open the file itself, and be sure that, when ! required, the mode is \code{'rb'} or \code{'wb'} on Windows or DOS. This code was contributed by Lance Ellinghouse, and modified by Jack --- 15,19 ---- standard input or output. However, this interface is deprecated; it's better for the caller to open the file itself, and be sure that, when ! required, the mode is \code{'rb'} or \code{'wb'} on Windows. This code was contributed by Lance Ellinghouse, and modified by Jack Index: libuserdict.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libuserdict.tex,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -C2 -d -r1.21 -r1.21.2.1 *** libuserdict.tex 30 Jun 2002 04:32:38 -0000 1.21 --- libuserdict.tex 28 Apr 2003 17:34:09 -0000 1.21.2.1 *************** *** 16,20 **** can add new behaviors to dictionaries. ! The \module{UserDict} module defines the \class{UserDict} class: \begin{classdesc}{UserDict}{\optional{initialdata}} --- 16,26 ---- can add new behaviors to dictionaries. ! The module also defines a mixin defining all dictionary methods for ! classes that already have a minimum mapping interface. This greatly ! simplifies writing classes that need to be substitutable for ! dictionaries (such as the shelve module). ! ! The \module{UserDict} module defines the \class{UserDict} class ! and \class{DictMixin}: \begin{classdesc}{UserDict}{\optional{initialdata}} *************** *** 35,38 **** --- 41,62 ---- class. \end{memberdesc} + + \begin{classdesc}{DictMixin}{} + Mixin defining all dictionary methods for classes that already have + a minimum dictionary interface including \method{__getitem__()}, + \method{__setitem__()}, \method{__delitem__()}, and \method{keys()}. + + This mixin should be used as a superclass. Adding each of the + above methods adds progressively more functionality. For instance, + defining all but \method{__delitem__} will preclude only \method{pop} + and \method{popitem} from the full interface. + + In addition to the four base methods, progessively more efficiency + comes with defining \method{__contains__()}, \method{__iter__()}, and + \method{iteritems()}. + + Since the mixin has no knowledge of the subclass constructor, it + does not define \method{__init__()} or \method{copy()}. + \end{classdesc} Index: liburlparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburlparse.tex,v retrieving revision 1.20 retrieving revision 1.20.8.1 diff -C2 -d -r1.20 -r1.20.8.1 *** liburlparse.tex 16 Nov 2001 03:22:15 -0000 1.20 --- liburlparse.tex 28 Apr 2003 17:34:09 -0000 1.20.8.1 *************** *** 106,109 **** --- 106,116 ---- \end{funcdesc} + \begin{funcdesc}{urldefrag}{url} + If \var{url} contains a fragment identifier, returns a modified + version of \var{url} with no fragment identifier, and the fragment + identifier as a separate string. If there is no fragment identifier + in \var{url}, returns \var{url} unmodified and an empty string. + \end{funcdesc} + \begin{seealso} *************** *** 113,117 **** \seerfc{1808}{Relative Uniform Resource Locators}{ This Request For Comments includes the rules for joining an ! absolute and a relative URL, including a fair normal of ``Abnormal Examples'' which govern the treatment of border cases.} --- 120,124 ---- \seerfc{1808}{Relative Uniform Resource Locators}{ This Request For Comments includes the rules for joining an ! absolute and a relative URL, including a fair number of ``Abnormal Examples'' which govern the treatment of border cases.} Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.6 retrieving revision 1.6.10.1 diff -C2 -d -r1.6 -r1.6.10.1 *** liburllib2.tex 9 Nov 2001 03:49:29 -0000 1.6 --- liburllib2.tex 28 Apr 2003 17:34:10 -0000 1.6.10.1 *************** *** 218,221 **** --- 218,227 ---- \end{methoddesc} + \begin{methoddesc}[Request]{get_method}{} + Return a string indicating the HTTP request method. This is only + meaningful for HTTP requests, and currently always takes one of the + values ("GET", "POST"). + \end{methoddesc} + \begin{methoddesc}[Request]{has_data}{} Return whether the instance has a non-\code{None} data. *************** *** 395,403 **** \end{methoddesc} - \subsection{HTTPRedirectHandler Objects \label{http-redirect-handler}} ! \note{303 redirection is not supported by this version of ! \module{urllib2}.} \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, --- 401,428 ---- \end{methoddesc} \subsection{HTTPRedirectHandler Objects \label{http-redirect-handler}} ! \note{Some HTTP redirections require action from this module's client ! code. If this is the case, \exception{HTTPError} is raised. See ! \rfc{2616} for details of the precise meanings of the various ! redirection codes.} ! ! \begin{methoddesc}[HTTPRedirectHandler]{redirect_request}{req, ! fp, code, msg, hdrs} ! Return a \class{Request} or \code{None} in response to a redirect. ! This is called by the default implementations of the ! \code{http_error_30x()} methods when a redirection is received from ! the server. If a redirection should take place, return a new ! \class{Request} to allow \code{http_error_30x()} to perform the ! redirect. Otherwise, raise \exception{HTTPError} if no other ! \class{Handler} should try to handle this URL, or return \code{None} ! if you can't but another \class{Handler} might. ! ! \note{The default implementation of this method does not strictly ! follow \rfc{2616}: it allows automatic 302 redirection of POST ! requests, because essentially all HTTP clients do this.} ! ! \end{methoddesc} ! \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, *************** *** 405,409 **** Redirect to the \code{Location:} URL. This method is called by the parent \class{OpenerDirector} when getting an HTTP ! permanent-redirect response. \end{methoddesc} --- 430,434 ---- Redirect to the \code{Location:} URL. This method is called by the parent \class{OpenerDirector} when getting an HTTP ! `moved permanently' response. \end{methoddesc} *************** *** 411,417 **** fp, code, msg, hdrs} The same as \method{http_error_301()}, but called for the ! temporary-redirect response. \end{methoddesc} \subsection{ProxyHandler Objects \label{proxy-handler}} --- 436,447 ---- fp, code, msg, hdrs} The same as \method{http_error_301()}, but called for the ! `found' response. \end{methoddesc} + \begin{methoddesc}[HTTPRedirectHandler]{http_error_303}{req, + fp, code, msg, hdrs} + The same as \method{http_error_301()}, but called for the + `see other' redirect response. + \end{methoddesc} \subsection{ProxyHandler Objects \label{proxy-handler}} Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.43 retrieving revision 1.43.2.1 diff -C2 -d -r1.43 -r1.43.2.1 *** liburllib.tex 4 Apr 2002 20:58:02 -0000 1.43 --- liburllib.tex 28 Apr 2003 17:34:11 -0000 1.43.2.1 *************** *** 28,32 **** supports the following methods: \method{read()}, \method{readline()}, \method{readlines()}, \method{fileno()}, \method{close()}, ! \method{info()} and \method{geturl()}. Except for the \method{info()} and \method{geturl()} methods, --- 28,33 ---- supports the following methods: \method{read()}, \method{readline()}, \method{readlines()}, \method{fileno()}, \method{close()}, ! \method{info()} and \method{geturl()}. It also has proper support for ! the iterator protocol. Except for the \method{info()} and \method{geturl()} methods, *************** *** 61,65 **** \var{data} argument may be given to specify a \code{POST} request (normally the request type is \code{GET}). The \var{data} argument ! must in standard \mimetype{application/x-www-form-urlencoded} format; see the \function{urlencode()} function below. --- 62,66 ---- \var{data} argument may be given to specify a \code{POST} request (normally the request type is \code{GET}). The \var{data} argument ! must be in standard \mimetype{application/x-www-form-urlencoded} format; see the \function{urlencode()} function below. *************** *** 78,82 **** \end{verbatim} ! In a Windows environment, if no proxy envvironment variables are set, proxy settings are obtained from the registry's Internet Settings section. --- 79,83 ---- \end{verbatim} ! In a Windows environment, if no proxy environment variables are set, proxy settings are obtained from the registry's Internet Settings section. *************** *** 100,104 **** filehandle = urllib.urlopen(some_url, proxies=None) filehandle = urllib.urlopen(some_url) ! \end{verbatim} The \function{urlopen()} function does not support explicit proxy --- 101,105 ---- filehandle = urllib.urlopen(some_url, proxies=None) filehandle = urllib.urlopen(some_url) ! \end{verbatim} The \function{urlopen()} function does not support explicit proxy *************** *** 119,126 **** \code{(\var{filename}, \var{headers})} where \var{filename} is the local file name under which the object can be found, and \var{headers} ! is either \code{None} (for a local object) or whatever the ! \method{info()} method of the object returned by \function{urlopen()} ! returned (for a remote object, possibly cached). Exceptions are the ! same as for \function{urlopen()}. The second argument, if present, specifies the file location to copy --- 120,126 ---- \code{(\var{filename}, \var{headers})} where \var{filename} is the local file name under which the object can be found, and \var{headers} ! is whatever the \method{info()} method of the object returned by ! \function{urlopen()} returned (for a remote object, possibly cached). ! Exceptions are the same as for \function{urlopen()}. The second argument, if present, specifies the file location to copy *************** *** 131,135 **** count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be \code{-1} on older ! FTP servers which do not return a file size in response to a retrieval request. --- 131,135 ---- count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be \code{-1} on older ! FTP servers which do not return a file size in response to a retrieval request. *************** *** 141,144 **** --- 141,168 ---- \end{funcdesc} + \begin{datadesc}{_urlopener} + The public functions \function{urlopen()} and + \function{urlretrieve()} create an instance of the + \class{FancyURLopener} class and use it to perform their requested + actions. To override this functionality, programmers can create a + subclass of \class{URLopener} or \class{FancyURLopener}, then assign + that an instance of that class to the + \code{urllib._urlopener} variable before calling the desired function. + For example, applications may want to specify a different + \mailheader{User-Agent} header than \class{URLopener} defines. This + can be accomplished with the following code: + + \begin{verbatim} + import urllib + + class AppURLopener(urllib.FancyURLopener): + def __init__(self, *args): + self.version = "App/1.7" + urllib.FancyURLopener.__init__(self, *args) + + urllib._urlopener = AppURLopener() + \end{verbatim} + \end{datadesc} + \begin{funcdesc}{urlcleanup}{} Clear the cache that may have been built up by previous calls to *************** *** 148,152 **** \begin{funcdesc}{quote}{string\optional{, safe}} Replace special characters in \var{string} using the \samp{\%xx} escape. ! Letters, digits, and the characters \character{_,.-} are never quoted. The optional \var{safe} parameter specifies additional characters that should not be quoted --- its default value is \code{'/'}. --- 172,176 ---- \begin{funcdesc}{quote}{string\optional{, safe}} Replace special characters in \var{string} using the \samp{\%xx} escape. ! Letters, digits, and the characters \character{_.-} are never quoted. The optional \var{safe} parameter specifies additional characters that should not be quoted --- its default value is \code{'/'}. *************** *** 158,162 **** Like \function{quote()}, but also replaces spaces by plus signs, as required for quoting HTML form values. Plus signs in the original ! string are escaped unless they are included in \var{safe}. \end{funcdesc} --- 182,187 ---- Like \function{quote()}, but also replaces spaces by plus signs, as required for quoting HTML form values. Plus signs in the original ! string are escaped unless they are included in \var{safe}. It also ! does not have \var{safe} default to \code{'/'}. \end{funcdesc} *************** *** 174,178 **** \begin{funcdesc}{urlencode}{query\optional{, doseq}} Convert a mapping object or a sequence of two-element tuples to a ! ``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} --- 199,203 ---- \begin{funcdesc}{urlencode}{query\optional{, doseq}} Convert a mapping object or a sequence of two-element tuples to a ! ``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} *************** *** 187,211 **** order of parameters in the encoded string will match the order of parameter tuples in the sequence. \end{funcdesc} ! The public functions \function{urlopen()} and ! \function{urlretrieve()} create an instance of the ! \class{FancyURLopener} class and use it to perform their requested ! actions. To override this functionality, programmers can create a ! subclass of \class{URLopener} or \class{FancyURLopener}, then assign ! that an instance of that class to the ! \code{urllib._urlopener} variable before calling the desired function. ! For example, applications may want to specify a different ! \mailheader{User-Agent} header than \class{URLopener} defines. This ! can be accomplished with the following code: ! ! \begin{verbatim} ! class AppURLopener(urllib.FancyURLopener): ! def __init__(self, *args): ! self.version = "App/1.7" ! urllib.FancyURLopener.__init__(self, *args) ! urllib._urlopener = AppURLopener() ! \end{verbatim} \begin{classdesc}{URLopener}{\optional{proxies\optional{, **x509}}} --- 212,232 ---- order of parameters in the encoded string will match the order of parameter tuples in the sequence. + The \refmodule{cgi} module provides the functions + \function{parse_qs()} and \function{parse_qsl()} which are used to + parse query strings into Python data structures. \end{funcdesc} ! \begin{funcdesc}{pathname2url}{path} ! Convert the pathname \var{path} from the local syntax for a path to ! the form used in the path component of a URL. This does not produce a ! complete URL. The return value will already be quoted using the ! \function{quote()} function. ! \end{funcdesc} ! \begin{funcdesc}{url2pathname}{path} ! Convert the path component \var{path} from an encoded URL to the local ! syntax for a path. This does not accept a complete URL. This ! function uses \function{unquote()} to decode \var{path}. ! \end{funcdesc} \begin{classdesc}{URLopener}{\optional{proxies\optional{, **x509}}} *************** *** 237,246 **** \begin{classdesc}{FancyURLopener}{...} \class{FancyURLopener} subclasses \class{URLopener} providing default ! handling for the following HTTP response codes: 301, 302 or 401. For ! 301 and 302 response codes, the \mailheader{Location} header is used to ! fetch the actual URL. For 401 response codes (authentication ! required), basic HTTP authentication is performed. For 301 and 302 response ! codes, recursion is bounded by the value of the \var{maxtries} attribute, ! which defaults 10. The parameters to the constructor are the same as those for --- 258,273 ---- \begin{classdesc}{FancyURLopener}{...} \class{FancyURLopener} subclasses \class{URLopener} providing default ! handling for the following HTTP response codes: 301, 302, 303 and 401. ! For 301, 302 and 303 response codes, the \mailheader{Location} header ! is used to fetch the actual URL. For 401 response codes ! (authentication required), basic HTTP authentication is performed. ! For 301, 302 and 303 response codes, recursion is bounded by the value ! of the \var{maxtries} attribute, which defaults 10. ! ! \note{According to the letter of \rfc{2616}, 301 and 302 responses to ! POST requests must not be automatically redirected without ! confirmation by the user. In reality, browsers do allow automatic ! redirection of these responses, changing the POST to a GET, and ! \module{urllib} reproduces this behaviour.} The parameters to the constructor are the same as those for *************** *** 317,324 **** \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}} ! Open \var{fullurl} using the appropriate protocol. This method sets up cache and proxy information, then calls the appropriate open method with its input arguments. If the scheme is not recognized, ! \method{open_unknown()} is called. The \var{data} argument has the same meaning as the \var{data} argument of \function{urlopen()}. \end{methoddesc} --- 344,351 ---- \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}} ! Open \var{fullurl} using the appropriate protocol. This method sets up cache and proxy information, then calls the appropriate open method with its input arguments. If the scheme is not recognized, ! \method{open_unknown()} is called. The \var{data} argument has the same meaning as the \var{data} argument of \function{urlopen()}. \end{methoddesc} Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** libunittest.tex 2 Jul 2002 22:46:42 -0000 1.9 --- libunittest.tex 28 Apr 2003 17:34:11 -0000 1.9.2.1 *************** *** 8,11 **** --- 8,12 ---- \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} + \versionadded{2.1} The Python unit testing framework, often referred to as ``PyUnit,'' is *************** *** 51,55 **** The test case and test fixture concepts are supported through the \class{TestCase} and \class{FunctionTestCase} classes; the former ! should be used when creating new tests, and the later can be used when integrating existing test code with a PyUnit-driven framework. When building test fixtures using \class{TestCase}, the \method{setUp()} --- 52,56 ---- The test case and test fixture concepts are supported through the \class{TestCase} and \class{FunctionTestCase} classes; the former ! should be used when creating new tests, and the latter can be used when integrating existing test code with a PyUnit-driven framework. When building test fixtures using \class{TestCase}, the \method{setUp()} *************** *** 298,302 **** \item The test module can be run standalone from the command line. \item The test code can more easily be separated from shipped code. ! \item There is less temptation to change test code to fit the code. it tests without a good reason. \item Test code should be modified much less frequently than the --- 299,303 ---- \item The test module can be run standalone from the command line. \item The test code can more easily be separated from shipped code. ! \item There is less temptation to change test code to fit the code it tests without a good reason. \item Test code should be modified much less frequently than the *************** *** 499,502 **** --- 500,527 ---- computed to include representations of both \var{first} and \var{second}. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{assertAlmostEqual}{first, second\optional{, + places\optional{, msg}}} + \methodline{failUnlessAlmostEqual}{first, second\optional{, + places\optional{, msg}}} + Test that \var{first} and \var{second} are approximately equal + by computing the difference, rounding to the given number of \var{places}, + and comparing to zero. Note that comparing a given number of decimal places + is not the same as comparing a given number of significant digits. + If the values do not compare equal, the test will fail with the explanation + given by \var{msg}, or \code{None}. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{assertNotAlmostEqual}{first, second\optional{, + places\optional{, msg}}} + \methodline{failIfAlmostEqual}{first, second\optional{, + places\optional{, msg}}} + Test that \var{first} and \var{second} are not approximately equal + by computing the difference, rounding to the given number of \var{places}, + and comparing to zero. Note that comparing a given number of decimal places + is not the same as comparing a given number of significant digits. + If the values do not compare equal, the test will fail with the explanation + given by \var{msg}, or \code{None}. \end{methoddesc} Index: libunicodedata.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunicodedata.tex,v retrieving revision 1.3 retrieving revision 1.3.24.1 diff -C2 -d -r1.3 -r1.3.24.1 *** libunicodedata.tex 24 Jan 2001 08:10:07 -0000 1.3 --- libunicodedata.tex 28 Apr 2003 17:34:13 -0000 1.3.24.1 *************** *** 6,10 **** \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \index{Unicode} --- 6,10 ---- \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \index{Unicode} *************** *** 15,22 **** defines character properties for all Unicode characters. The data in this database is based on the \file{UnicodeData.txt} file version ! 3.0.0 which is publically available from \url{ftp://ftp.unicode.org/}. The module uses the same names and symbols as defined by the ! UnicodeData File Format 3.0.0 (see \url{http://www.unicode.org/Public/UNIDATA/UnicodeData.html}). It defines the following functions: --- 15,22 ---- defines character properties for all Unicode characters. The data in this database is based on the \file{UnicodeData.txt} file version ! 3.2.0 which is publically available from \url{ftp://ftp.unicode.org/}. The module uses the same names and symbols as defined by the ! UnicodeData File Format 3.2.0 (see \url{http://www.unicode.org/Public/UNIDATA/UnicodeData.html}). It defines the following functions: *************** *** 84,85 **** --- 84,126 ---- no such mapping is defined. \end{funcdesc} + + \begin{funcdesc}{normalize}{form, unistr} + + Return the normal form \var{form} for the Unicode string \var{unistr}. + Valid values for \var{form} are 'NFC', 'NFKC', 'NFD', and 'NFKD'. + + The Unicode standard defines various normalization forms of a Unicode + string, based on the definition of canonical equivalence and + compatibility equivalence. In Unicode, several characters can be + expressed in various way. For example, the character U+00C7 (LATIN + CAPITAL LETTER C WITH CEDILLA) can also be expressed as the sequence + U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA). + + For each character, there are two normal forms: normal form C and + normal form D. Normal form D (NFD) is also known as canonical + decomposition, and translates each character into its decomposed form. + Normal form C (NFC) first applies a canonical decomposition, then + composes pre-combined characters again. + + In addition to these two forms, there two additional normal forms + based on compatibility equivalence. In Unicode, certain characters are + supported which normally would be unified with other characters. For + example, U+2160 (ROMAN NUMERAL ONE) is really the same thing as U+0049 + (LATIN CAPITAL LETTER I). However, it is supported in Unicode for + compatibility with existing character sets (e.g. gb2312). + + The normal form KD (NFKD) will apply the compatibility decomposition, + i.e. replace all compatibility characters with their equivalents. The + normal form KC (NFKC) first applies the compatibility decomposition, + followed by the canonical composition. + + \versionadded{2.3} + \end{funcdesc} + + In addition, the module exposes the following constant: + + \begin{datadesc}{unidata_version} + The version of the Unicode database used in this module. + + \versionadded{2.3} + \end{datadesc} \ No newline at end of file Index: libundoc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libundoc.tex,v retrieving revision 1.81 retrieving revision 1.81.8.1 diff -C2 -d -r1.81 -r1.81.8.1 *** libundoc.tex 26 Nov 2001 21:38:50 -0000 1.81 --- libundoc.tex 28 Apr 2003 17:34:14 -0000 1.81.8.1 *************** *** 34,37 **** --- 34,45 ---- --- Import hook support (for \refmodule{rexec}; may become obsolete). + \item[\module{platform}] + --- This module tries to retrieve as much platform identifying data as + possible. It makes this information available via function APIs. + If called from the command line, it prints the platform information + concatenated as single string to \code{sys.stdout}. The output format + is useable as part of a filename. + \versionadded{2.3} + \item[\module{smtpd}] --- An SMTP daemon implementation which meets the minimum requirements *************** *** 47,53 **** \begin{description} - \item[\module{dospath}] - --- Implementation of \module{os.path} on MS-DOS. - \item[\module{ntpath}] --- Implementation on \module{os.path} on Win32, Win64, WinCE, and --- 55,58 ---- *************** *** 65,68 **** --- 70,77 ---- --- Platform-independent API for playing audio data. + \item[\module{linuxaudiodev}] + --- Play audio data on the Linux audio device. Replaced in Python 2.3 + by the \module{ossaudiodev} module. + \item[\module{sunaudio}] --- Interpret Sun audio headers (may become obsolete or a tool/demo). *************** *** 71,74 **** --- 80,87 ---- --- Convert "arbitrary" sound files to AIFF files; should probably become a tool or demo. Requires the external program \program{sox}. + + \item[\module{ossaudiodev}] + --- Play audio data via the Open Sound System API. This is usable on + Linux, some flavors of BSD, and some commercial \UNIX{} platforms. \end{description} Index: libtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtypes.tex,v retrieving revision 1.54 retrieving revision 1.54.2.1 diff -C2 -d -r1.54 -r1.54.2.1 *** libtypes.tex 22 May 2002 02:44:24 -0000 1.54 --- libtypes.tex 28 Apr 2003 17:34:16 -0000 1.54.2.1 *************** *** 1,12 **** \section{\module{types} --- ! Names for all built-in types} \declaremodule{standard}{types} ! \modulesynopsis{Names for all built-in types.} ! This module defines names for all object types that are used by the ! standard Python interpreter, but not for the types defined by various ! extension modules. It is safe to use \samp{from types import *} --- the module does not export any names besides the ones listed here. New names exported by future versions of this module will all end in --- 1,14 ---- \section{\module{types} --- ! Names for built-in types} \declaremodule{standard}{types} ! \modulesynopsis{Names for built-in types.} ! This module defines names for some object types that are used by ! the standard Python interpreter, but not for the types defined by various ! extension modules. Also, it does not include some of the types that ! arise during processing such the \code{listiterator} type. ! It is safe to use \samp{from types import *} --- the module does not export any names besides the ones listed here. New names exported by future versions of this module will all end in *************** *** 18,26 **** \begin{verbatim} from types import * ! def delete(list, item): if type(item) is IntType: ! del list[item] else: ! list.remove(item) \end{verbatim} --- 20,42 ---- \begin{verbatim} from types import * ! def delete(mylist, item): if type(item) is IntType: ! del mylist[item] else: ! mylist.remove(item) ! \end{verbatim} ! ! Starting in Python 2.2, built-in factory functions such as ! \function{int()} and \function{str()} are also names for the ! corresponding types. This is now the preferred way to access ! the type instead of using the \module{types} module. Accordingly, ! the example above should be written as follows: ! ! \begin{verbatim} ! def delete(mylist, item): ! if isinstance(item, int): ! del mylist[item] ! else: ! mylist.remove(item) \end{verbatim} Index: libturtle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libturtle.tex,v retrieving revision 1.4 retrieving revision 1.4.10.1 diff -C2 -d -r1.4 -r1.4.10.1 *** libturtle.tex 15 Nov 2001 20:41:03 -0000 1.4 --- libturtle.tex 28 Apr 2003 17:34:16 -0000 1.4.10.1 *************** *** 96,102 **** \begin{funcdesc}{circle}{radius\optional{, extent}} ! Draw a circle with radius \var{radius} whose center-point is where the ! pen would be if a \code{forward(\var{radius})} were ! called. \var{extent} determines which part of a circle is drawn: if not given it defaults to a full circle. --- 96,102 ---- \begin{funcdesc}{circle}{radius\optional{, extent}} ! Draw a circle with radius \var{radius} whose center-point is ! \var{radius} units left of the turtle. ! \var{extent} determines which part of a circle is drawn: if not given it defaults to a full circle. *************** *** 104,108 **** current pen position. The arc is drawn in a counter clockwise direction if \var{radius} is positive, otherwise in a clockwise ! direction. \end{funcdesc} --- 104,109 ---- current pen position. The arc is drawn in a counter clockwise direction if \var{radius} is positive, otherwise in a clockwise ! direction. In the process, the direction of the turtle is changed ! by the amount of the \var{extent}. \end{funcdesc} Index: libtraceback.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtraceback.tex,v retrieving revision 1.14 retrieving revision 1.14.24.1 diff -C2 -d -r1.14 -r1.14.24.1 *** libtraceback.tex 14 Feb 2001 03:20:18 -0000 1.14 --- libtraceback.tex 28 Apr 2003 17:34:17 -0000 1.14.24.1 *************** *** 9,17 **** stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful ! when you want to print stack traces under program control, e.g. in a ``wrapper'' around the interpreter. ! The module uses traceback objects --- this is the object type ! that is stored in the variables \code{sys.exc_traceback} and \code{sys.last_traceback} and returned as the third item from \function{sys.exc_info()}. --- 9,17 ---- stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful ! when you want to print stack traces under program control, such as in a ``wrapper'' around the interpreter. ! The module uses traceback objects --- this is the object type that is ! stored in the variables \code{sys.exc_traceback} (deprecated) and \code{sys.last_traceback} and returned as the third item from \function{sys.exc_info()}. *************** *** 36,55 **** header \samp{Traceback (most recent call last):}; (2) it prints the exception \var{type} and \var{value} after the stack trace; (3) if ! \var{type} is \exception{SyntaxError} and \var{value} has the appropriate ! format, it prints the line where the syntax error occurred with a ! caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} ! This is a shorthand for `\code{print_exception(sys.exc_type,} ! \code{sys.exc_value,} \code{sys.exc_traceback,} \var{limit}\code{,} ! \var{file}\code{)}'. (In fact, it uses \code{sys.exc_info()} to ! retrieve the same information in a thread-safe way.) \end{funcdesc} \begin{funcdesc}{print_last}{\optional{limit\optional{, file}}} ! This is a shorthand for `\code{print_exception(sys.last_type,} ! \code{sys.last_value,} \code{sys.last_traceback,} \var{limit}\code{,} ! \var{file}\code{)}'. \end{funcdesc} --- 36,55 ---- header \samp{Traceback (most recent call last):}; (2) it prints the exception \var{type} and \var{value} after the stack trace; (3) if ! \var{type} is \exception{SyntaxError} and \var{value} has the ! appropriate format, it prints the line where the syntax error occurred ! with a caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} ! This is a shorthand for \code{print_exception(sys.exc_type, ! sys.exc_value, sys.exc_traceback, \var{limit}, \var{file})}. (In ! fact, it uses \function{sys.exc_info()} to retrieve the same ! information in a thread-safe way instead of using the deprecated ! variables.) \end{funcdesc} \begin{funcdesc}{print_last}{\optional{limit\optional{, file}}} ! This is a shorthand for \code{print_exception(sys.last_type, ! sys.last_value, sys.last_traceback, \var{limit}, \var{file})}. \end{funcdesc} *************** *** 94,99 **** \code{sys.last_value}. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; ! however, for \code{SyntaxError} exceptions, it contains several lines ! that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. --- 94,99 ---- \code{sys.last_value}. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; ! however, for \exception{SyntaxError} exceptions, it contains several ! lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. *************** *** 119,126 **** \begin{funcdesc}{tb_lineno}{tb} This function returns the current line number set in the traceback ! object. This is normally the same as the \code{\var{tb}.tb_lineno} ! field of the object, but when optimization is used (the -O flag) this ! field is not updated correctly; this function calculates the correct ! value. \end{funcdesc} --- 119,126 ---- \begin{funcdesc}{tb_lineno}{tb} This function returns the current line number set in the traceback ! object. This function was necessary because in versions of Python ! prior to 2.3 when the \programopt{-O} flag was passed to Python the ! \code{\var{tb}.tb_lineno} was not updated correctly. This function ! has no use in versions past 2.3. \end{funcdesc} Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.48 retrieving revision 1.48.8.1 diff -C2 -d -r1.48 -r1.48.8.1 *** libtime.tex 28 Nov 2001 07:26:15 -0000 1.48 --- libtime.tex 28 Apr 2003 17:34:22 -0000 1.48.8.1 *************** *** 30,39 **** depends on the platform's C library, which generally doesn't have year 2000 issues, since all dates and times are represented internally as ! seconds since the epoch. Functions accepting a time tuple (see below) ! generally require a 4-digit year. For backward compatibility, 2-digit ! years are supported if the module variable \code{accept2dyear} is a ! non-zero integer; this variable is initialized to \code{1} unless the ! environment variable \envvar{PYTHONY2K} is set to a non-empty string, ! in which case it is initialized to \code{0}. Thus, you can set \envvar{PYTHONY2K} to a non-empty string in the environment to require 4-digit years for all year input. When 2-digit years are accepted, they are --- 30,40 ---- depends on the platform's C library, which generally doesn't have year 2000 issues, since all dates and times are represented internally as ! seconds since the epoch. Functions accepting a \class{struct_time} ! (see below) generally require a 4-digit year. For backward ! compatibility, 2-digit years are supported if the module variable ! \code{accept2dyear} is a non-zero integer; this variable is ! initialized to \code{1} unless the environment variable ! \envvar{PYTHONY2K} is set to a non-empty string, in which case it is ! initialized to \code{0}. Thus, you can set \envvar{PYTHONY2K} to a non-empty string in the environment to require 4-digit years for all year input. When 2-digit years are accepted, they are *************** *** 74,104 **** \item ! The time tuple as returned by \function{gmtime()}, \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a tuple of 9 integers: ! \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values} ! \lineiii{0}{year}{(for example, 1993)} ! \lineiii{1}{month}{range [1,12]} ! \lineiii{2}{day}{range [1,31]} ! \lineiii{3}{hour}{range [0,23]} ! \lineiii{4}{minute}{range [0,59]} ! \lineiii{5}{second}{range [0,61]; see \strong{(1)} in \function{strftime()} description} ! \lineiii{6}{weekday}{range [0,6], Monday is 0} ! \lineiii{7}{Julian day}{range [1,366]} ! \lineiii{8}{daylight savings flag}{0, 1 or -1; see below} \end{tableiii} Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as described ! under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as daylight savings flag, passed to \function{mktime()} will usually result in the correct daylight savings state to be filled in. When a tuple with an incorrect length is passed to a function ! expecting a time tuple, or having elements of the wrong type, a \exception{TypeError} is raised. \end{itemize} --- 75,110 ---- \item ! The time value as returned by \function{gmtime()}, \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a sequence of 9 integers. The return values of \function{gmtime()}, ! \function{localtime()}, and \function{strptime()} also offer attribute ! names for individual fields. ! \begin{tableiii}{c|l|l}{textrm}{Index}{Attribute}{Values} ! \lineiii{0}{\member{tm_year}}{(for example, 1993)} ! \lineiii{1}{\member{tm_mon}}{range [1,12]} ! \lineiii{2}{\member{tm_mday}}{range [1,31]} ! \lineiii{3}{\member{tm_hour}}{range [0,23]} ! \lineiii{4}{\member{tm_min}}{range [0,59]} ! \lineiii{5}{\member{tm_sec}}{range [0,61]; see \strong{(1)} in \function{strftime()} description} ! \lineiii{6}{\member{tm_wday}}{range [0,6], Monday is 0} ! \lineiii{7}{\member{tm_yday}}{range [1,366]} ! \lineiii{8}{\member{tm_isdst}}{0, 1 or -1; see below} \end{tableiii} Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as described ! under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as the daylight savings flag, passed to \function{mktime()} will usually result in the correct daylight savings state to be filled in. When a tuple with an incorrect length is passed to a function ! expecting a \class{struct_time}, or having elements of the wrong type, a \exception{TypeError} is raised. + \versionchanged[The time value sequence was changed from a tuple to a + \class{struct_time}, with the addition of attribute names + for the fields]{2.2} \end{itemize} *************** *** 120,131 **** \end{datadesc} ! \begin{funcdesc}{asctime}{\optional{tuple}} ! Convert a tuple representing a time as returned by \function{gmtime()} or \function{localtime()} to a 24-character string of the following form: ! \code{'Sun Jun 20 23:21:05 1993'}. If \var{tuple} is not provided, the current time as returned by \function{localtime()} is used. \note{Unlike the C function of the same name, there is no trailing newline.} ! \versionchanged[Allowed \var{tuple} to be omitted]{2.1} \end{funcdesc} --- 126,139 ---- \end{datadesc} ! \begin{funcdesc}{asctime}{\optional{t}} ! Convert a tuple or \class{struct_time} representing a time as returned ! by \function{gmtime()} or \function{localtime()} to a 24-character string of the following form: ! \code{'Sun Jun 20 23:21:05 1993'}. If \var{t} is not provided, the current time as returned by \function{localtime()} is used. + Locale information is not used by \function{asctime()}. \note{Unlike the C function of the same name, there is no trailing newline.} ! \versionchanged[Allowed \var{t} to be omitted]{2.1} \end{funcdesc} *************** *** 150,153 **** --- 158,162 ---- as returned by \function{time()} is used. \code{ctime(\var{secs})} is equivalent to \code{asctime(localtime(\var{secs}))}. + Locale information is not used by \function{ctime()}. \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 158,166 **** \begin{funcdesc}{gmtime}{\optional{secs}} ! Convert a time expressed in seconds since the epoch to a time tuple in UTC in which the dst flag is always zero. If \var{secs} is not provided, the current time as returned by \function{time()} is used. Fractions of a second are ignored. See above for a description of the ! tuple lay-out. \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} --- 167,175 ---- \begin{funcdesc}{gmtime}{\optional{secs}} ! Convert a time expressed in seconds since the epoch to a \class{struct_time} in UTC in which the dst flag is always zero. If \var{secs} is not provided, the current time as returned by \function{time()} is used. Fractions of a second are ignored. See above for a description of the ! \class{struct_time} object. \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 172,179 **** \end{funcdesc} ! \begin{funcdesc}{mktime}{tuple} This is the inverse function of \function{localtime()}. Its argument ! is the full 9-tuple (since the dst flag is needed; use \code{-1} as ! the dst flag if it is unknown) which expresses the time in \emph{local} time, not UTC. It returns a floating point number, for compatibility with \function{time()}. If the input value cannot be --- 181,189 ---- \end{funcdesc} ! \begin{funcdesc}{mktime}{t} This is the inverse function of \function{localtime()}. Its argument ! is the \class{struct_time} or full 9-tuple (since the dst flag is ! needed; use \code{-1} as the dst flag if it is unknown) which ! expresses the time in \emph{local} time, not UTC. It returns a floating point number, for compatibility with \function{time()}. If the input value cannot be *************** *** 194,203 **** \end{funcdesc} ! \begin{funcdesc}{strftime}{format\optional{, tuple}} ! Convert a tuple representing a time as returned by \function{gmtime()} ! or \function{localtime()} to a string as specified by the \var{format} ! argument. If \var{tuple} is not provided, the current time as returned by ! \function{localtime()} is used. \var{format} must be a string. ! \versionchanged[Allowed \var{tuple} to be omitted]{2.1} The following directives can be embedded in the \var{format} string. --- 204,214 ---- \end{funcdesc} ! \begin{funcdesc}{strftime}{format\optional{, t}} ! Convert a tuple or \class{struct_time} representing a time as returned ! by \function{gmtime()} or \function{localtime()} to a string as ! specified by the \var{format} argument. If \var{t} is not ! provided, the current time as returned by \function{localtime()} is ! used. \var{format} must be a string. ! \versionchanged[Allowed \var{t} to be omitted]{2.1} The following directives can be embedded in the \var{format} string. *************** *** 226,235 **** \lineiii{\%W}{Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year ! preceding the first Sunday are considered to be in week 0.}{} \lineiii{\%x}{Locale's appropriate date representation.}{} \lineiii{\%X}{Locale's appropriate time representation.}{} \lineiii{\%y}{Year without century as a decimal number [00,99].}{} \lineiii{\%Y}{Year with century as a decimal number.}{} ! \lineiii{\%Z}{Time zone name (or by no characters if no time zone exists).}{} \lineiii{\%\%}{A literal \character{\%} character.}{} \end{tableiii} --- 237,246 ---- \lineiii{\%W}{Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year ! preceding the first Monday are considered to be in week 0.}{} \lineiii{\%x}{Locale's appropriate date representation.}{} \lineiii{\%X}{Locale's appropriate time representation.}{} \lineiii{\%y}{Year without century as a decimal number [00,99].}{} \lineiii{\%Y}{Year with century as a decimal number.}{} ! \lineiii{\%Z}{Time zone name (no characters if no time zone exists).}{} \lineiii{\%\%}{A literal \character{\%} character.}{} \end{tableiii} *************** *** 271,275 **** \begin{funcdesc}{strptime}{string\optional{, format}} Parse a string representing a time according to a format. The return ! value is a tuple as returned by \function{gmtime()} or \function{localtime()}. The \var{format} parameter uses the same directives as those used by \function{strftime()}; it defaults to --- 282,286 ---- \begin{funcdesc}{strptime}{string\optional{, format}} Parse a string representing a time according to a format. The return ! value is a \class{struct_time} as returned by \function{gmtime()} or \function{localtime()}. The \var{format} parameter uses the same directives as those used by \function{strftime()}; it defaults to *************** *** 282,294 **** values; the specific values are platform-dependent as the XPG standard does not provide sufficient information to constrain the result. - - \note{This function relies entirely on the underlying - platform's C library for the date parsing, and some of these libraries - are buggy. There's nothing to be done about this short of a new, - portable implementation of \cfunction{strptime()}.} - - Availability: Most modern \UNIX{} systems. \end{funcdesc} \begin{funcdesc}{time}{} Return the time as a floating point number expressed in seconds since --- 293,304 ---- values; the specific values are platform-dependent as the XPG standard does not provide sufficient information to constrain the result. \end{funcdesc} + \begin{datadesc}{struct_time} + The type of the time value sequence returned by \function{gmtime()}, + \function{localtime()}, and \function{strptime()}. + \versionadded{2.2} + \end{datadesc} + \begin{funcdesc}{time}{} Return the time as a floating point number expressed in seconds since *************** *** 317,319 **** --- 327,332 ---- settings can affect the return values for some of the functions in the \module{time} module.} + \seemodule{calendar}{General calendar-related functions. + \function{timegm()} is the inverse of + \function{gmtime()} from this module.} \end{seealso} Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** libthreading.tex 19 Mar 2002 14:37:44 -0000 1.12 --- libthreading.tex 28 Apr 2003 17:34:22 -0000 1.12.2.1 *************** *** 9,14 **** lower level \refmodule{thread} module. ! This module is safe for use with \samp{from threading import *}. It ! defines the following functions and objects: \begin{funcdesc}{activeCount}{} --- 9,17 ---- lower level \refmodule{thread} module. ! The \refmodule[dummythreading]{dummy_threading} module is provided for ! situations where \module{threading} cannot be used because ! \refmodule{thread} is missing. ! ! This module defines the following functions and objects: \begin{funcdesc}{activeCount}{} Index: libthread.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthread.tex,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -C2 -d -r1.25 -r1.25.2.1 *** libthread.tex 9 Apr 2002 18:15:00 -0000 1.25 --- libthread.tex 28 Apr 2003 17:34:23 -0000 1.25.2.1 *************** *** 16,22 **** \index{semaphores, binary} ! The module is optional. It is supported on Windows NT and '95, SGI IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread ! (a.k.a. ``pthread'') implementation. \index{pthreads} \indexii{threads}{\POSIX} --- 16,25 ---- \index{semaphores, binary} ! The module is optional. It is supported on Windows, Linux, SGI IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread ! (a.k.a. ``pthread'') implementation. For systems lacking the \module{thread} ! module, the \refmodule[dummythread]{dummy_thread} module is available. ! It duplicates this module's interface and can be ! used as a drop-in replacement. \index{pthreads} \indexii{threads}{\POSIX} Index: libtempfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtempfile.tex,v retrieving revision 1.17 retrieving revision 1.17.8.1 diff -C2 -d -r1.17 -r1.17.8.1 *** libtempfile.tex 28 Nov 2001 07:26:15 -0000 1.17 --- libtempfile.tex 28 Apr 2003 17:34:27 -0000 1.17.8.1 *************** *** 1,37 **** \section{\module{tempfile} --- ! Generate temporary file names} \declaremodule{standard}{tempfile} ! \modulesynopsis{Generate temporary file names.} \indexii{temporary}{file name} \indexii{temporary}{file} ! This module generates temporary file names. It is not \UNIX{} specific, ! but it may require some help on non-\UNIX{} systems. ! The module defines the following user-callable functions: ! \begin{funcdesc}{mktemp}{\optional{suffix}} ! Return a unique temporary filename. This is an absolute pathname of a ! file that does not exist at the time the call is made. No two calls ! will return the same filename. \var{suffix}, if provided, is used as ! the last part of the generated file name. This can be used to provide ! a filename extension or other identifying information that may be ! useful on some platforms. ! \end{funcdesc} ! \begin{funcdesc}{TemporaryFile}{\optional{mode\optional{, ! bufsize\optional{, suffix}}}} Return a file (or file-like) object that can be used as a temporary ! storage area. The file is created in the most secure manner available ! in the appropriate temporary directory for the host platform. Under ! \UNIX, the directory entry to the file is removed so that it is secure ! against attacks which involve creating symbolic links to the file or ! replacing the file with a symbolic link to some other file. For other ! platforms, which don't allow removing the directory entry while the ! file is in use, the file is automatically deleted as soon as it is ! closed (including an implicit close when it is garbage-collected). The \var{mode} parameter defaults to \code{'w+b'} so that the file --- 1,45 ---- \section{\module{tempfile} --- ! Generate temporary files and directories} ! \sectionauthor{Zack Weinberg}{zack@codesourcery.com} \declaremodule{standard}{tempfile} ! \modulesynopsis{Generate temporary files and directories.} \indexii{temporary}{file name} \indexii{temporary}{file} + This module generates temporary files and directories. It works on + all supported platforms. ! In version 2.3 of Python, this module was overhauled for enhanced ! security. It now provides three new functions, ! \function{NamedTemporaryFile()}, \function{mkstemp()}, and ! \function{mkdtemp()}, which should eliminate all remaining need to use ! the insecure \function{mktemp()} function. Temporary file names created ! by this module no longer contain the process ID; instead a string of ! six random characters is used. ! Also, all the user-callable functions now take additional arguments ! which allow direct control over the location and name of temporary ! files. It is no longer necessary to use the global \var{tempdir} and ! \var{template} variables. To maintain backward compatibility, the ! argument order is somewhat odd; it is recommended to use keyword ! arguments for clarity. ! The module defines the following user-callable functions: ! \begin{funcdesc}{TemporaryFile}{\optional{mode='w+b'} ! \optional{, bufsize=-1} ! \optional{, suffix} ! \optional{, prefix} ! \optional{, dir}} Return a file (or file-like) object that can be used as a temporary ! storage area. The file is created using \function{mkstemp}. It will ! be destroyed as soon as it is closed (including an implicit close when ! the object is garbage collected). Under \UNIX, the directory entry ! for the file is removed immediately after the file is created. Other ! platforms do not support this; your code should not rely on a ! temporary file created using this function having or not having a ! visible name in the file system. The \var{mode} parameter defaults to \code{'w+b'} so that the file *************** *** 39,64 **** used so that it behaves consistently on all platforms without regard for the data that is stored. \var{bufsize} defaults to \code{-1}, ! meaning that the operating system default is used. \var{suffix} is ! passed to \function{mktemp()}. \end{funcdesc} The module uses two global variables that tell it how to construct a ! temporary name. The caller may assign values to them; by default they ! are initialized at the first call to \function{mktemp()}. \begin{datadesc}{tempdir} When set to a value other than \code{None}, this variable defines the ! directory in which filenames returned by \function{mktemp()} reside. ! The default is taken from the environment variable \envvar{TMPDIR}; if ! this is not set, either \file{/usr/tmp} is used (on \UNIX), or the ! current working directory (all other systems). No check is made to ! see whether its value is valid. \end{datadesc} ! \begin{funcdesc}{gettempprefix}{} ! Return the filename prefix used to create temporary files. This does ! not contain the directory component. Using this function is preferred ! over using the \code{template} variable directly. ! \versionadded{1.5.2} \end{funcdesc} --- 47,179 ---- used so that it behaves consistently on all platforms without regard for the data that is stored. \var{bufsize} defaults to \code{-1}, ! meaning that the operating system default is used. ! ! The \var{dir}, \var{prefix} and \var{suffix} parameters are passed to ! \function{mkstemp()}. ! \end{funcdesc} ! ! \begin{funcdesc}{NamedTemporaryFile}{\optional{mode='w+b'} ! \optional{, bufsize=-1} ! \optional{, suffix} ! \optional{, prefix} ! \optional{, dir}} ! This function operates exactly as \function{TemporaryFile()} does, ! except that the file is guaranteed to have a visible name in the file ! system (on \UNIX, the directory entry is not unlinked). That name can ! be retrieved from the \member{name} member of the file object. Whether ! the name can be used to open the file a second time, while the ! named temporary file is still open, varies across platforms (it can ! be so used on \UNIX; it cannot on Windows NT or later). ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{mkstemp}{\optional{suffix} ! \optional{, prefix} ! \optional{, dir} ! \optional{, text=False}} ! Creates a temporary file in the most secure manner possible. There ! are no race conditions in the file's creation, assuming that the ! platform properly implements the \constant{O_EXCL} flag for ! \function{os.open()}. The file is readable and writable only by the ! creating user ID. If the platform uses permission bits to indicate ! whether a file is executable, the file is executable by no one. The ! file descriptor is not inherited by child processes. ! ! Unlike \function{TemporaryFile()}, the user of \function{mkstemp()} is ! responsible for deleting the temporary file when done with it. ! ! If \var{suffix} is specified, the file name will end with that suffix, ! otherwise there will be no suffix. \function{mkstemp()} does not put a ! dot between the file name and the suffix; if you need one, put it at ! the beginning of \var{suffix}. ! ! If \var{prefix} is specified, the file name will begin with that ! prefix; otherwise, a default prefix is used. ! ! If \var{dir} is specified, the file will be created in that directory; ! otherwise, a default directory is used. ! ! If \var{text} is specified, it indicates whether to open the file in ! binary mode (the default) or text mode. On some platforms, this makes ! no difference. ! ! \function{mkstemp()} returns a tuple containing an OS-level handle to ! an open file (as would be returned by \function{os.open()}) and the ! absolute pathname of that file, in that order. ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{mkdtemp}{\optional{suffix} ! \optional{, prefix} ! \optional{, dir}} ! Creates a temporary directory in the most secure manner possible. ! There are no race conditions in the directory's creation. The ! directory is readable, writable, and searchable only by the ! creating user ID. ! ! The user of \function{mkdtemp()} is responsible for deleting the ! temporary directory and its contents when done with it. ! ! The \var{prefix}, \var{suffix}, and \var{dir} arguments are the same ! as for \function{mkstemp()}. ! ! \function{mkdtemp()} returns the absolute pathname of the new directory. ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{mktemp}{\optional{suffix} ! \optional{, prefix} ! \optional{, dir}} ! \deprecated{2.3}{Use \function{mkstemp()} instead.} ! Return an absolute pathname of a file that did not exist at the time ! the call is made. The \var{prefix}, \var{suffix}, and \var{dir} ! arguments are the same as for \function{mkstemp()}. ! ! \warning{Use of this function may introduce a security hole in your ! program. By the time you get around to doing anything with the file ! name it returns, someone else may have beaten you to the punch.} \end{funcdesc} The module uses two global variables that tell it how to construct a ! temporary name. They are initialized at the first call to any of the ! functions above. The caller may change them, but this is discouraged; ! use the appropriate function arguments, instead. \begin{datadesc}{tempdir} When set to a value other than \code{None}, this variable defines the ! default value for the \var{dir} argument to all the functions defined ! in this module. ! ! If \var{tempdir} is unset or \code{None} at any call to any of the ! above functions, Python searches a standard list of directories and ! sets \var{tempdir} to the first one which the calling user can create ! files in. The list is: ! ! \begin{enumerate} ! \item The directory named by the \envvar{TMPDIR} environment variable. ! \item The directory named by the \envvar{TEMP} environment variable. ! \item The directory named by the \envvar{TMP} environment variable. ! \item A platform-specific location: ! \begin{itemize} ! \item On Macintosh, the \file{Temporary Items} folder. ! \item On RiscOS, the directory named by the ! \envvar{Wimp\$ScrapDir} environment variable. ! \item On Windows, the directories ! \file{C:$\backslash$TEMP}, ! \file{C:$\backslash$TMP}, ! \file{$\backslash$TEMP}, and ! \file{$\backslash$TMP}, in that order. ! \item On all other platforms, the directories ! \file{/tmp}, \file{/var/tmp}, and \file{/usr/tmp}, in that order. ! \end{itemize} ! \item As a last resort, the current working directory. ! \end{enumerate} \end{datadesc} ! \begin{funcdesc}{gettempdir}{} ! Return the directory currently selected to create temporary files in. ! If \var{tempdir} is not None, this simply returns its contents; ! otherwise, the search described above is performed, and the result ! returned. \end{funcdesc} *************** *** 67,75 **** When set to a value other than \code{None}, this variable defines the prefix of the final component of the filenames returned by ! \function{mktemp()}. A string of decimal digits is added to generate ! unique filenames. The default is either \file{@\var{pid}.} where ! \var{pid} is the current process ID (on \UNIX), ! \file{\textasciitilde\var{pid}-} on Windows NT, \file{Python-Tmp-} on ! MacOS, or \file{tmp} (all other systems). Older versions of this module used to require that \code{template} be --- 182,189 ---- When set to a value other than \code{None}, this variable defines the prefix of the final component of the filenames returned by ! \function{mktemp()}. A string of six random letters and digits is ! appended to the prefix to make the filename unique. On Windows, ! the default prefix is \file{\textasciitilde{}T}; on all other systems ! it is \file{tmp}. Older versions of this module used to require that \code{template} be *************** *** 77,78 **** --- 191,199 ---- been necessary since version 1.5.2. \end{datadesc} + + \begin{funcdesc}{gettempprefix}{} + Return the filename prefix used to create temporary files. This does + not contain the directory component. Using this function is preferred + over reading the \var{template} variable directly. + \versionadded{1.5.2} + \end{funcdesc} Index: libtelnetlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtelnetlib.tex,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** libtelnetlib.tex 28 Nov 2001 07:26:15 -0000 1.9 --- libtelnetlib.tex 28 Apr 2003 17:34:29 -0000 1.9.8.1 *************** *** 11,15 **** implements the Telnet protocol. See \rfc{854} for details about the protocol. In addition, it provides symbolic constants for the protocol ! characters (IAC/DONT/DO/WONT/WILL), and for the telnet options. The symbolic names of the telnet options follow the definitions in \code{arpa/telnet.h}, with the leading \code{TELOPT_} removed. For --- 11,15 ---- implements the Telnet protocol. See \rfc{854} for details about the protocol. In addition, it provides symbolic constants for the protocol ! characters (see below), and for the telnet options. The symbolic names of the telnet options follow the definitions in \code{arpa/telnet.h}, with the leading \code{TELOPT_} removed. For *************** *** 17,20 **** --- 17,26 ---- \code{arpa/telnet.h}, see the module source itself. + The symbolic constants for the telnet commands are: IAC, DONT, DO, + WONT, WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data + Mark), BRK (Break), IP (Interrupt process), AO (Abort output), AYT + (Are You There), EC (Erase Character), EL (Erase Line), GA (Go Ahead), + SB (Subnegotiation Begin). + \begin{classdesc}{Telnet}{\optional{host\optional{, port}}} *************** *** 95,98 **** --- 101,112 ---- Return \code{''} if no cooked data available otherwise. This method never blocks. + \end{methoddesc} + + \begin{methoddesc}{read_sb_data}{} + Return the data collected between a SB/SE pair (suboption begin/end). + The callback should access these data when it was invoked with a + \code{SE} command. This method never blocks. + + \versionadded{2.3} \end{methoddesc} Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.58 retrieving revision 1.58.2.1 diff -C2 -d -r1.58 -r1.58.2.1 *** libsys.tex 27 Mar 2002 17:29:50 -0000 1.58 --- libsys.tex 28 Apr 2003 17:34:33 -0000 1.58.2.1 *************** *** 100,103 **** --- 100,108 ---- originally occurred. \obindex{traceback} + If \function{exc_clear()} is called, this function will return three + \code{None} values until either another exception is raised in the + current thread or the execution stack returns to a frame where + another exception is being handled. + \warning{Assigning the \var{traceback} return value to a local variable in a function that is handling an exception will *************** *** 116,119 **** --- 121,139 ---- \end{funcdesc} + \begin{funcdesc}{exc_clear}{} + This function clears all information relating to the current or last + exception that occured in the current thread. After calling this + function, \function{exc_info()} will return three \code{None} values until + another exception is raised in the current thread or the execution stack + returns to a frame where another exception is being handled. + + This function is only needed in only a few obscure situations. These + include logging and error handling systems that report information on the + last or current exception. This function can also be used to try to free + resources and trigger object finalization, though no guarantee is made as + to what objects will be freed, if any. + \versionadded{2.3} + \end{funcdesc} + \begin{datadesc}{exc_type} \dataline{exc_value} *************** *** 192,195 **** --- 212,231 ---- \end{funcdesc} + \begin{funcdesc}{getfilesystemencoding}{} + Return the name of the encoding used to convert Unicode filenames + into system file names, or \code{None} if the system default encoding + is used. The result value depends on the operating system: + \begin{itemize} + \item On Windows 9x, the encoding is ``mbcs''. + \item On Mac OS X, the encoding is ``utf-8''. + \item On Unix, the encoding is the user's preference + according to the result of nl_langinfo(CODESET), or None if + the nl_langinfo(CODESET) failed. + \item On Windows NT+, file names are Unicode natively, so no conversion + is performed. + \end{itemize} + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{getrefcount}{object} Return the reference count of the \var{object}. The count returned *************** *** 217,220 **** --- 253,282 ---- \end{funcdesc} + \begin{funcdesc}{getwindowsversion}{} + Return a tuple containing five components, describing the Windows + version currently running. The elements are \var{major}, \var{minor}, + \var{build}, \var{platform}, and \var{text}. \var{text} contains + a string while all other values are integers. + + \var{platform} may be one of the following values: + \begin{list}{}{\leftmargin 0.7in \labelwidth 0.65in} + \item[0 (\constant{VER_PLATFORM_WIN32s})] + Win32s on Windows 3.1. + \item[1 (\constant{VER_PLATFORM_WIN32_WINDOWS})] + Windows 95/98/ME + \item[2 (\constant{VER_PLATFORM_WIN32_NT})] + Windows NT/2000/XP + \item[3 (\constant{VER_PLATFORM_WIN32_CE})] + Windows CE. + \end{list} + + This function wraps the Win32 \function{GetVersionEx()} function; + see the Microsoft Documentation for more information about these + fields. + + Availability: Windows. + \versionadded{2.3} + \end{funcdesc} + \begin{datadesc}{hexversion} The version number encoded as a single integer. This is guaranteed *************** *** 283,290 **** \indexiii{module}{search}{path} A list of strings that specifies the search path for modules. ! Initialized from the environment variable \envvar{PYTHONPATH}, or an installation-dependent default. ! The first item of this list, \code{path[0]}, is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the --- 345,353 ---- \indexiii{module}{search}{path} A list of strings that specifies the search path for modules. ! Initialized from the environment variable \envvar{PYTHONPATH}, plus an installation-dependent default. ! As initialized upon program startup, ! the first item of this list, \code{path[0]}, is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the *************** *** 294,297 **** --- 357,362 ---- that the script directory is inserted \emph{before} the entries inserted as a result of \envvar{PYTHONPATH}. + + A program is free to modify this list for its own purposes. \end{datadesc} *************** *** 455,458 **** --- 520,529 ---- '1.5.2 (#0 Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)]' \end{verbatim} + \end{datadesc} + + \begin{datadesc}{api_version} + The C API version for this interpreter. Programmers may find this useful + when debugging version conflicts between Python and extension + modules. \versionadded{2.3} \end{datadesc} Index: libstringio.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstringio.tex,v retrieving revision 1.6 retrieving revision 1.6.20.1 diff -C2 -d -r1.6 -r1.6.20.1 *** libstringio.tex 6 Jul 2001 20:30:11 -0000 1.6 --- libstringio.tex 28 Apr 2003 17:34:36 -0000 1.6.20.1 *************** *** 60,63 **** --- 60,68 ---- strings that cannot be encoded as plain \ASCII{} strings. + Another difference from the \refmodule{StringIO} module is that calling + \function{StringIO()} with a string parameter creates a read-only object. + Unlike an object created without a string parameter, it does not have + write methods. + The following data objects are provided as well: Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.47 retrieving revision 1.47.2.1 diff -C2 -d -r1.47 -r1.47.2.1 *** libstring.tex 20 Jun 2002 21:18:46 -0000 1.47 --- libstring.tex 28 Apr 2003 17:34:36 -0000 1.47.2.1 *************** *** 231,237 **** \begin{funcdesc}{joinfields}{words\optional{, sep}} ! This function behaves identical to \function{join()}. (In the past, \function{join()} was only used with one argument, while \function{joinfields()} was only used with two arguments.) \end{funcdesc} --- 231,239 ---- \begin{funcdesc}{joinfields}{words\optional{, sep}} ! This function behaves identically to \function{join()}. (In the past, \function{join()} was only used with one argument, while \function{joinfields()} was only used with two arguments.) + Note that there is no \method{joinfields()} method on string + objects; use the \method{join()} method instead. \end{funcdesc} *************** *** 242,245 **** --- 244,249 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 250,253 **** --- 254,259 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 258,261 **** --- 264,269 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.98 retrieving revision 1.98.2.1 diff -C2 -d -r1.98 -r1.98.2.1 *** libstdtypes.tex 14 Jun 2002 09:16:40 -0000 1.98 --- libstdtypes.tex 28 Apr 2003 17:34:37 -0000 1.98.2.1 *************** *** 34,41 **** \item \code{None} ! \withsubitem{(Built-in object)}{\ttindex{None}} \item \code{False} ! \withsubitem{(Built-in object)}{\ttindex{False}} \item zero of any numeric type, for example, \code{0}, \code{0L}, --- 34,41 ---- \item \code{None} ! \withsubitem{(Built-in object)}{\ttindex{None}} \item \code{False} ! \withsubitem{(Built-in object)}{\ttindex{False}} \item zero of any numeric type, for example, \code{0}, \code{0L}, *************** *** 47,54 **** \item instances of user-defined classes, if the class defines a ! \method{__nonzero__()} or \method{__len__()} method, when that ! method returns zero.\footnote{Additional information on these ! special methods may be found in the \citetitle[../ref/ref.html]{Python ! Reference Manual}.} \end{itemize} --- 47,55 ---- \item instances of user-defined classes, if the class defines a ! \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero or \class{bool} value ! \code{False}.\footnote{Additional ! information on these special methods may be found in the ! \citetitle[../ref/ref.html]{Python Reference Manual}.} \end{itemize} *************** *** 228,233 **** \bifuncindex{complex} ! All numeric types support the following operations, sorted by ! ascending priority (operations in the same box have the same priority; all numeric operations have a higher priority than comparison operations): --- 229,234 ---- \bifuncindex{complex} ! All numeric types (except complex) support the following operations, ! sorted by ascending priority (operations in the same box have the same priority; all numeric operations have a higher priority than comparison operations): *************** *** 239,243 **** \lineiii{\var{x} * \var{y}}{product of \var{x} and \var{y}}{} \lineiii{\var{x} / \var{y}}{quotient of \var{x} and \var{y}}{(1)} ! \lineiii{\var{x} \%{} \var{y}}{remainder of \code{\var{x} / \var{y}}}{} \hline \lineiii{-\var{x}}{\var{x} negated}{} --- 240,244 ---- \lineiii{\var{x} * \var{y}}{product of \var{x} and \var{y}}{} \lineiii{\var{x} / \var{y}}{quotient of \var{x} and \var{y}}{(1)} ! \lineiii{\var{x} \%{} \var{y}}{remainder of \code{\var{x} / \var{y}}}{(4)} \hline \lineiii{-\var{x}}{\var{x} negated}{} *************** *** 250,254 **** \lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{} \lineiii{\var{c}.conjugate()}{conjugate of the complex number \var{c}}{} ! \lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)} \lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{} \lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{} --- 251,255 ---- \lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{} \lineiii{\var{c}.conjugate()}{conjugate of the complex number \var{c}}{} ! \lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)(4)} \lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{} \lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{} *************** *** 283,286 **** --- 284,293 ---- description. + \item[(4)] + Complex floor division operator, modulo operator, and \function{divmod()}. + + \deprecated{2.3}{Instead convert to float using \function{abs()} + if appropriate.} + \end{description} % XXXJH exceptions: overflow (when? what operations?) zerodivision *************** *** 378,381 **** --- 385,395 ---- implementation of the iterator protocol. + The intention of the protocol is that once an iterator's + \method{next()} method raises \exception{StopIteration}, it will + continue to do so on subsequent calls. Implementations that + do not obey this property are deemed broken. (This constraint + was added in Python 2.3; in Python 2.2, various iterators are + broken according to this rule.) + \subsection{Sequence Types \label{typesseq}} *************** *** 403,407 **** Buffer objects are not directly supported by Python syntax, but can be created by calling the builtin function ! \function{buffer()}.\bifuncindex{buffer}. They don't support concatenation or repetition. \obindex{buffer} --- 417,421 ---- Buffer objects are not directly supported by Python syntax, but can be created by calling the builtin function ! \function{buffer()}.\bifuncindex{buffer} They don't support concatenation or repetition. \obindex{buffer} *************** *** 426,438 **** \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{\var{x} in \var{s}}{\code{1} if an item of \var{s} is equal to \var{x}, else \code{0}}{} \lineiii{\var{x} not in \var{s}}{\code{0} if an item of \var{s} is ! equal to \var{x}, else \code{1}}{} \hline \lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{} ! \lineiii{\var{s} * \var{n}\textrm{,} \var{n} * \var{s}}{\var{n} shallow copies of \var{s} concatenated}{(1)} \hline ! \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(2)} ! \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(2), (3)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} --- 440,453 ---- \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{\var{x} in \var{s}}{\code{1} if an item of \var{s} is equal to \var{x}, else \code{0}}{(1)} \lineiii{\var{x} not in \var{s}}{\code{0} if an item of \var{s} is ! equal to \var{x}, else \code{1}}{(1)} \hline \lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{} ! \lineiii{\var{s} * \var{n}\textrm{,} \var{n} * \var{s}}{\var{n} shallow copies of \var{s} concatenated}{(2)} \hline ! \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(3)} ! \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(3), (4)} ! \lineiii{\var{s}[\var{i}:\var{j}:\var{k}]}{slice of \var{s} from \var{i} to \var{j} with step \var{k}}{(3), (5)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} *************** *** 448,451 **** --- 463,467 ---- \indexii{subscript}{operation} \indexii{slice}{operation} + \indexii{extended slice}{operation} \opindex{in} \opindex{not in} *************** *** 455,459 **** \begin{description} ! \item[(1)] Values of \var{n} less than \code{0} are treated as \code{0} (which yields an empty sequence of the same type as \var{s}). Note also that the copies are shallow; nested structures --- 471,480 ---- \begin{description} ! \item[(1)] When \var{s} is a string or Unicode string object the ! \code{in} and \code{not in} operations act like a substring test. In ! Python versions before 2.3, \var{x} had to be a string of length 1. ! In Python 2.3 and beyond, \var{x} may be a string of any length. ! ! \item[(2)] Values of \var{n} less than \code{0} are treated as \code{0} (which yields an empty sequence of the same type as \var{s}). Note also that the copies are shallow; nested structures *************** *** 483,492 **** \end{verbatim} ! \item[(2)] If \var{i} or \var{j} is negative, the index is relative to the end of the string: \code{len(\var{s}) + \var{i}} or \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is still \code{0}. ! \item[(3)] The slice of \var{s} from \var{i} to \var{j} is defined as the sequence of items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}}. If \var{i} or \var{j} is greater than --- 504,513 ---- \end{verbatim} ! \item[(3)] If \var{i} or \var{j} is negative, the index is relative to the end of the string: \code{len(\var{s}) + \var{i}} or \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is still \code{0}. ! \item[(4)] The slice of \var{s} from \var{i} to \var{j} is defined as the sequence of items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}}. If \var{i} or \var{j} is greater than *************** *** 494,497 **** --- 515,527 ---- use \code{0}. If \var{j} is omitted, use \code{len(\var{s})}. If \var{i} is greater than or equal to \var{j}, the slice is empty. + + \item[(5)] The slice of \var{s} from \var{i} to \var{j} with step + \var{k} is defined as the sequence of items with index + \code{\var{x} = \var{i} + \var{n}*\var{k}} such that \code{0} + \code{<=} \var{n} \code{<} \code{abs(i-j)}. If \var{i} or \var{j} + is greater than \code{len(\var{s})}, use \code{len(\var{s})}. If + \var{i} or \var{j} are ommitted then they become ``end'' values + (which end depends on the sign of \var{k}). + \end{description} *************** *** 538,543 **** \begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} ! Return true if the string ends with the specified \var{suffix}, ! otherwise return false. With optional \var{start}, test beginning at that position. With optional \var{end}, stop comparing at that position. \end{methoddesc} --- 568,573 ---- \begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} ! Return \code{True} if the string ends with the specified \var{suffix}, ! otherwise return \code{False}. With optional \var{start}, test beginning at that position. With optional \var{end}, stop comparing at that position. \end{methoddesc} *************** *** 619,622 **** --- 649,653 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 652,655 **** --- 683,687 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 669,674 **** \begin{methoddesc}[string]{startswith}{prefix\optional{, start\optional{, end}}} ! Return true if string starts with the \var{prefix}, otherwise ! return false. With optional \var{start}, test string beginning at that position. With optional \var{end}, stop comparing string at that position. --- 701,706 ---- \begin{methoddesc}[string]{startswith}{prefix\optional{, start\optional{, end}}} ! Return \code{True} if string starts with the \var{prefix}, otherwise ! return \code{False}. With optional \var{start}, test string beginning at that position. With optional \var{end}, stop comparing string at that position. *************** *** 681,684 **** --- 713,717 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 708,711 **** --- 741,745 ---- of length \var{width}. The original string is returned if \var{width} is less than \code{len(\var{s})}. + \versionadded{2.2.2} \end{methoddesc} *************** *** 784,790 **** \lineii{\#}{The value conversion will use the ``alternate form'' (where defined below).} ! \lineii{0}{The conversion will be zero padded.} \lineii{-}{The converted value is left adjusted (overrides ! \character{-}).} \lineii{{~}}{(a space) A blank should be left before a positive number (or empty string) produced by a signed conversion.} --- 818,824 ---- \lineii{\#}{The value conversion will use the ``alternate form'' (where defined below).} ! \lineii{0}{The conversion will be zero padded for numeric values.} \lineii{-}{The converted value is left adjusted (overrides ! the \character{0} conversion if both are given).} \lineii{{~}}{(a space) A blank should be left before a positive number (or empty string) produced by a signed conversion.} *************** *** 798,830 **** The conversion types are: ! \begin{tableii}{c|l}{character}{Conversion}{Meaning} ! \lineii{d}{Signed integer decimal.} ! \lineii{i}{Signed integer decimal.} ! \lineii{o}{Unsigned octal.} ! \lineii{u}{Unsigned decimal.} ! \lineii{x}{Unsigned hexidecimal (lowercase).} ! \lineii{X}{Unsigned hexidecimal (uppercase).} ! \lineii{e}{Floating point exponential format (lowercase).} ! \lineii{E}{Floating point exponential format (uppercase).} ! \lineii{f}{Floating point decimal format.} ! \lineii{F}{Floating point decimal format.} ! \lineii{g}{Same as \character{e} if exponent is greater than -4 or ! less than precision, \character{f} otherwise.} ! \lineii{G}{Same as \character{E} if exponent is greater than -4 or ! less than precision, \character{F} otherwise.} ! \lineii{c}{Single character (accepts integer or single character ! string).} ! \lineii{r}{String (converts any python object using ! \function{repr()}).} ! \lineii{s}{String (converts any python object using ! \function{str()}).} ! \lineii{\%}{No argument is converted, results in a \character{\%} ! character in the result. (The complete specification is ! \code{\%\%}.)} ! \end{tableii} ! % XXX Examples? ! (The \code{\%r} conversion was added in Python 2.0.) Since Python strings have an explicit length, \code{\%s} conversions --- 832,882 ---- The conversion types are: ! \begin{tableiii}{c|l|c}{character}{Conversion}{Meaning}{Notes} ! \lineiii{d}{Signed integer decimal.}{} ! \lineiii{i}{Signed integer decimal.}{} ! \lineiii{o}{Unsigned octal.}{(1)} ! \lineiii{u}{Unsigned decimal.}{} ! \lineiii{x}{Unsigned hexidecimal (lowercase).}{(2)} ! \lineiii{X}{Unsigned hexidecimal (uppercase).}{(2)} ! \lineiii{e}{Floating point exponential format (lowercase).}{} ! \lineiii{E}{Floating point exponential format (uppercase).}{} ! \lineiii{f}{Floating point decimal format.}{} ! \lineiii{F}{Floating point decimal format.}{} ! \lineiii{g}{Same as \character{e} if exponent is greater than -4 or ! less than precision, \character{f} otherwise.}{} ! \lineiii{G}{Same as \character{E} if exponent is greater than -4 or ! less than precision, \character{F} otherwise.}{} ! \lineiii{c}{Single character (accepts integer or single character ! string).}{} ! \lineiii{r}{String (converts any python object using ! \function{repr()}).}{(3)} ! \lineiii{s}{String (converts any python object using ! \function{str()}).}{(4)} ! \lineiii{\%}{No argument is converted, results in a \character{\%} ! character in the result.}{} ! \end{tableiii} ! \noindent ! Notes: ! \begin{description} ! \item[(1)] ! The alternate form causes a leading zero (\character{0}) to be ! inserted between left-hand padding and the formatting of the ! number if the leading character of the result is not already a ! zero. ! \item[(2)] ! The alternate form causes a leading \code{'0x'} or \code{'0X'} ! (depending on whether the \character{x} or \character{X} format ! was used) to be inserted between left-hand padding and the ! formatting of the number if the leading character of the result is ! not already a zero. ! \item[(3)] ! The \code{\%r} conversion was added in Python 2.0. ! \item[(4)] ! If the object or format provided is a \class{unicode} string, ! the resulting string will also be \class{unicode}. ! \end{description} ! % XXX Examples? Since Python strings have an explicit length, \code{\%s} conversions *************** *** 853,858 **** advantages. ! XRange objects have very little behavior: they only support indexing ! and the \function{len()} function. --- 905,910 ---- advantages. ! XRange objects have very little behavior: they only support indexing, ! iteration, and the \function{len()} function. *************** *** 877,899 **** \lineiii{del \var{s}[\var{i}:\var{j}]} {same as \code{\var{s}[\var{i}:\var{j}] = []}}{} \lineiii{\var{s}.append(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{(1)} \lineiii{\var{s}.extend(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = \var{x}}}{(2)} \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(3)} \lineiii{\var{s}.insert(\var{i}, \var{x})} ! {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} ! if \code{\var{i} >= 0}}{(4)} \lineiii{\var{s}.pop(\optional{\var{i}})} ! {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(5)} \lineiii{\var{s}.remove(\var{x})} ! {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(3)} \lineiii{\var{s}.reverse()} ! {reverses the items of \var{s} in place}{(6)} ! \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 929,954 ---- \lineiii{del \var{s}[\var{i}:\var{j}]} {same as \code{\var{s}[\var{i}:\var{j}] = []}}{} + \lineiii{\var{s}[\var{i}:\var{j}:\var{k}] = \var{t}} + {the elements of \code{\var{s}[\var{i}:\var{j}:\var{k}]} are replaced by those of \var{t}}{(1)} + \lineiii{del \var{s}[\var{i}:\var{j}:\var{k}]} + {removes the elements of \code{\var{s}[\var{i}:\var{j}:\var{k}]} from the list}{} \lineiii{\var{s}.append(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{(2)} \lineiii{\var{s}.extend(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = \var{x}}}{(3)} \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)} \lineiii{\var{s}.insert(\var{i}, \var{x})} ! {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]}}{(5)} \lineiii{\var{s}.pop(\optional{\var{i}})} ! {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(6)} \lineiii{\var{s}.remove(\var{x})} ! {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(4)} \lineiii{\var{s}.reverse()} ! {reverses the items of \var{s} in place}{(7)} ! \lineiii{\var{s}.sort(\optional{\var{cmpfunc=None}})} ! {sort the items of \var{s} in place}{(7), (8), (9), (10)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} *************** *** 902,905 **** --- 957,961 ---- \indexii{subscript}{assignment} \indexii{slice}{assignment} + \indexii{extended slice}{assignment} \stindex{del} \withsubitem{(list method)}{ *************** *** 910,948 **** Notes: \begin{description} ! \item[(1)] The C implementation of Python historically accepted ! multiple parameters and implicitly joined them into a tuple; ! Use of this misfeature has been deprecated since Python 1.4, ! and became an error with the introduction of Python 2.0. ! \item[(2)] Raises an exception when \var{x} is not a list object. The \method{extend()} method is experimental and not supported by mutable sequence types other than lists. ! \item[(3)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. ! \item[(4)] When a negative index is passed as the first parameter to ! the \method{insert()} method, the new element is prepended to the ! sequence. ! \item[(5)] The \method{pop()} method is only supported by the list and array types. The optional argument \var{i} defaults to \code{-1}, so that by default the last item is removed and returned. ! \item[(6)] The \method{sort()} and \method{reverse()} methods modify the list in place for economy of space when sorting or reversing a large list. To remind you that they operate by side effect, they don't return the sorted or reversed list. ! \item[(7)] The \method{sort()} method takes an optional argument specifying a comparison function of two arguments (list items) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process ! down considerably; e.g. to sort a list in reverse order it is much ! faster to use calls to the methods \method{sort()} and ! \method{reverse()} than to use the built-in function ! \function{sort()} with a comparison function that reverses the ! ordering of the elements. \end{description} --- 966,1046 ---- Notes: \begin{description} ! \item[(1)] \var{t} must have the same length as the slice it is ! replacing. ! \item[(2)] The C implementation of Python has historically accepted ! multiple parameters and implicitly joined them into a tuple; this ! no longer works in Python 2.0. Use of this misfeature has been ! deprecated since Python 1.4. ! ! \item[(3)] Raises an exception when \var{x} is not a list object. The \method{extend()} method is experimental and not supported by mutable sequence types other than lists. ! \item[(4)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. ! \item[(5)] When a negative index is passed as the first parameter to ! the \method{insert()} method, the list length is added, as for slice ! indices. If it is still negative, it is truncated to zero, as for ! slice indices. \versionchanged[Previously, all negative indices ! were truncated to zero]{2.3} ! \item[(6)] The \method{pop()} method is only supported by the list and array types. The optional argument \var{i} defaults to \code{-1}, so that by default the last item is removed and returned. ! \item[(7)] The \method{sort()} and \method{reverse()} methods modify the list in place for economy of space when sorting or reversing a large list. To remind you that they operate by side effect, they don't return the sorted or reversed list. ! \item[(8)] The \method{sort()} method takes an optional argument specifying a comparison function of two arguments (list items) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process ! down considerably; for example to sort a list in reverse order it is much ! faster to call \method{sort()} followed by \method{reverse()} ! than to use \method{sort()} with a comparison function that ! reverses the ordering of the elements. Passing \constant{None} as the ! comparison function is semantically equivalent to calling ! \method{sort()} with no comparison function. ! \versionchanged[Support for \code{None} as an equivalent to omitting ! \var{cmpfunc} was added]{2.3} ! ! As an example of using the \var{cmpfunc} argument to the ! \method{sort()} method, consider sorting a list of sequences by the ! second element of that list: ! ! \begin{verbatim} ! def mycmp(a, b): ! return cmp(a[1], b[1]) ! ! mylist.sort(mycmp) ! \end{verbatim} ! ! A more time-efficient approach for reasonably-sized data structures can ! often be used: ! ! \begin{verbatim} ! tmplist = [(x[1], x) for x in mylist] ! tmplist.sort() ! mylist = [x for (key, x) in tmplist] ! \end{verbatim} ! ! \item[(9)] Whether the \method{sort()} method is stable is not defined by ! the language (a sort is stable if it guarantees not to change the ! relative order of elements that compare equal). In the C ! implementation of Python, sorts were stable only by accident through ! Python 2.2. The C implementation of Python 2.3 introduced a stable ! \method{sort()} method, but code that intends to be portable across ! implementations and versions must not rely on stability. ! ! \item[(10)] While a list is being sorted, the effect of attempting to ! mutate, or even inspect, the list is undefined. The C implementation ! of Python 2.3 makes the list appear empty for the duration, and raises ! \exception{ValueError} if it can detect that the list has been ! mutated during a sort. \end{description} *************** *** 983,987 **** \ttindex{update()} \ttindex{values()} ! \ttindex{get()}} \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} --- 1081,1091 ---- \ttindex{update()} \ttindex{values()} ! \ttindex{get()} ! \ttindex{setdefault()} ! \ttindex{pop()} ! \ttindex{popitem()} ! \ttindex{iteritems()} ! \ttindex{iterkeys)} ! \ttindex{itervalues()}} \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} *************** *** 1010,1015 **** \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} \lineiii{\var{a}.update(\var{b})} ! {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}} {} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} --- 1114,1122 ---- \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} \lineiii{\var{a}.update(\var{b})} ! {\code{for \var{k} in \var{b}.keys(): \var{a}[\var{k}] = \var{b}[\var{k}]}} {} + \lineiii{\var{a}.fromkeys(\var{seq}\optional{, \var{value}})} + {Creates a new dictionary with keys from \var{seq} and values set to \var{value}} + {(7)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} *************** *** 1021,1027 **** else \var{x} (also setting it)} {(5)} ! \lineiii{\var{a}.pop(\var{k})} ! {remove specified \var{key} and return corresponding \var{value}} ! {} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} --- 1128,1135 ---- else \var{x} (also setting it)} {(5)} ! \lineiii{\var{a}.pop(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, ! else \var{x} (and remove k)} ! {(8)} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} *************** *** 1029,1039 **** \lineiii{\var{a}.iteritems()} {return an iterator over (\var{key}, \var{value}) pairs} ! {(2)} \lineiii{\var{a}.iterkeys()} {return an iterator over the mapping's keys} ! {(2)} \lineiii{\var{a}.itervalues()} {return an iterator over the mapping's values} ! {(2)} \end{tableiii} --- 1137,1147 ---- \lineiii{\var{a}.iteritems()} {return an iterator over (\var{key}, \var{value}) pairs} ! {(2), (3)} \lineiii{\var{a}.iterkeys()} {return an iterator over the mapping's keys} ! {(2), (3)} \lineiii{\var{a}.itervalues()} {return an iterator over the mapping's values} ! {(2), (3)} \end{tableiii} *************** *** 1047,1055 **** \item[(3)] Keys and values are listed in random order. If ! \method{keys()} and \method{values()} are called with no intervening ! modifications to the dictionary, the two lists will directly ! correspond. This allows the creation of \code{(\var{value}, ! \var{key})} pairs using \function{zip()}: \samp{pairs = ! zip(\var{a}.values(), \var{a}.keys())}. \item[(4)] Never raises an exception if \var{k} is not in the map, --- 1155,1169 ---- \item[(3)] Keys and values are listed in random order. If ! \method{items()}, \method{keys()}, \method{values()}, ! \method{iteritems()}, \method{iterkeys()}, and \method{itervalues()} ! are called with no intervening modifications to the dictionary, the ! lists will directly correspond. This allows the creation of ! \code{(\var{value}, \var{key})} pairs using \function{zip()}: ! \samp{pairs = zip(\var{a}.values(), \var{a}.keys())}. The same ! relationship holds for the \method{iterkeys()} and ! \method{itervalues()} methods: \samp{pairs = zip(\var{a}.itervalues(), ! \var{a}.iterkeys())} provides the same value for \code{pairs}. ! Another way to create the same list is \samp{pairs = [(v, k) for (k, ! v) in \var{a}.iteritems()]}. \item[(4)] Never raises an exception if \var{k} is not in the map, *************** *** 1063,1066 **** --- 1177,1186 ---- \item[(6)] \function{popitem()} is useful to destructively iterate over a dictionary, as often used in set algorithms. + + \item[(7)] \function{fromkeys()} is a class method that returns a + new dictionary. \var{value} defaults to \code{None}. \versionadded{2.3} + + \item[(8)] \function{pop()} raises a \exception{KeyError} when no default + value is given and the key is not found. \versionadded{2.3} \end{description} *************** *** 1103,1112 **** \end{methoddesc} - \begin{methoddesc}[file]{isatty}{} - Return \code{True} if the file is connected to a tty(-like) device, else - \code{False}. \note{If a file-like object is not associated - with a real file, this method should \emph{not} be implemented.} - \end{methoddesc} - \begin{methoddesc}[file]{fileno}{} \index{file descriptor} --- 1223,1226 ---- *************** *** 1122,1125 **** --- 1236,1262 ---- \end{methoddesc} + \begin{methoddesc}[file]{isatty}{} + Return \code{True} if the file is connected to a tty(-like) device, else + \code{False}. \note{If a file-like object is not associated + with a real file, this method should \emph{not} be implemented.} + \end{methoddesc} + + \begin{methoddesc}[file]{next}{} + A file object is its own iterator, i.e. \code{iter(\var{f})} returns + \var{f} (unless \var{f} is closed). When a file is used as an + iterator, typically in a \keyword{for} loop (for example, + \code{for line in f: print line}), the \method{next()} method is + called repeatedly. This method returns the next input line, or raises + \exception{StopIteration} when \EOF{} is hit. In order to make a + \keyword{for} loop the most efficient way of looping over the lines of + a file (a very common operation), the \method{next()} method uses a + hidden read-ahead buffer. As a consequence of using a read-ahead + buffer, combining \method{next()} with other file methods (like + \method{readline()}) does not work right. However, using + \method{seek()} to reposition the file to an absolute position will + flush the read-ahead buffer. + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}[file]{read}{\optional{size}} Read at most \var{size} bytes from the file (less if the read hits *************** *** 1131,1135 **** an \EOF{} is hit.) Note that this method may call the underlying C function \cfunction{fread()} more than once in an effort to ! acquire as close to \var{size} bytes as possible. \end{methoddesc} --- 1268,1274 ---- an \EOF{} is hit.) Note that this method may call the underlying C function \cfunction{fread()} more than once in an effort to ! acquire as close to \var{size} bytes as possible. Also note that ! when in non-blocking mode, less data than what was requested may ! be returned, even if no \var{size} parameter was given. \end{methoddesc} *************** *** 1165,1172 **** \begin{methoddesc}[file]{xreadlines}{} ! Equivalent to ! \function{xreadlines.xreadlines(\var{file})}.\refstmodindex{xreadlines} ! (See the \refmodule{xreadlines} module for more information.) \versionadded{2.1} \end{methoddesc} --- 1304,1310 ---- \begin{methoddesc}[file]{xreadlines}{} ! This method returns the same thing as \code{iter(f)}. \versionadded{2.1} + \deprecated{2.3}{Use \code{for line in file} instead.} \end{methoddesc} *************** *** 1243,1246 **** --- 1381,1396 ---- file object, of the form \samp{<\mbox{\ldots}>}. This is a read-only attribute and may not be present on all file-like objects. + \end{memberdesc} + + \begin{memberdesc}[file]{newlines} + If Python was built with the \code{--with-universal-newlines} option + (the default) this read-only attribute exists, and for files opened in + universal newline read mode it keeps track of the types of newlines + encountered while reading the file. The values it can take are + \code{'\e r'}, \code{'\e n'}, \code{'\e r\e n'}, \code{None} (unknown, + no newlines read yet) or a tuple containing all the newline + types seen, to indicate that multiple + newline conventions were encountered. For files not opened in universal + newline read mode the value of this attribute will be \code{None}. \end{memberdesc} Index: libsocksvr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocksvr.tex,v retrieving revision 1.14 retrieving revision 1.14.24.1 diff -C2 -d -r1.14 -r1.14.24.1 *** libsocksvr.tex 13 Dec 2000 20:39:22 -0000 1.14 --- libsocksvr.tex 28 Apr 2003 17:34:40 -0000 1.14.24.1 *************** *** 38,41 **** --- 38,51 ---- many requests. + When inheriting from \class{ThreadingMixIn} for threaded connection + behavior, you should explicitly declare how you want your threads + to behave on an abrupt shutdown. The \class{ThreadingMixIn} class + defines an attribute \var{daemon_threads}, which indicates whether + or not the server should wait for thread termination. You should + set the flag explicitly if you would like threads to behave + autonomously; the default is \constant{False}, meaning that Python + will not exit until all threads created by \class{ThreadingMixIn} have + exited. + Server classes have the same external methods and attributes, no matter what network protocol they use: *************** *** 97,101 **** \begin{datadesc}{allow_reuse_address} Whether the server will allow the reuse of an address. This defaults ! to true, and can be set in subclasses to change the policy. \end{datadesc} --- 107,111 ---- \begin{datadesc}{allow_reuse_address} Whether the server will allow the reuse of an address. This defaults ! to \code{False}, and can be set in subclasses to change the policy. \end{datadesc} Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.68 retrieving revision 1.68.2.1 diff -C2 -d -r1.68 -r1.68.2.1 *** libsocket.tex 13 Jun 2002 15:07:43 -0000 1.68 --- libsocket.tex 28 Apr 2003 17:34:41 -0000 1.68.2.1 *************** *** 350,353 **** --- 350,367 ---- \end{funcdesc} + \begin{funcdesc}{getdefaulttimeout}{} + Return the default timeout in floating seconds for new socket objects. + A value of \code{None} indicates that new socket objects have no timeout. + When the socket module is first imported, the default is \code{None}. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{setdefaulttimeout}{timeout} + Set the default timeout in floating seconds for new socket objects. + A value of \code{None} indicates that new socket objects have no timeout. + When the socket module is first imported, the default is \code{None}. + \versionadded{2.3} + \end{funcdesc} + \begin{datadesc}{SocketType} This is a Python type object that represents the socket object type. Index: libsmtplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsmtplib.tex,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** libsmtplib.tex 24 Mar 2002 15:41:40 -0000 1.22 --- libsmtplib.tex 28 Apr 2003 17:34:45 -0000 1.22.2.1 *************** *** 139,145 **** argument defaults to the fully qualified domain name of the local host. Examine the response for ESMTP option and store them for use by ! \method{has_option()}. ! Unless you wish to use \method{has_option()} before sending mail, it should not be necessary to call this method explicitly. It will be implicitly called by \method{sendmail()} when necessary. --- 139,145 ---- argument defaults to the fully qualified domain name of the local host. Examine the response for ESMTP option and store them for use by ! \method{has_extn()}. ! Unless you wish to use \method{has_extn()} before sending mail, it should not be necessary to call this method explicitly. It will be implicitly called by \method{sendmail()} when necessary. Index: libsite.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsite.tex,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -d -r1.23 -r1.23.2.1 *** libsite.tex 19 Feb 2002 02:58:54 -0000 1.23 --- libsite.tex 28 Apr 2003 17:34:47 -0000 1.23.2.1 *************** *** 23,28 **** \file{lib/site-python} (on \UNIX). For each of the distinct head-tail combinations, it sees if it refers to an existing directory, ! and if so, adds to \code{sys.path}, and also inspects the path for ! configuration files. \indexii{site-python}{directory} \indexii{site-packages}{directory} --- 23,28 ---- \file{lib/site-python} (on \UNIX). For each of the distinct head-tail combinations, it sees if it refers to an existing directory, ! and if so, adds it to \code{sys.path} and also inspects the newly added ! path for configuration files. \indexii{site-python}{directory} \indexii{site-packages}{directory} Index: libsimplexmlrpc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsimplexmlrpc.tex,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -C2 -d -r1.3 -r1.3.8.1 *** libsimplexmlrpc.tex 28 Nov 2001 07:32:53 -0000 1.3 --- libsimplexmlrpc.tex 28 Apr 2003 17:34:49 -0000 1.3.8.1 *************** *** 9,20 **** The \module{SimpleXMLRPCServer} module provides a basic server ! framework for XML-RPC servers written in Python. The server object is ! based on the \class{\refmodule{SocketServer}.TCPServer} class, ! and the request handler is based on the ! \class{\refmodule{BaseHTTPServer}.BaseHTTPRequestHandler} class. ! \begin{classdesc}{SimpleXMLRPCServer}{addr\optional{, requestHandler\optional{, logRequests}}} Create a new server instance. The \var{requestHandler} parameter should be a factory for request handler instances; it defaults to --- 9,19 ---- The \module{SimpleXMLRPCServer} module provides a basic server ! framework for XML-RPC servers written in Python. Servers can either ! be free standing, using \class{SimpleXMLRPCServer}, or embedded in a ! CGI environment, using \class{CGIXMLRPCRequestHandler}. \begin{classdesc}{SimpleXMLRPCServer}{addr\optional{, requestHandler\optional{, logRequests}}} + Create a new server instance. The \var{requestHandler} parameter should be a factory for request handler instances; it defaults to *************** *** 28,31 **** --- 27,34 ---- \end{classdesc} + \begin{classdesc}{CGIXMLRPCRequestHandler}{} + Create a new instance to handle XML-RPC requests in a CGI + environment. \versionadded{2.3} + \end{classdesc} \begin{classdesc}{SimpleXMLRPCRequestHandler}{} *************** *** 39,56 **** \subsection{SimpleXMLRPCServer Objects \label{simple-xmlrpc-servers}} ! The \class{SimpleXMLRPCServer} class provides two methods that an ! application can use to register functions that can be called via the ! XML-RPC protocol via the request handler. \begin{methoddesc}[SimpleXMLRPCServer]{register_function}{function\optional{, name}} ! Register a function that can respond to XML-RPC requests. The ! function must be callable with a single parameter which will be the ! return value of \function{\refmodule{xmlrpclib}.loads()} when called ! with the payload of the request. If \var{name} is given, it will be ! the method name associated with \var{function}, otherwise ! \code{\var{function}.__name__} will be used. \var{name} can be ! either a normal or Unicode string, and may contain characters not ! legal in Python identifiers, including the period character. \end{methoddesc} --- 42,57 ---- \subsection{SimpleXMLRPCServer Objects \label{simple-xmlrpc-servers}} ! The \class{SimpleXMLRPCServer} class is based on ! \class{SocketServer.TCPServer} and provides a means of creating ! simple, stand alone XML-RPC servers. \begin{methoddesc}[SimpleXMLRPCServer]{register_function}{function\optional{, name}} ! Register a function that can respond to XML-RPC requests. If ! \var{name} is given, it will be the method name associated with ! \var{function}, otherwise \code{\var{function}.__name__} will be ! used. \var{name} can be either a normal or Unicode string, and may ! contain characters not legal in Python identifiers, including the ! period character. \end{methoddesc} *************** *** 69,70 **** --- 70,157 ---- return value is passed back to the client. \end{methoddesc} + + \begin{methoddesc}{register_introspection_functions}{} + Registers the XML-RPC introspection functions \code{system.listMethods}, + \code{system.methodHelp} and \code{system.methodSignature}. + \versionadded{2.3} + \end{methoddesc} + + \begin{methoddesc}{register_multicall_functions}{} + Registers the XML-RPC multicall function system.multicall. + \end{methoddesc} + + Example: + + \begin{verbatim} + class MyFuncs: + def div(self, x, y) : return div(x,y) + + + server = SimpleXMLRPCServer(("localhost", 8000)) + server.register_function(pow) + server.register_function(lambda x,y: x+y, 'add') + server.register_introspection_functions() + server.register_instance(MyFuncs()) + server.serve_forever() + \end{verbatim} + + \subsection{CGIXMLRPCRequestHandler} + + The \class{CGIXMLRPCRequestHandler} class can be used to + handle XML-RPC requests sent to Python CGI scripts. + + \begin{methoddesc}{register_function}{function\optional{, name}} + Register a function that can respond to XML-RPC requests. If + \var{name} is given, it will be the method name associated with + function, otherwise \var{function.__name__} will be used. \var{name} + can be either a normal or Unicode string, and may contain + characters not legal in Python identifiers, including the period + character. + \end{methoddesc} + + \begin{methoddesc}{register_instance}{instance} + Register an object which is used to expose method names + which have not been registered using \method{register_function()}. If + instance contains a \method{_dispatch()} method, it is called with the + requested method name and the parameters from the + request; the return value is returned to the client as the result. + If instance does not have a \method{_dispatch()} method, it is searched + for an attribute matching the name of the requested method; if + the requested method name contains periods, each + component of the method name is searched for individually, + with the effect that a simple hierarchical search is performed. + The value found from this search is then called with the + parameters from the request, and the return value is passed + back to the client. + \end{methoddesc} + + \begin{methoddesc}{register_introspection_functions}{} + Register the XML-RPC introspection functions + \code{system.listMethods}, \code{system.methodHelp} and + \code{system.methodSignature}. + \end{methoddesc} + + \begin{methoddesc}{register_multicall_functions}{} + Register the XML-RPC multicall function \code{system.multicall}. + \end{methoddesc} + + \begin{methoddesc}{handle_request}{\optional{request_text = None}} + Handle a XML-RPC request. If \var{request_text} is given, it + should be the POST data provided by the HTTP server, + otherwise the contents of stdin will be used. + \end{methoddesc} + + Example: + + \begin{verbatim} + class MyFuncs: + def div(self, x, y) : return div(x,y) + + + handler = CGIXMLRPCRequestHandler() + handler.register_function(pow) + handler.register_function(lambda x,y: x+y, 'add') + handler.register_introspection_functions() + handler.register_instance(MyFuncs()) + handler.handle_request() + \end{verbatim} Index: libsignal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsignal.tex,v retrieving revision 1.24 retrieving revision 1.24.2.1 diff -C2 -d -r1.24 -r1.24.2.1 *** libsignal.tex 27 May 2002 15:08:24 -0000 1.24 --- libsignal.tex 28 Apr 2003 17:34:50 -0000 1.24.2.1 *************** *** 19,22 **** --- 19,26 ---- \item + There is no way to ``block'' signals temporarily from critical + sections (since this is not supported by all \UNIX{} flavors). + + \item Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the *************** *** 89,102 **** \end{datadesc} - \begin{datadesc}{SIG_BLOCK} - \end{datadesc} - \begin{datadesc}{SIG_UNBLOCK} - \end{datadesc} - \begin{datadesc}{SIG_SETMASK} - These constants are for use as the first parameter of the - \function{sigprocmask} function described below. - \end{datadesc} - - The \module{signal} module defines the following functions: --- 93,96 ---- *************** *** 149,192 **** reference manual for a description of frame objects). \obindex{frame} - \end{funcdesc} - - The following functions are supported if your platform does. Most - modern \UNIX-alikes now do. - - \begin{funcdesc}{sigpending}{} - Return the set of pending signals, i.e. a list containing the - numbers of those signals that have been raised while blocked. - \versionadded{2.3} - \end{funcdesc} - - \begin{funcdesc}{sigprocmask}{how, sigset} - Change the list of currently blocked signals. The parameter - \var{how} should be one of \constant{SIG_BLOCK}, - \constant{SIG_UNBLOCK} or \constant{SIG_SETMASK} and \var{sigset} - should be a sequence of signal numbers. The behaviour of the call - depends on the value of \var{how}: - - \begin{tableii}{l|l}{textrm}{Value of \var{how}}{Behaviour of call} - \lineii{\constant{SIG_BLOCK}} - {The set of blocked signals is the union of the current set - and \var{sigset}.} - \lineii{\constant{SIG_UNBLOCK}} - {The signals in \var{sigset} are removed from the current - set of blocked signals. It is legal to attempt to unblock - a signal which is not blocked.} - \lineii{\constant{SIG_SETMASK}} - {The set of blocked signals is set to the \var{sigset}.} - \end{tableii} - - A list contating the numbers of the previously blocked signals is - returned. - \versionadded{2.3} - \end{funcdesc} - - \begin{funcdesc}{sigsuspend}{sigset} - Temporarily replace the signal mask with \var{sigset} (which should - be a sequnce of signal numbers) and suspend the process until a - signal is received. - \versionadded{2.3} \end{funcdesc} --- 143,146 ---- Index: libshutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshutil.tex,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** libshutil.tex 30 Jun 2002 04:43:20 -0000 1.10 --- libshutil.tex 28 Apr 2003 17:34:52 -0000 1.10.2.1 *************** *** 70,82 **** the source tree are represented as symbolic links in the new tree; if false or omitted, the contents of the linked files are copied to ! the new tree. Errors are reported to standard output. The source code for this should be considered an example rather than a tool. \end{funcdesc} \begin{funcdesc}{rmtree}{path\optional{, ignore_errors\optional{, onerror}}} ! \index{directory!deleting} ! Delete an entire directory tree. If \var{ignore_errors} is true, errors resulting from failed removals will be ignored; if false or omitted, such errors are handled by calling a handler specified by --- 70,85 ---- the source tree are represented as symbolic links in the new tree; if false or omitted, the contents of the linked files are copied to ! the new tree. If exception(s) occur, an Error is raised ! with a list of reasons. The source code for this should be considered an example rather than a tool. + \versionchanged[Error is raised if any exceptions occur during copying, + rather than printing a message]{2.3} \end{funcdesc} \begin{funcdesc}{rmtree}{path\optional{, ignore_errors\optional{, onerror}}} ! Delete an entire directory tree.\index{directory!deleting} ! If \var{ignore_errors} is true, errors resulting from failed removals will be ignored; if false or omitted, such errors are handled by calling a handler specified by *************** *** 94,97 **** --- 97,116 ---- \end{funcdesc} + \begin{funcdesc}{move}{src, dst} + Recursively move a file or directory to another location. + + If the destination is on our current filesystem, then simply use + rename. Otherwise, copy src to the dst and then remove src. + + \versionadded{2.3} + \end{funcdesc} + + \begin{excdesc}{Error} + This exception collects exceptions that raised during a mult-file + operation. For \function{copytree}, the exception argument is a + list of 3-tuples (\var{srcname}, \var{dstname}, \var{exception}). + + \versionadded{2.3} + \end{excdesc} \subsection{Example \label{shutil-example}} Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.12 retrieving revision 1.12.20.1 diff -C2 -d -r1.12 -r1.12.20.1 *** libshlex.tex 9 May 2001 15:50:17 -0000 1.12 --- libshlex.tex 28 Apr 2003 17:34:53 -0000 1.12.20.1 *************** *** 5,9 **** --- 5,11 ---- \modulesynopsis{Simple lexical analysis for \UNIX\ shell-like languages.} \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} + \moduleauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} + \sectionauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \versionadded{1.5.2} *************** *** 11,28 **** The \class{shlex} class makes it easy to write lexical analyzers for simple syntaxes resembling that of the \UNIX{} shell. This will often ! be useful for writing minilanguages, e.g.\ in run control files for ! Python applications. ! ! \begin{classdesc}{shlex}{\optional{stream\optional{, file}}} ! A \class{shlex} instance or subclass instance is a lexical analyzer ! object. The initialization argument, if present, specifies where to ! read characters from. It must be a file- or stream-like object with ! \method{read()} and \method{readline()} methods. If no argument is given, ! input will be taken from \code{sys.stdin}. The second optional ! argument is a filename string, which sets the initial value of the ! \member{infile} member. If the stream argument is omitted or ! equal to \code{sys.stdin}, this second argument defaults to ``stdin''. ! \end{classdesc} ! \begin{seealso} --- 13,18 ---- The \class{shlex} class makes it easy to write lexical analyzers for simple syntaxes resembling that of the \UNIX{} shell. This will often ! be useful for writing minilanguages, (e.g. in run control files for ! Python applications) or for parsing quoted strings. \begin{seealso} *************** *** 32,45 **** \subsection{shlex Objects \label{shlex-objects}} A \class{shlex} instance has the following methods: - \begin{methoddesc}{get_token}{} Return a token. If tokens have been stacked using \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate ! end-of-file, an empty string is returned. \end{methoddesc} --- 22,68 ---- + \subsection{Module Contents} + + The \module{shlex} module defines the following functions: + + \begin{funcdesc}{split}{s\optional{, comments=\code{False}}} + Split the string \var{s} using shell-like syntax. If \var{comments} is + \code{False}, the parsing of comments in the given string will be + disabled (setting the \member{commenters} member of the \class{shlex} + instance to the empty string). This function operates in \POSIX{} mode. + \versionadded{2.3} + \end{funcdesc} + + The \module{shlex} module defines the following classes: + + \begin{classdesc}{shlex}{\optional{instream=\code{sys.stdin}\optional{, + infile=\code{None}\optional{, + posix=\code{False}}}}} + A \class{shlex} instance or subclass instance is a lexical analyzer + object. The initialization argument, if present, specifies where to + read characters from. It must be a file-/stream-like object with + \method{read()} and \method{readline()} methods, or a string (strings + are accepted since Python 2.3). If no argument is given, input will be + taken from \code{sys.stdin}. The second optional argument is a filename + string, which sets the initial value of the \member{infile} member. If + the \var{instream} argument is omitted or equal to \code{sys.stdin}, + this second argument defaults to ``stdin''. The \var{posix} argument + was introduced in Python 2.3, and defines the operational mode. When + \var{posix} is not true (default), the \class{shlex} instance will + operate in compatibility mode. When operating in \POSIX{} mode, + \class{shlex} will try to be as close as possible to the \POSIX{} shell + parsing rules. See~\ref{shlex-objects}. + \end{classdesc} + \subsection{shlex Objects \label{shlex-objects}} A \class{shlex} instance has the following methods: \begin{methoddesc}{get_token}{} Return a token. If tokens have been stacked using \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate ! end-of-file, \member{self.eof} is returned (the empty string (\code{''}) ! in non-\POSIX{} mode, and \code{None} in \POSIX{} mode). \end{methoddesc} *************** *** 133,136 **** --- 156,165 ---- \end{memberdesc} + \begin{memberdesc}{escape} + Characters that will be considered as escape. This will be only used + in \POSIX{} mode, and includes just \character{\textbackslash} by default. + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}{quotes} Characters that will be considered string quotes. The token *************** *** 140,143 **** --- 169,186 ---- \end{memberdesc} + \begin{memberdesc}{escapedquotes} + Characters in \member{quotes} that will interpret escape characters + defined in \member{escape}. This is only used in \POSIX{} mode, and + includes just \character{"} by default. + \versionadded{2.3} + \end{memberdesc} + + \begin{memberdesc}{whitespace_split} + If \code{True}, tokens will only be split in whitespaces. This is useful, for + example, for parsing command lines with \class{shlex}, getting tokens + in a similar way to shell arguments. + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}{infile} The name of the current input file, as initially set at class *************** *** 169,179 **** \end{memberdesc} - Note that any character not declared to be a word character, - whitespace, or a quote will be returned as a single-character token. - - Quote and comment characters are not recognized within words. Thus, - the bare words \samp{ain't} and \samp{ain\#t} would be returned as single - tokens by the default parser. - \begin{memberdesc}{lineno} Source line number (count of newlines seen so far plus one). --- 212,215 ---- *************** *** 184,185 **** --- 220,274 ---- exceptions. \end{memberdesc} + + \begin{memberdesc}{eof} + Token used to determine end of file. This will be set to the empty + string (\code{''}), in non-\POSIX{} mode, and to \code{None} in + \POSIX{} mode. + \versionadded{2.3} + \end{memberdesc} + + \subsection{Parsing Rules\label{shlex-parsing-rules}} + + When operating in non-\POSIX{} mode, \class{shlex} will try to obey to + the following rules. + + \begin{itemize} + \item Quote characters are not recognized within words + (\code{Do"Not"Separate} is parsed as the single word + \code{Do"Not"Separate}); + \item Escape characters are not recognized; + \item Enclosing characters in quotes preserve the literal value of + all characters within the quotes; + \item Closing quotes separate words (\code{"Do"Separate} is parsed + as \code{"Do"} and \code{Separate}); + \item If \member{whitespace_split} is \code{False}, any character not + declared to be a word character, whitespace, or a quote will be + returned as a single-character token. If it is \code{True}, + \class{shlex} will only split words in whitespaces; + \item EOF is signaled with an empty string (\code{''}); + \item It's not possible to parse empty strings, even if quoted. + \end{itemize} + + When operating in \POSIX{} mode, \class{shlex} will try to obey to the + following parsing rules. + + \begin{itemize} + \item Quotes are stripped out, and do not separate words + (\code{"Do"Not"Separate"} is parsed as the single word + \code{DoNotSeparate}); + \item Non-quoted escape characters (e.g. \character{\textbackslash}) + preserve the literal value of the next character that follows; + \item Enclosing characters in quotes which are not part of + \member{escapedquotes} (e.g. \character{'}) preserve the literal + value of all characters within the quotes; + \item Enclosing characters in quotes which are part of + \member{escapedquotes} (e.g. \character{"}) preserves the literal + value of all characters within the quotes, with the exception of + the characters mentioned in \member{escape}. The escape characters + retain its special meaning only when followed by the quote in use, + or the escape character itself. Otherwise the escape character + will be considered a normal character. + \item EOF is signaled with a \code{None} value; + \item Quoted empty strings (\code{''}) are allowed; + \end{itemize} + Index: libshelve.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshelve.tex,v retrieving revision 1.14 retrieving revision 1.14.26.1 diff -C2 -d -r1.14 -r1.14.26.1 *** libshelve.tex 16 Jul 2000 19:01:10 -0000 1.14 --- libshelve.tex 28 Apr 2003 17:34:53 -0000 1.14.26.1 *************** *** 14,38 **** \refstmodindex{pickle} ! To summarize the interface (\code{key} is a string, \code{data} is an ! arbitrary object): ! \begin{verbatim} ! import shelve ! d = shelve.open(filename) # open, with (g)dbm filename -- no suffix ! d[key] = data # store data at key (overwrites old data if ! # using an existing key) ! data = d[key] # retrieve data at key (raise KeyError if no ! # such key) ! del d[key] # delete data stored at key (raises KeyError ! # if no such key) ! flag = d.has_key(key) # true if the key exists ! list = d.keys() # a list of all existing keys (slow!) ! d.close() # close it ! \end{verbatim} ! Restrictions: \begin{itemize} --- 14,48 ---- \refstmodindex{pickle} ! \begin{funcdesc}{open}{filename\optional{,flag='c'\optional{,protocol=\code{None}\optional{,writeback=\code{False}\optional{,binary=\code{None}}}}}} ! Open a persistent dictionary. The filename specified is the base filename ! for the underlying database. As a side-effect, an extension may be added to ! the filename and more than one file may be created. By default, the ! underlying database file is opened for reading and writing. The optional ! {}\var{flag} pararameter has the same interpretation as the \var{flag} ! parameter of \function{anydbm.open}. ! By default, version 0 pickles are used to serialize values. ! The version of the pickle protocol can be specified with the ! \var{protocol} parameter. \versionchanged[The \var{protocol} ! parameter was added. The \var{binary} parameter is deprecated ! and provided for backwards compatibility only]{2.3} ! By default, mutations to persistent-dictionary mutable entries are not ! automatically written back. If the optional \var{writeback} parameter ! is set to {}\var{True}, all entries accessed are cached in memory, and ! written back at close time; this can make it handier to mutate mutable ! entries in the persistent dictionary, but, if many entries are ! accessed, it can consume vast amounts of memory for the cache, and it ! can make the close operation very slow since all accessed entries are ! written back (there is no way to determine which accessed entries are ! mutable, nor which ones were actually mutated). ! \end{funcdesc} ! Shelve objects support all methods supported by dictionaries. This eases ! the transition from dictionary based scripts to those requiring persistent ! storage. ! \subsection{Restrictions} \begin{itemize} *************** *** 40,46 **** \item The choice of which database package will be used ! (e.g. \refmodule{dbm} or \refmodule{gdbm}) depends on which interface ! is available. Therefore it is not safe to open the database directly ! using \refmodule{dbm}. The database is also (unfortunately) subject to the limitations of \refmodule{dbm}, if it is used --- this means that (the pickled representation of) the objects stored in the --- 50,56 ---- \item The choice of which database package will be used ! (such as \refmodule{dbm}, \refmodule{gdbm} or \refmodule{bsddb}) depends on ! which interface is available. Therefore it is not safe to open the database ! directly using \refmodule{dbm}. The database is also (unfortunately) subject to the limitations of \refmodule{dbm}, if it is used --- this means that (the pickled representation of) the objects stored in the *************** *** 49,56 **** \refbimodindex{dbm} \refbimodindex{gdbm} \item ! Dependent on the implementation, closing a persistent dictionary may ! or may not be necessary to flush changes to disk. \item --- 59,69 ---- \refbimodindex{dbm} \refbimodindex{gdbm} + \refbimodindex{bsddb} \item ! Depending on the implementation, closing a persistent dictionary may ! or may not be necessary to flush changes to disk. The \method{__del__} ! method of the \class{Shelf} class calls the \method{close} method, so the ! programmer generally need not do this explicitly. \item *************** *** 64,71 **** \end{itemize} \begin{seealso} \seemodule{anydbm}{Generic interface to \code{dbm}-style databases.} ! \seemodule{dbhash}{BSD \code{db} database interface.} \seemodule{dbm}{Standard \UNIX{} database interface.} \seemodule{dumbdbm}{Portable implementation of the \code{dbm} interface.} --- 77,162 ---- \end{itemize} + \begin{classdesc}{Shelf}{dict\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}} + A subclass of \class{UserDict.DictMixin} which stores pickled values in the + \var{dict} object. + + By default, version 0 pickles are used to serialize values. The + version of the pickle protocol can be specified with the + \var{protocol} parameter. See the \module{pickle} documentation for a + discussion of the pickle protocols. \versionchanged[The \var{protocol} + parameter was added. The \var{binary} parameter is deprecated and + provided for backwards compatibility only]{2.3} + + If the \var{writeback} parameter is \code{True}, the object will hold a + cache of all entries accessed and write them back to the \var{dict} at + sync and close times. This allows natural operations on mutable entries, + but can consume much more memory and make sync and close take a long time. + \end{classdesc} + + \begin{classdesc}{BsdDbShelf}{dict\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}} + + A subclass of \class{Shelf} which exposes \method{first}, + \method{next}, \method{previous}, \method{last} and + \method{set_location} which are available in the \module{bsddb} module + but not in other database modules. The \var{dict} object passed to + the constructor must support those methods. This is generally + accomplished by calling one of \function{bsddb.hashopen}, + \function{bsddb.btopen} or \function{bsddb.rnopen}. The optional + \var{protocol}, \var{writeback}, and \var{binary} parameters have the + same interpretation as for the \class{Shelf} class. + + \end{classdesc} + + \begin{classdesc}{DbfilenameShelf}{filename\optional{, flag='c'\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}}} + + A subclass of \class{Shelf} which accepts a \var{filename} instead of + a dict-like object. The underlying file will be opened using + {}\function{anydbm.open}. By default, the file will be created and + opened for both read and write. The optional \var{flag} parameter has + the same interpretation as for the \function{open} function. The + optional \var{protocol}, \var{writeback}, and \var{binary} parameters + have the same interpretation as for the \class{Shelf} class. + + \end{classdesc} + + \subsection{Example} + + To summarize the interface (\code{key} is a string, \code{data} is an + arbitrary object): + + \begin{verbatim} + import shelve + + d = shelve.open(filename) # open -- file may get suffix added by low-level + # library + + d[key] = data # store data at key (overwrites old data if + # using an existing key) + data = d[key] # retrieve a COPY of data at key (raise KeyError if no + # such key) + del d[key] # delete data stored at key (raises KeyError + # if no such key) + flag = d.has_key(key) # true if the key exists + list = d.keys() # a list of all existing keys (slow!) + + # as d was opened WITHOUT writeback=True, beware: + d['xx'] = range(4) # this works as expected, but... + d['xx'].append(5) # *this doesn't!* -- d['xx'] is STILL range(4)!!! + # having opened d without writeback=True, you need to code carefully: + temp = d['xx'] # extracts the copy + temp.append(5) # mutates the copy + d['xx'] = temp # stores the copy right back, to persist it + # or, d=shelve.open(filename,writeback=True) would let you just code + # d['xx'].append(5) and have it work as expected, BUT it would also + # consume more memory and make the d.close() operation slower. + + d.close() # close it + \end{verbatim} \begin{seealso} \seemodule{anydbm}{Generic interface to \code{dbm}-style databases.} ! \seemodule{bsddb}{BSD \code{db} database interface.} ! \seemodule{dbhash}{Thin layer around the \module{bsddb} which provides an ! \function{open} function like the other database modules.} \seemodule{dbm}{Standard \UNIX{} database interface.} \seemodule{dumbdbm}{Portable implementation of the \code{dbm} interface.} Index: librotor.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librotor.tex,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** librotor.tex 10 Jun 2002 19:42:43 -0000 1.19 --- librotor.tex 28 Apr 2003 17:35:00 -0000 1.19.2.1 *************** *** 5,8 **** --- 5,10 ---- \modulesynopsis{Enigma-like encryption and decryption.} + \deprecated{2.3}{The encryption algorithm is insecure.} + This module implements a rotor-based encryption algorithm, contributed by Index: librlcompleter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librlcompleter.tex,v retrieving revision 1.7 retrieving revision 1.7.18.1 diff -C2 -d -r1.7 -r1.7.18.1 *** librlcompleter.tex 10 Aug 2001 16:15:08 -0000 1.7 --- librlcompleter.tex 28 Apr 2003 17:35:02 -0000 1.7.18.1 *************** *** 59,63 **** If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but it ! can generate calls to \method{__getattr__()}) upto the last part, and find matches for the rest via the \function{dir()} function. \end{methoddesc} --- 59,63 ---- If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but it ! can generate calls to \method{__getattr__()}) up to the last part, and find matches for the rest via the \function{dir()} function. \end{methoddesc} Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.40 retrieving revision 1.40.2.1 diff -C2 -d -r1.40 -r1.40.2.1 *** librfc822.tex 9 Apr 2002 18:14:59 -0000 1.40 --- librfc822.tex 28 Apr 2003 17:35:02 -0000 1.40.2.1 *************** *** 5,8 **** --- 5,13 ---- \modulesynopsis{Parse \rfc{2822} style mail messages.} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{rfc822} module. This + module is present only to maintain backward + compatibility.} + This module defines a class, \class{Message}, which represents an ``email message'' as defined by the Internet standard *************** *** 125,132 **** \begin{seealso} \seemodule{mailbox}{Classes to read various mailbox formats produced by end-user mail programs.} ! \seemodule{mimetools}{Subclass of rfc.Message that handles MIME encoded ! messages.} \end{seealso} --- 130,139 ---- \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{rfc822} module.} \seemodule{mailbox}{Classes to read various mailbox formats produced by end-user mail programs.} ! \seemodule{mimetools}{Subclass of \class{rfc822.Message} that ! handles MIME encoded messages.} \end{seealso} *************** *** 249,258 **** \code{\var{m}.getheader(name)} but raises \exception{KeyError} if there is no matching header; and \code{len(\var{m})}, ! \code{\var{m}.get(name\optional{, deafult})}, ! \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} \code{\var{m}.items()}, and ! \code{\var{m}.setdefault(name\optional{, default})} act as expected, ! with the one difference that \method{get()} and \method{setdefault()} ! use an empty string as the default value. \class{Message} instances also support the mapping writable interface \code{\var{m}[name] = value} and \code{del \var{m}[name]}. \class{Message} objects do not --- 256,265 ---- \code{\var{m}.getheader(name)} but raises \exception{KeyError} if there is no matching header; and \code{len(\var{m})}, ! \code{\var{m}.get(\var{name}\optional{\var{, default}})}, ! \code{\var{m}.has_key(\var{name})}, \code{\var{m}.keys()}, \code{\var{m}.values()} \code{\var{m}.items()}, and ! \code{\var{m}.setdefault(\var{name}\optional{\var{, default}})} act as ! expected, with the one difference that \method{setdefault()} uses ! an empty string as the default value. \class{Message} instances also support the mapping writable interface \code{\var{m}[name] = value} and \code{del \var{m}[name]}. \class{Message} objects do not Index: librexec.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librexec.tex,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** librexec.tex 31 May 2002 21:12:53 -0000 1.19 --- librexec.tex 28 Apr 2003 17:35:04 -0000 1.19.2.1 *************** *** 6,10 **** - This module contains the \class{RExec} class, which supports \method{r_eval()}, \method{r_execfile()}, \method{r_exec()}, and --- 6,9 ---- *************** *** 16,23 **** can subclass \class{RExec} to add or remove capabilities as desired. ! \note{The \class{RExec} class can prevent code from performing ! unsafe operations like reading or writing disk files, or using TCP/IP ! sockets. However, it does not protect against code using extremely ! large amounts of memory or processor time.} \begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}} --- 15,35 ---- can subclass \class{RExec} to add or remove capabilities as desired. ! \begin{notice}[warning] ! While the \module{rexec} module is designed to perform as described ! below, it does have a few known vulnerabilities which could be ! exploited by carefully written code. Thus it should not be relied ! upon in situations requiring ``production ready'' security. In such ! situations, execution via sub-processes or very careful ! ``cleansing'' of both code and data to be processed may be ! necessary. Alternatively, help in patching known \module{rexec} ! vulnerabilities would be welcomed. ! \end{notice} ! ! \begin{notice} ! The \class{RExec} class can prevent code from performing unsafe ! operations like reading or writing disk files, or using TCP/IP ! sockets. However, it does not protect against code using extremely ! large amounts of memory or processor time. ! \end{notice} \begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}} Index: libreadline.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libreadline.tex,v retrieving revision 1.8 retrieving revision 1.8.12.1 diff -C2 -d -r1.8 -r1.8.12.1 *** libreadline.tex 19 Oct 2001 01:18:43 -0000 1.8 --- libreadline.tex 28 Apr 2003 17:35:07 -0000 1.8.12.1 *************** *** 81,84 **** --- 81,89 ---- \end{funcdesc} + \begin{funcdesc}{get_completer}{} + Get the completer function, or \code{None} if no completer function + has been set. \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{get_begidx}{} Get the beginning index of the readline tab-completion scope. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.84 retrieving revision 1.84.2.1 diff -C2 -d -r1.84 -r1.84.2.1 *** libre.tex 22 Jun 2002 01:07:37 -0000 1.84 --- libre.tex 28 Apr 2003 17:35:09 -0000 1.84.2.1 *************** *** 2,7 **** Regular expression operations} \declaremodule{standard}{re} ! \moduleauthor{Fredrik Lundh}{effbot@telia.com} ! \sectionauthor{Andrew M. Kuchling}{akuchlin@mems-exchange.org} --- 2,7 ---- Regular expression operations} \declaremodule{standard}{re} ! \moduleauthor{Fredrik Lundh}{fredrik@pythonware.com} ! \sectionauthor{Andrew M. Kuchling}{amk@amk.ca} *************** *** 36,42 **** \begin{seealso} \seetitle{Mastering Regular Expressions}{Book on regular expressions ! by Jeffrey Friedl, published by O'Reilly. The Python ! material in this book dates from before the \refmodule{re} ! module, but it covers writing good regular expression patterns in great detail.} \end{seealso} --- 36,42 ---- \begin{seealso} \seetitle{Mastering Regular Expressions}{Book on regular expressions ! by Jeffrey Friedl, published by O'Reilly. The second ! edition of the book no longer covers Python at all, ! but the first edition covered writing good regular expression patterns in great detail.} \end{seealso} *************** *** 59,63 **** expressions like the ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book ! referenced below, or almost any textbook about compiler construction. A brief explanation of the format of regular expressions follows. For --- 59,63 ---- expressions like the ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book ! referenced above, or almost any textbook about compiler construction. A brief explanation of the format of regular expressions follows. For *************** *** 130,136 **** \var{m} to \var{n} repetitions of the preceding RE, attempting to match as many repetitions as possible. For example, \regexp{a\{3,5\}} ! will match from 3 to 5 \character{a} characters. Omitting \var{n} ! specifies an infinite upper bound; you can't omit \var{m}. As an ! example, \regexp{a\{4,\}b} will match \code{aaaab}, a thousand \character{a} characters followed by a \code{b}, but not \code{aaab}. The comma may not be omitted or the modifier would be confused with --- 130,137 ---- \var{m} to \var{n} repetitions of the preceding RE, attempting to match as many repetitions as possible. For example, \regexp{a\{3,5\}} ! will match from 3 to 5 \character{a} characters. Omitting \var{m} ! specifies a lower bound of zero, ! and omitting \var{n} specifies an infinite upper bound. As an ! example, \regexp{a\{4,\}b} will match \code{aaaab} or a thousand \character{a} characters followed by a \code{b}, but not \code{aaab}. The comma may not be omitted or the modifier would be confused with *************** *** 314,319 **** is 0, or \var{number} is 3 octal digits long, it will not be interpreted as a group match, but as the character with octal value \var{number}. - (There is a group 0, which is the entire matched pattern, but it can't - be referenced with \regexp{\e 0}; instead, use \regexp{\e g<0>}.) Inside the \character{[} and \character{]} of a character class, all numeric escapes are treated as characters. --- 315,318 ---- *************** *** 323,333 **** \item[\code{\e b}] Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of ! alphanumeric characters, so the end of a word is indicated by ! whitespace or a non-alphanumeric character. Inside a character range, ! \regexp{\e b} represents the backspace character, for compatibility with ! Python's string literals. ! \item[\code{\e B}] Matches the empty string, but only when it is ! \emph{not} at the beginning or end of a word. \item[\code{\e d}]Matches any decimal digit; this is --- 322,336 ---- \item[\code{\e b}] Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of ! alphanumeric or underscore characters, so the end of a word is indicated by ! whitespace or a non-alphanumeric, non-underscore character. Note that ! {}\code{\e b} is defined as the boundary between \code{\e w} and \code{\e ! W}, so the precise set of characters deemed to be alphanumeric depends on the ! values of the \code{UNICODE} and \code{LOCALE} flags. Inside a character ! range, \regexp{\e b} represents the backspace character, for compatibility ! with Python's string literals. ! \item[\code{\e B}] Matches the empty string, but only when it is \emph{not} ! at the beginning or end of a word. This is just the opposite of {}\code{\e ! b}, so is also subject to the settings of \code{LOCALE} and \code{UNICODE}. \item[\code{\e d}]Matches any decimal digit; this is *************** *** 344,351 **** \item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE} ! flags are not specified, ! matches any alphanumeric character; this is equivalent to the set \regexp{[a-zA-Z0-9_]}. With \constant{LOCALE}, it will match the set ! \regexp{[0-9_]} plus whatever characters are defined as letters for the current locale. If \constant{UNICODE} is set, this will match the characters \regexp{[0-9_]} plus whatever is classified as alphanumeric --- 347,354 ---- \item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE} ! flags are not specified, matches any alphanumeric character and the ! underscore; this is equivalent to the set \regexp{[a-zA-Z0-9_]}. With \constant{LOCALE}, it will match the set ! \regexp{[0-9_]} plus whatever characters are defined as alphanumeric for the current locale. If \constant{UNICODE} is set, this will match the characters \regexp{[0-9_]} plus whatever is classified as alphanumeric *************** *** 356,362 **** is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With \constant{LOCALE}, it will match any character not in the set ! \regexp{[0-9_]}, and not defined as a letter for the current locale. If \constant{UNICODE} is set, this will match anything other than ! \regexp{[0-9_]} and characters marked at alphanumeric in the Unicode character properties database. --- 359,365 ---- is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With \constant{LOCALE}, it will match any character not in the set ! \regexp{[0-9_]}, and not defined as alphanumeric for the current locale. If \constant{UNICODE} is set, this will match anything other than ! \regexp{[0-9_]} and characters marked as alphanumeric in the Unicode character properties database. *************** *** 379,383 **** ! \subsection{Matching vs. Searching \label{matching-searching}} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 382,388 ---- ! % Note the lack of a period in the section title; it causes problems ! % with readers of the GNU info version. See http://www.python.org/sf/581414. ! \subsection{Matching vs Searching \label{matching-searching}} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} *************** *** 667,672 **** The optional parameter \var{endpos} limits how far the string will be searched; it will be as if the string is \var{endpos} characters ! long, so only the characters from \var{pos} to \var{endpos} will be ! searched for a match. \end{methoddesc} --- 672,681 ---- The optional parameter \var{endpos} limits how far the string will be searched; it will be as if the string is \var{endpos} characters ! long, so only the characters from \var{pos} to \code{\var{endpos} - ! 1} will be searched for a match. If \var{endpos} is less than ! \var{pos}, no match will be found, otherwise, if \var{rx} is a ! compiled regular expression object, ! \code{\var{rx}.match(\var{string}, 0, 50)} is equivalent to ! \code{\var{rx}.match(\var{string}[:50], 0)}. \end{methoddesc} *************** *** 773,777 **** \begin{methoddesc}[MatchObject]{start}{\optional{group}} ! \funcline{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole --- 782,786 ---- \begin{methoddesc}[MatchObject]{start}{\optional{group}} ! \methodline{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole *************** *** 815,818 **** --- 824,836 ---- \end{memberdesc} + \begin{memberdesc}[MatchObject]{lastindex} + The integer index of the last matched capturing group, or \code{None} + if no group was matched at all. For example, the expressions + \regexp{(a)b}, \regexp{((a)(b))}, and \regexp{((ab))} will have + \code{lastindex == 1} if applyied to the string \code{'ab'}, + while the expression \regexp{(a)(b)} will have \code{lastindex == 2}, + if applyied to the same string. + \end{memberdesc} + \begin{memberdesc}[MatchObject]{lastgroup} The name of the last matched capturing group, or \code{None} if the *************** *** 820,828 **** \end{memberdesc} - \begin{memberdesc}[MatchObject]{lastindex} - The integer index of the last matched capturing group, or \code{None} - if no group was matched at all. - \end{memberdesc} - \begin{memberdesc}[MatchObject]{re} The regular expression object whose \method{match()} or --- 838,841 ---- *************** *** 851,859 **** {\regexp{.\{5\}}} \lineii{\code{\%d}} ! {\regexp{[-+]\e d+}} \lineii{\code{\%e}, \code{\%E}, \code{\%f}, \code{\%g}} ! {\regexp{[-+](\e d+(\e.\e d*)?|\e d*\e.\e d+)([eE]\e d+)?}} \lineii{\code{\%i}} ! {\regexp{[-+](0[xX][\e dA-Fa-f]+|0[0-7]*|\e d+)}} \lineii{\code{\%o}} {\regexp{0[0-7]*}} --- 864,872 ---- {\regexp{.\{5\}}} \lineii{\code{\%d}} ! {\regexp{[-+]?\e d+}} \lineii{\code{\%e}, \code{\%E}, \code{\%f}, \code{\%g}} ! {\regexp{[-+]?(\e d+(\e.\e d*)?|\e d*\e.\e d+)([eE]\e d+)?}} \lineii{\code{\%i}} ! {\regexp{[-+]?(0[xX][\e dA-Fa-f]+|0[0-7]*|\e d+)}} \lineii{\code{\%o}} {\regexp{0[0-7]*}} Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -C2 -d -r1.30 -r1.30.2.1 *** librandom.tex 23 May 2002 21:07:19 -0000 1.30 --- librandom.tex 28 Apr 2003 17:35:13 -0000 1.30.2.1 *************** *** 9,36 **** This module implements pseudo-random number generators for various distributions. For integers, uniform selection from a range. ! For sequences, uniform selection of a random element, and a function to ! generate a random permutation of a list in-place. On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. ! For generating distribution of angles, the circular uniform and ! von Mises distributions are available. Almost all module functions depend on the basic function \function{random()}, which generates a random float uniformly in ! the semi-open range [0.0, 1.0). Python uses the standard Wichmann-Hill ! generator, combining three pure multiplicative congruential ! generators of modulus 30269, 30307 and 30323. Its period (how many ! numbers it generates before repeating the sequence exactly) is ! 6,953,607,871,644. While of much higher quality than the \function{rand()} ! function supplied by most C libraries, the theoretical properties ! are much the same as for a single linear congruential generator of ! large modulus. It is not suitable for all purposes, and is completely ! unsuitable for cryptographic purposes. ! ! The functions in this module are not threadsafe: if you want to call these ! functions from multiple threads, you should explicitly serialize the calls. ! Else, because no critical sections are implemented internally, calls ! from different threads may see the same return values. The functions supplied by this module are actually bound methods of a --- 9,32 ---- This module implements pseudo-random number generators for various distributions. + For integers, uniform selection from a range. ! For sequences, uniform selection of a random element, a function to ! generate a random permutation of a list in-place, and a function for ! random sampling without replacement. ! On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. ! For generating distributions of angles, the von Mises distribution ! is available. Almost all module functions depend on the basic function \function{random()}, which generates a random float uniformly in ! the semi-open range [0.0, 1.0). Python uses the Mersenne Twister as ! the core generator. It produces 53-bit precision floats and has a ! period of 2**19937-1. The underlying implementation in C ! is both fast and threadsafe. The Mersenne Twister is one of the most ! extensively tested random number generators in existence. However, being ! completely deterministic, it is not suitable for all purposes, and is ! completely unsuitable for cryptographic purposes. The functions supplied by this module are actually bound methods of a *************** *** 40,45 **** programs, creating a different instance of \class{Random} for each thread, and using the \method{jumpahead()} method to ensure that the ! generated sequences seen by each thread don't overlap (see example ! below). Class \class{Random} can also be subclassed if you want to use a --- 36,40 ---- programs, creating a different instance of \class{Random} for each thread, and using the \method{jumpahead()} method to ensure that the ! generated sequences seen by each thread don't overlap. Class \class{Random} can also be subclassed if you want to use a *************** *** 48,95 **** \method{setstate()} and \method{jumpahead()} methods. ! Here's one way to create threadsafe distinct and non-overlapping generators: ! ! \begin{verbatim} ! def create_generators(num, delta, firstseed=None): ! """Return list of num distinct generators. ! Each generator has its own unique segment of delta elements ! from Random.random()'s full period. ! Seed the first generator with optional arg firstseed (default ! is None, to seed from current time). ! """ ! ! from random import Random ! g = Random(firstseed) ! result = [g] ! for i in range(num - 1): ! laststate = g.getstate() ! g = Random() ! g.setstate(laststate) ! g.jumpahead(delta) ! result.append(g) ! return result ! ! gens = create_generators(10, 1000000) ! \end{verbatim} ! ! That creates 10 distinct generators, which can be passed out to 10 ! distinct threads. The generators don't share state so can be called ! safely in parallel. So long as no thread calls its \code{g.random()} ! more than a million times (the second argument to ! \function{create_generators()}, the sequences seen by each thread will ! not overlap. The period of the underlying Wichmann-Hill generator ! limits how far this technique can be pushed. ! ! Just for fun, note that since we know the period, \method{jumpahead()} ! can also be used to ``move backward in time:'' ! ! \begin{verbatim} ! >>> g = Random(42) # arbitrary ! >>> g.random() ! 0.25420336316883324 ! >>> g.jumpahead(6953607871644L - 1) # move *back* one ! >>> g.random() ! 0.25420336316883324 ! \end{verbatim} --- 43,52 ---- \method{setstate()} and \method{jumpahead()} methods. ! As an example of subclassing, the \module{random} module provides ! the \class{WichmannHill} class which implements an alternative generator ! in pure Python. The class provides a backward compatible way to ! reproduce results from earlier versions of Python which used the ! Wichmann-Hill algorithm as the core generator. ! \versionchanged[Substituted MersenneTwister for Wichmann-Hill]{2.3} *************** *** 105,120 **** \code{hash(\var{x})} is used instead. If \var{x} is an int or long, \var{x} is used directly. - Distinct values between 0 and 27814431486575L inclusive are guaranteed - to yield distinct internal states (this guarantee is specific to the - default Wichmann-Hill generator, and may not apply to subclasses - supplying their own basic generator). - \end{funcdesc} - - \begin{funcdesc}{whseed}{\optional{x}} - This is obsolete, supplied for bit-level compatibility with versions - of Python prior to 2.1. - See \function{seed} for details. \function{whseed} does not guarantee - that distinct integer arguments yield distinct internal states, and can - yield no more than about 2**24 distinct internal states in all. \end{funcdesc} --- 62,65 ---- *************** *** 135,149 **** \begin{funcdesc}{jumpahead}{n} ! Change the internal state to what it would be if \function{random()} ! were called \var{n} times, but do so quickly. \var{n} is a ! non-negative integer. This is most useful in multi-threaded programs, in conjuction with multiple instances of the \class{Random} ! class: \method{setstate()} or \method{seed()} can be used to force ! all instances into the same internal state, and then ! \method{jumpahead()} can be used to force the instances' states as ! far apart as you like (up to the period of the generator). \versionadded{2.1} \end{funcdesc} Functions for integers: --- 80,97 ---- \begin{funcdesc}{jumpahead}{n} ! Change the internal state to one different from and likely far away from ! the current state. \var{n} is a non-negative integer which is used to ! scramble the current state vector. This is most useful in multi-threaded programs, in conjuction with multiple instances of the \class{Random} ! class: \method{setstate()} or \method{seed()} can be used to force all ! instances into the same internal state, and then \method{jumpahead()} ! can be used to force the instances' states far apart. \versionadded{2.1} + \versionchanged[Instead of jumping to a specific state, \var{n} steps + ahead, \method{jumpahead(\var{n})} jumps to another state likely to be + separated by many steps.]{2.3} \end{funcdesc} + Functions for integers: *************** *** 180,183 **** --- 128,151 ---- \end{funcdesc} + \begin{funcdesc}{sample}{population, k} + Return a \var{k} length list of unique elements chosen from the + population sequence. Used for random sampling without replacement. + \versionadded{2.3} + + Returns a new list containing elements from the population while + leaving the original population unchanged. The resulting list is + in selection order so that all sub-slices will also be valid random + samples. This allows raffle winners (the sample) to be partitioned + into grand prize and second place winners (the subslices). + + Members of the population need not be hashable or unique. If the + population contains repeats, then each occurrence is a possible + selection in the sample. + + To choose a sample from a range of integers, use \function{xrange} + as an argument. This is especially fast and space efficient for + sampling from a large population: \code{sample(xrange(10000000), 60)}. + \end{funcdesc} + The following functions generate specific real-valued distributions. *************** *** 260,265 **** --- 228,257 ---- \end{funcdesc} + Alternative Generator + + \begin{classdesc}{WichmannHill}{\optional{seed}} + Class that implements the Wichmann-Hill algorithm as the core generator. + Has all of the same methods as \class{Random} plus the \method{whseed} + method described below. Because this class is implemented in pure + Python, it is not threadsafe and may require locks between calls. The + period of the generator is 6,953,607,871,644 which is small enough to + require care that two independent random sequences do not overlap. + \end{classdesc} + + \begin{funcdesc}{whseed}{\optional{x}} + This is obsolete, supplied for bit-level compatibility with versions + of Python prior to 2.1. + See \function{seed} for details. \function{whseed} does not guarantee + that distinct integer arguments yield distinct internal states, and can + yield no more than about 2**24 distinct internal states in all. + \end{funcdesc} \begin{seealso} + \seetext{M. Matsumoto and T. Nishimura, ``Mersenne Twister: A + 623-dimensionally equidistributed uniform pseudorandom + number generator'', + \citetitle{ACM Transactions on Modeling and Computer Simulation} + Vol. 8, No. 1, January pp.3-30 1998.} + \seetext{Wichmann, B. A. \& Hill, I. D., ``Algorithm AS 183: An efficient and portable pseudo-random number generator'', Index: libqueue.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libqueue.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** libqueue.tex 26 Jun 2002 05:22:08 -0000 1.12 --- libqueue.tex 28 Apr 2003 17:35:17 -0000 1.12.2.1 *************** *** 55,88 **** \begin{methoddesc}{empty}{} ! Return \code{1} if the queue is empty, \code{0} otherwise. Because ! of multithreading semantics, this is not reliable. \end{methoddesc} \begin{methoddesc}{full}{} ! Return \code{1} if the queue is full, \code{0} otherwise. Because of ! multithreading semantics, this is not reliable. \end{methoddesc} ! \begin{methoddesc}{put}{item\optional{, block}} ! Put \var{item} into the queue. If optional argument \var{block} is 1 ! (the default), block if necessary until a free slot is available. ! Otherwise (\var{block} is 0), put \var{item} on the queue if a free slot is immediately available, else raise the \exception{Full} ! exception. \end{methoddesc} \begin{methoddesc}{put_nowait}{item} ! Equivalent to \code{put(\var{item}, 0)}. \end{methoddesc} ! \begin{methoddesc}{get}{\optional{block}} ! Remove and return an item from the queue. If optional argument ! \var{block} is 1 (the default), block if necessary until an item is ! available. Otherwise (\var{block} is 0), return an item if one is ! immediately available, else raise the ! \exception{Empty} exception. \end{methoddesc} \begin{methoddesc}{get_nowait}{} ! Equivalent to \code{get(0)}. \end{methoddesc} --- 55,100 ---- \begin{methoddesc}{empty}{} ! Return \code{True} if the queue is empty, \code{False} otherwise. ! Becauseof multithreading semantics, this is not reliable. \end{methoddesc} \begin{methoddesc}{full}{} ! Return \code{True} if the queue is full, \code{False} otherwise. ! Because of multithreading semantics, this is not reliable. \end{methoddesc} ! \begin{methoddesc}{put}{item\optional{, block\optional{, timeout}}} ! Put \var{item} into the queue. If optional args \var{block} is true ! and \var{timeout} is None (the default), block if necessary until a ! free slot is available. If \var{timeout} is a positive number, it ! blocks at most \var{timeout} seconds and raises the \exception{Full} ! exception if no free slot was available within that time. ! Otherwise (\var{block} is false), put an item on the queue if a free slot is immediately available, else raise the \exception{Full} ! exception (\var{timeout} is ignored in that case). ! ! \versionadded[the timeout parameter]{2.3} ! \end{methoddesc} \begin{methoddesc}{put_nowait}{item} ! Equivalent to \code{put(\var{item}, False)}. \end{methoddesc} ! \begin{methoddesc}{get}{\optional{block\optional{, timeout}}} ! Remove and return an item from the queue. If optional args ! \var{block} is true and \var{timeout} is None (the default), ! block if necessary until an item is available. If \var{timeout} is ! a positive number, it blocks at most \var{timeout} seconds and raises ! the \exception{Empty} exception if no item was available within that ! time. Otherwise (\var{block} is false), return an item if one is ! immediately available, else raise the \exception{Empty} exception ! (\var{timeout} is ignored in that case). ! ! \versionadded[the timeout parameter]{2.3} ! \end{methoddesc} \begin{methoddesc}{get_nowait}{} ! Equivalent to \code{get(False)}. \end{methoddesc} Index: libpyexpat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpyexpat.tex,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -C2 -d -r1.18 -r1.18.2.1 *** libpyexpat.tex 20 Jun 2002 21:06:03 -0000 1.18 --- libpyexpat.tex 28 Apr 2003 17:35:20 -0000 1.18.2.1 *************** *** 160,163 **** --- 160,186 ---- \class{xmlparser} objects have the following attributes: + \begin{memberdesc}[xmlparser]{buffer_size} + The size of the buffer used when \member{buffer_text} is true. This + value cannot be changed at this time. + \versionadded{2.3} + \end{memberdesc} + + \begin{memberdesc}[xmlparser]{buffer_text} + Setting this to true causes the \class{xmlparser} object to buffer + textual content returned by Expat to avoid multiple calls to the + \method{CharacterDataHandler()} callback whenever possible. This can + improve performance substantially since Expat normally breaks + character data into chunks at every line ending. This attribute is + false by default, and may be changed at any time. + \versionadded{2.3} + \end{memberdesc} + + \begin{memberdesc}[xmlparser]{buffer_used} + If \member{buffer_text} is enabled, the number of bytes stored in the + buffer. These bytes represent UTF-8 encoded text. This attribute has + no meaningful interpretation when \member{buffer_text} is false. + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}[xmlparser]{ordered_attributes} Setting this attribute to a non-zero integer causes the attributes to *************** *** 458,462 **** Text goes here More text ! """) \end{verbatim} --- 481,485 ---- Text goes here More text ! """, 1) \end{verbatim} Index: libpycompile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpycompile.tex,v retrieving revision 1.2 retrieving revision 1.2.28.1 diff -C2 -d -r1.2 -r1.2.28.1 *** libpycompile.tex 3 Apr 2000 20:13:54 -0000 1.2 --- libpycompile.tex 28 Apr 2003 17:35:23 -0000 1.2.28.1 *************** *** 11,16 **** \indexii{file}{byte-code} ! The \module{py_compile} module provides a single function to generate ! a byte-code file from a source file. Though not often needed, this function can be useful when installing --- 11,17 ---- \indexii{file}{byte-code} ! The \module{py_compile} module provides a function to generate a ! byte-code file from a source file, and another function used when the ! module source file is invoked as a script. Though not often needed, this function can be useful when installing *************** *** 19,24 **** containing the source code. ! \begin{funcdesc}{compile}{file\optional{, cfile\optional{, dfile}}} Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file name \var{file}. The --- 20,28 ---- containing the source code. + \begin{excdesc}{PyCompileError} + Exception raised when an error occurs while attempting to compile the file. + \end{excdesc} ! \begin{funcdesc}{compile}{file\optional{, cfile\optional{, dfile\optional{, doraise}}}} Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file name \var{file}. The *************** *** 27,32 **** --- 31,49 ---- current interpreter). If \var{dfile} is specified, it is used as the name of the source file in error messages instead of \var{file}. + If \var{doraise} = True, a PyCompileError is raised when an error is + encountered while compiling \var{file}. If \var{doraise} = False (the default), + an error string is written to sys.stderr, but no exception is raised. \end{funcdesc} + \begin{funcdesc}{main}{\optional{args}} + Compile several source files. The files named in \var{args} (or on + the command line, if \var{args} is not specified) are compiled and + the resulting bytecode is cached in the normal manner. This + function does not search a directory structure to locate source + files; it only compiles files named explicitly. + \end{funcdesc} + + When this module is run as a script, the \function{main()} is used to + compile all the files named on the command line. \begin{seealso} Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -d -r1.23 -r1.23.2.1 *** libposixpath.tex 5 Apr 2002 02:21:09 -0000 1.23 --- libposixpath.tex 28 Apr 2003 17:35:24 -0000 1.23.2.1 *************** *** 67,87 **** \begin{funcdesc}{getatime}{path} ! Return the time of last access of \var{filename}. The return ! value is integer giving the number of seconds since the epoch (see the \refmodule{time} module). Raise \exception{os.error} if the file does not exist or is inaccessible. \versionadded{1.5.2} \end{funcdesc} \begin{funcdesc}{getmtime}{path} ! Return the time of last modification of \var{filename}. The return ! value is integer giving the number of seconds since the epoch (see the \refmodule{time} module). Raise \exception{os.error} if the file does not exist or is inaccessible. \versionadded{1.5.2} \end{funcdesc} \begin{funcdesc}{getsize}{path} ! Return the size, in bytes, of \var{filename}. Raise \exception{os.error} if the file does not exist or is inaccessible. \versionadded{1.5.2} --- 67,97 ---- \begin{funcdesc}{getatime}{path} ! Return the time of last access of \var{path}. The return ! value is a number giving the number of seconds since the epoch (see the \refmodule{time} module). Raise \exception{os.error} if the file does not exist or is inaccessible. \versionadded{1.5.2} + \versionchanged[If \function{os.stat_float_times()} returns True, the result is a floating point number]{2.3} \end{funcdesc} \begin{funcdesc}{getmtime}{path} ! Return the time of last modification of \var{path}. The return ! value is a number giving the number of seconds since the epoch (see the \refmodule{time} module). Raise \exception{os.error} if the file does not exist or is inaccessible. \versionadded{1.5.2} + \versionchanged[If \function{os.stat_float_times()} returns True, the result is a floating point number]{2.3} + \end{funcdesc} + + \begin{funcdesc}{getctime}{path} + Return the time of creation of \var{path}. The return + value is a number giving the number of seconds since the epoch (see the + \refmodule{time} module). Raise \exception{os.error} if the file does + not exist or is inaccessible. + \versionadded{2.3} \end{funcdesc} \begin{funcdesc}{getsize}{path} ! Return the size, in bytes, of \var{path}. Raise \exception{os.error} if the file does not exist or is inaccessible. \versionadded{1.5.2} *************** *** 123,128 **** an absolute path, all previous components are thrown away, and joining continues. The return value is the concatenation of \var{path1}, and ! optionally \var{path2}, etc., with exactly one slash (\code{'/'}) ! inserted between components, unless \var{path} is empty. \end{funcdesc} --- 133,142 ---- an absolute path, all previous components are thrown away, and joining continues. The return value is the concatenation of \var{path1}, and ! optionally \var{path2}, etc., with exactly one directory separator ! (\code{os.sep}) inserted between components, unless \var{path2} is ! empty. Note that on Windows, since there is a current directory for ! each drive, \function{os.path.join("c:", "foo")} represents a path ! relative to the current directory on drive \file{C:} (\file{c:foo}), not ! \file{c:\textbackslash\textbackslash foo}. \end{funcdesc} *************** *** 215,217 **** --- 229,248 ---- \var{names} must be modified in place, using \keyword{del} or slice assignment.) + + \begin{notice} + Symbolic links to directories are not treated as subdirectories, and + that \function{walk()} therefore will not visit them. To visit linked + directories you must identify them with + \code{os.path.islink(\var{file})} and + \code{os.path.isdir(\var{file})}, and invoke \function{walk()} as + necessary. + \end{notice} \end{funcdesc} + + \begin{datadesc}{supports_unicode_filenames} + True if arbitrary Unicode strings can be used as file names (within + limitations imposed by the file system), and if + \function{os.listdir()} returns Unicode strings for a Unicode + argument. + \versionadded{2.3} + \end{datadesc} Index: libpoplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpoplib.tex,v retrieving revision 1.14 retrieving revision 1.14.8.1 diff -C2 -d -r1.14 -r1.14.8.1 *** libpoplib.tex 5 Dec 2001 22:37:21 -0000 1.14 --- libpoplib.tex 28 Apr 2003 17:35:30 -0000 1.14.8.1 *************** *** 41,48 **** \begin{seealso} \seemodule{imaplib}{The standard Python IMAP module.} ! \seetitle{http://www.tuxedo.org/~esr/fetchail/fetchmail-FAQ.html}{ ! The FAQ for the fetchmail POP/IMAP client collects information ! on POP3 server variations and RFC noncompliance that may be ! useful if you need to write an application based on poplib.} \end{seealso} --- 41,50 ---- \begin{seealso} \seemodule{imaplib}{The standard Python IMAP module.} ! \seetitle[http://www.tuxedo.org/\~{}esr/fetchmail/fetchmail-FAQ.html] ! {Frequently Asked Questions About Fetchmail} ! {The FAQ for the \program{fetchmail} POP/IMAP client collects ! information on POP3 server variations and RFC noncompliance ! that may be useful if you need to write an application based ! on the POP protocol.} \end{seealso} *************** *** 106,110 **** Flag message number \var{which} for deletion. On most servers deletions are not actually performed until QUIT (the major exception is ! Eudora QPOP, which deliberately violates the RFCs by doing pending deletes on any disconnect). \end{methoddesc} --- 108,112 ---- Flag message number \var{which} for deletion. On most servers deletions are not actually performed until QUIT (the major exception is ! Eudora QPOP, which deliberately violates the RFCs by doing pending deletes on any disconnect). \end{methoddesc} *************** *** 124,128 **** \begin{methoddesc}{top}{which, howmuch} Retrieves the message header plus \var{howmuch} lines of the message ! after the header of message number \var{which}. Result is in form \code{(\var{response}, ['line', ...], \var{octets})}. --- 126,130 ---- \begin{methoddesc}{top}{which, howmuch} Retrieves the message header plus \var{howmuch} lines of the message ! after the header of message number \var{which}. Result is in form \code{(\var{response}, ['line', ...], \var{octets})}. Index: libpopen2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpopen2.tex,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** libpopen2.tex 18 Jun 2002 20:38:05 -0000 1.17 --- libpopen2.tex 28 Apr 2003 17:35:31 -0000 1.17.2.1 *************** *** 58,62 **** \function{popen3()} factory functions described above. ! If not using one off the helper functions to create \class{Popen3} objects, the parameter \var{cmd} is the shell command to execute in a sub-process. The \var{capturestderr} flag, if true, specifies that --- 58,62 ---- \function{popen3()} factory functions described above. ! If not using one of the helper functions to create \class{Popen3} objects, the parameter \var{cmd} is the shell command to execute in a sub-process. The \var{capturestderr} flag, if true, specifies that *************** *** 130,134 **** When reading output from a child process that writes a lot of data to standard error while the parent is reading from the child's standard ! out, a dead lock can occur. A similar situation can occur with other combinations of reads and writes. The essential factors are that more than \constant{_PC_PIPE_BUF} bytes are being written by one process in --- 130,134 ---- When reading output from a child process that writes a lot of data to standard error while the parent is reading from the child's standard ! output, a deadlock can occur. A similar situation can occur with other combinations of reads and writes. The essential factors are that more than \constant{_PC_PIPE_BUF} bytes are being written by one process in Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -C2 -d -r1.36 -r1.36.2.1 *** libpickle.tex 21 May 2002 17:22:02 -0000 1.36 --- libpickle.tex 28 Apr 2003 17:35:35 -0000 1.36.2.1 *************** *** 127,134 **** the pickled file with a standard text editor. A binary format, which is slightly more efficient, can be chosen by specifying a true value for the \var{bin} argument to the \class{Pickler} constructor or the \function{dump()} and \function{dumps()} ! functions. \subsection{Usage} --- 127,160 ---- the pickled file with a standard text editor. + There are currently 3 different protocols which can be used for pickling. + + \begin{itemize} + + \item Protocol version 0 is the original ASCII protocol and is backwards + compatible with earlier versions of Python. + + \item Protocol version 1 is the old binary format which is also compatible + with earlier versions of Python. + + \item Protocol version 2 was introduced in Python 2.3. It provides + much more efficient pickling of new-style classes. + + \end{itemize} + + Refer to PEP 307 for more information. + + If a \var{protocol} is not specified, protocol 0 is used. + If \var{protocol} is specified as a negative value + or \constant{HIGHEST_PROTOCOL}, + the highest protocol version available will be used. + + \versionchanged[The \var{bin} parameter is deprecated and only provided + for backwards compatibility. You should use the \var{protocol} + parameter instead]{2.3} + A binary format, which is slightly more efficient, can be chosen by specifying a true value for the \var{bin} argument to the \class{Pickler} constructor or the \function{dump()} and \function{dumps()} ! functions. A \var{protocol} version >= 1 implies use of a binary format. \subsection{Usage} *************** *** 138,147 **** stream, you first create an unpickler, then you call the unpickler's \method{load()} method. The \module{pickle} module provides the following functions to make this process more convenient: ! \begin{funcdesc}{dump}{object, file\optional{, bin}} Write a pickled representation of \var{object} to the open file object \var{file}. This is equivalent to ! \code{Pickler(\var{file}, \var{bin}).dump(\var{object})}. If the optional \var{bin} argument is true, the binary pickle format is used; otherwise the (less efficient) text pickle format is used --- 164,192 ---- stream, you first create an unpickler, then you call the unpickler's \method{load()} method. The \module{pickle} module provides the + following constant: + + \begin{datadesc}{HIGHEST_PROTOCOL} + The highest protocol version available. This value can be passed + as a \var{protocol} value. + \end{datadesc} + + The \module{pickle} module provides the following functions to make this process more convenient: ! \begin{funcdesc}{dump}{object, file\optional{, protocol\optional{, bin}}} Write a pickled representation of \var{object} to the open file object \var{file}. This is equivalent to ! \code{Pickler(\var{file}, \var{protocol}, \var{bin}).dump(\var{object})}. ! ! If the \var{protocol} parameter is ommitted, protocol 0 is used. ! If \var{protocol} is specified as a negative value ! or \constant{HIGHEST_PROTOCOL}, ! the highest protocol version will be used. ! ! \versionchanged[The \var{protocol} parameter was added. ! The \var{bin} parameter is deprecated and only provided ! for backwards compatibility. You should use the \var{protocol} ! parameter instead]{2.3} ! If the optional \var{bin} argument is true, the binary pickle format is used; otherwise the (less efficient) text pickle format is used *************** *** 170,176 **** \end{funcdesc} ! \begin{funcdesc}{dumps}{object\optional{, bin}} Return the pickled representation of the object as a string, instead ! of writing it to a file. If the optional \var{bin} argument is true, the binary pickle format is used; otherwise the (less efficient) text pickle format is used (this is the default). --- 215,233 ---- \end{funcdesc} ! \begin{funcdesc}{dumps}{object\optional{, protocol\optional{, bin}}} Return the pickled representation of the object as a string, instead ! of writing it to a file. ! ! If the \var{protocol} parameter is ommitted, protocol 0 is used. ! If \var{protocol} is specified as a negative value ! or \constant{HIGHEST_PROTOCOL}, ! the highest protocol version will be used. ! ! \versionchanged[The \var{protocol} parameter was added. ! The \var{bin} parameter is deprecated and only provided ! for backwards compatibility. You should use the \var{protocol} ! parameter instead]{2.3} ! ! If the optional \var{bin} argument is true, the binary pickle format is used; otherwise the (less efficient) text pickle format is used (this is the default). *************** *** 211,217 **** \class{Unpickler}: ! \begin{classdesc}{Pickler}{file\optional{, bin}} This takes a file-like object to which it will write a pickle data ! stream. Optional \var{bin} if true, tells the pickler to use the more efficient binary pickle format, otherwise the \ASCII{} format is used (this is the default). --- 268,284 ---- \class{Unpickler}: ! \begin{classdesc}{Pickler}{file\optional{, protocol\optional{, bin}}} This takes a file-like object to which it will write a pickle data ! stream. ! ! If the \var{protocol} parameter is ommitted, protocol 0 is used. ! If \var{protocol} is specified as a negative value, ! the highest protocol version will be used. ! ! \versionchanged[The \var{bin} parameter is deprecated and only provided ! for backwards compatibility. You should use the \var{protocol} ! parameter instead]{2.3} ! ! Optional \var{bin} if true, tells the pickler to use the more efficient binary pickle format, otherwise the \ASCII{} format is used (this is the default). *************** *** 311,315 **** \begin{itemize} ! \item \code{None} \item integers, long integers, floating point numbers, complex numbers --- 378,382 ---- \begin{itemize} ! \item \code{None}, \code{True}, and \code{False} \item integers, long integers, floating point numbers, complex numbers *************** *** 413,423 **** state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the ! pickled object must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they ! want\footnote{This protocol is also used by the shallow and deep copying operations defined in the ! \refmodule{copy} module.}. \subsubsection{Pickling and unpickling extension types} --- 480,496 ---- state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the ! pickled state must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they ! want.\footnote{This protocol is also used by the shallow and deep copying operations defined in the ! \refmodule{copy} module.} ! ! \begin{notice}[warning] ! For new-style classes, if \method{__getstate__()} returns a false ! value, the \method{__setstate__()} method will not be called. ! \end{notice} ! \subsubsection{Pickling and unpickling extension types} Index: libpdb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpdb.tex,v retrieving revision 1.32 retrieving revision 1.32.14.1 diff -C2 -d -r1.32 -r1.32.14.1 *** libpdb.tex 13 Sep 2001 16:56:43 -0000 1.32 --- libpdb.tex 28 Apr 2003 17:35:37 -0000 1.32.14.1 *************** *** 256,259 **** --- 256,269 ---- Continue execution, only stop when a breakpoint is encountered. + \item[j(ump) \var{lineno}] + + Set the next line that will be executed. Only available in the + bottom-most frame. This lets you jump back and execute code + again, or jump forward to skip code that you don't want to run. + + It should be noted that not all jumps are allowed --- for instance it + is not possible to jump into the middle of a \keyword{for} loop or out + of a \keyword{finally} clause. + \item[l(ist) \optional{\var{first\optional{, last}}}] *************** *** 271,276 **** Evaluate the \var{expression} in the current context and print its ! value. (Note: \samp{print} can also be used, but is not a debugger ! command --- this executes the Python \keyword{print} statement.) \item[alias \optional{\var{name} \optional{command}}] --- 281,291 ---- Evaluate the \var{expression} in the current context and print its ! value. \note{\samp{print} can also be used, but is not a debugger ! command --- this executes the Python \keyword{print} statement.} ! ! \item[pp \var{expression}] ! ! Like the \samp{p} command, except the value of the exception is ! pretty-printed using the \module{pprint} module. \item[alias \optional{\var{name} \optional{command}}] *************** *** 299,303 **** alias ps pi self \end{verbatim} ! \item[unalias \var{name}] --- 314,318 ---- alias ps pi self \end{verbatim} ! \item[unalias \var{name}] Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.91 retrieving revision 1.91.2.1 diff -C2 -d -r1.91 -r1.91.2.1 *** libos.tex 2 Jul 2002 21:03:49 -0000 1.91 --- libos.tex 28 Apr 2003 17:35:42 -0000 1.91.2.1 *************** *** 65,69 **** The name of the operating system dependent module imported. The following names have currently been registered: \code{'posix'}, ! \code{'nt'}, \code{'dos'}, \code{'mac'}, \code{'os2'}, \code{'ce'}, \code{'java'}, \code{'riscos'}. \end{datadesc} --- 65,69 ---- The name of the operating system dependent module imported. The following names have currently been registered: \code{'posix'}, ! \code{'nt'}, \code{'mac'}, \code{'os2'}, \code{'ce'}, \code{'java'}, \code{'riscos'}. \end{datadesc} *************** *** 94,98 **** mapping may be used to modify the environment as well as query the environment. \function{putenv()} will be called automatically when ! the mapping is modified. If \function{putenv()} is not provided, this mapping may be passed to --- 94,100 ---- mapping may be used to modify the environment as well as query the environment. \function{putenv()} will be called automatically when ! the mapping is modified. \note{On some platforms, including ! FreeBSD and Mac OS X, setting \code{environ} may cause memory leaks. ! Refer to the system documentation for putenv.} If \function{putenv()} is not provided, this mapping may be passed to *************** *** 140,145 **** \begin{funcdesc}{getlogin}{} ! Return the actual login name for the current process, even if there ! are multiple login names which map to the same user id. Availability: \UNIX. \end{funcdesc} --- 142,150 ---- \begin{funcdesc}{getlogin}{} ! Return the name of the user logged in on the controlling terminal of ! the process. For most purposes, it is more useful to use the ! environment variable \envvar{LOGNAME} to find out who the user is, ! or \code{pwd.getpwuid(os.getuid())[0]} to get the login name ! of the currently effective user ID. Availability: \UNIX. \end{funcdesc} *************** *** 191,194 **** --- 196,203 ---- Availability: most flavors of \UNIX, Windows. + \note{On some platforms, including FreeBSD and Mac OS X, + setting \code{environ} may cause memory leaks. + Refer to the system documentation for putenv.} + When \function{putenv()} is supported, assignments to items in \code{os.environ} are automatically *************** *** 298,301 **** --- 307,314 ---- function. Availability: Macintosh, \UNIX, Windows. + + \versionchanged[When specified, the \var{mode} argument must now start + with one of the letters \character{r}, \character{w}, or \character{a}, + otherwise a \exception{ValueError} is raised]{2.3} \end{funcdesc} *************** *** 340,344 **** module; these are only available on \UNIX. ! For a discussion of possible dead lock conditions related to the use of these functions, see ``\ulink{Flow Control Issues}{popen2-flow-control.html}'' --- 353,357 ---- module; these are only available on \UNIX. ! For a discussion of possible deadlock conditions related to the use of these functions, see ``\ulink{Flow Control Issues}{popen2-flow-control.html}'' *************** *** 399,402 **** --- 412,421 ---- \end{funcdesc} + \begin{funcdesc}{fdatasync}{fd} + Force write of file with filedescriptor \var{fd} to disk. + Does not force update of metadata. + Availability: \UNIX. + \end{funcdesc} + \begin{funcdesc}{fpathconf}{fd, name} Return system configuration information relevant to an open file. *************** *** 429,432 **** --- 448,463 ---- \end{funcdesc} + \begin{funcdesc}{fsync}{fd} + Force write of file with filedescriptor \var{fd} to disk. On \UNIX, + this calls the native \cfunction{fsync()} function; on Windows, the + MS \cfunction{_commit()} function. + + If you're starting with a Python file object \var{f}, first do + \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, + to ensure that all internal buffers associated with \var{f} are written + to disk. + Availability: \UNIX, and Windows starting in 2.2.3. + \end{funcdesc} + \begin{funcdesc}{ftruncate}{fd, length} Truncate the file corresponding to file descriptor \var{fd}, *************** *** 624,627 **** --- 655,664 ---- \end{funcdesc} + \begin{funcdesc}{getcwdu}{} + Return a Unicode object representing the current working directory. + Availability: \UNIX, Windows. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{chroot}{path} Change the root directory of the current process to \var{path}. *************** *** 632,635 **** --- 669,694 ---- \begin{funcdesc}{chmod}{path, mode} Change the mode of \var{path} to the numeric \var{mode}. + \var{mode} may take one of the following values: + \begin{itemize} + \item \code{S_ISUID} + \item \code{S_ISGID} + \item \code{S_ENFMT} + \item \code{S_ISVTX} + \item \code{S_IREAD} + \item \code{S_IWRITE} + \item \code{S_IEXEC} + \item \code{S_IRWXU} + \item \code{S_IRUSR} + \item \code{S_IWUSR} + \item \code{S_IXUSR} + \item \code{S_IRWXG} + \item \code{S_IRGRP} + \item \code{S_IWGRP} + \item \code{S_IXGRP} + \item \code{S_IRWXO} + \item \code{S_IROTH} + \item \code{S_IWOTH} + \item \code{S_IXOTH} + \end{itemize} Availability: \UNIX, Windows. \end{funcdesc} *************** *** 641,644 **** --- 700,710 ---- \end{funcdesc} + \begin{funcdesc}{lchown}{path, uid, gid} + Change the owner and group id of \var{path} to the numeric \var{uid} + and gid. This function will not follow symbolic links. + Availability: \UNIX. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{link}{src, dst} Create a hard link pointing to \var{src} named \var{dst}. *************** *** 652,655 **** --- 718,724 ---- directory. Availability: Macintosh, \UNIX, Windows. + + \versionchanged[On Windows NT/2k/XP and Unix, if \var{path} is a Unicode + object, the result will be a list of Unicode objects.]{2.3} \end{funcdesc} *************** *** 673,684 **** \end{funcdesc} ! \begin{funcdesc}{mknod}{path\optional{, mode=0600, major, minor}} Create a filesystem node (file, device special file or named pipe) ! named filename. mode specifies both the permissions to use and the ! type of node to be created, being combined (bitwise OR) with one of ! S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO (those constants are available ! in \module{stat}). For S_IFCHR and S_IFBLK, major and minor define the ! newly created device special file, otherwise they are ignored. \versionadded{2.3} \end{funcdesc} --- 742,768 ---- \end{funcdesc} ! \begin{funcdesc}{mknod}{path\optional{, mode=0600, device}} Create a filesystem node (file, device special file or named pipe) ! named filename. \var{mode} specifies both the permissions to use and ! the type of node to be created, being combined (bitwise OR) with one ! of S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO (those constants are ! available in \module{stat}). For S_IFCHR and S_IFBLK, \var{device} ! defines the newly created device special file (probably using ! \function{os.makedev()}), otherwise it is ignored. ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{major}{device} ! Extracts a device major number from a raw device number. ! \versionadded{2.3} ! \end{funcdesc} + \begin{funcdesc}{minor}{device} + Extracts a device minor number from a raw device number. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{makedev}{major, minor} + Composes a raw device number from the major and minor device numbers. \versionadded{2.3} \end{funcdesc} *************** *** 693,703 **** \begin{funcdesc}{makedirs}{path\optional{, mode}} ! \index{directory!creating} ! Recursive directory creation function. Like \function{mkdir()}, but makes all intermediate-level directories needed to contain the leaf directory. Throws an \exception{error} exception if the leaf directory already exists or cannot be created. The default \var{mode} is \code{0777} (octal). This function does not properly handle UNC ! paths (only relevant on Windows systems). \versionadded{1.5.2} \end{funcdesc} --- 777,789 ---- \begin{funcdesc}{makedirs}{path\optional{, mode}} ! Recursive directory creation function.\index{directory!creating} ! \index{UNC paths!and \function{os.makedirs()}} ! Like \function{mkdir()}, but makes all intermediate-level directories needed to contain the leaf directory. Throws an \exception{error} exception if the leaf directory already exists or cannot be created. The default \var{mode} is \code{0777} (octal). This function does not properly handle UNC ! paths (only relevant on Windows systems; Universal Naming Convention ! paths are those that use the `\code{\e\e host\e path}' syntax). \versionadded{1.5.2} \end{funcdesc} *************** *** 808,811 **** --- 894,902 ---- (time of most recent content modification or metadata change). + \versionchanged [If \function{stat_float_times} returns true, the time + values are floats, measuring seconds. Fractions of a second may be + reported if the system supports that. On Mac OS, the times are always + floats. See \function{stat_float_times} for further discussion. ]{2.3} + On some Unix systems (such as Linux), the following attributes may also be available: *************** *** 838,844 **** \member{st_mtime}, \member{st_ctime}. ! More items may be added at the end by some implementations. Note that ! on the Mac OS, the time values are floating point values, like all ! time values on the Mac OS. The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information --- 929,933 ---- \member{st_mtime}, \member{st_ctime}. ! More items may be added at the end by some implementations. The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information *************** *** 851,854 **** --- 940,969 ---- \end{funcdesc} + \begin{funcdesc}{stat_float_times}{\optional{newvalue}} + Determine whether \class{stat_result} represents time stamps as float + objects. If newval is True, future calls to stat() return floats, if + it is False, future calls return ints. If newval is omitted, return + the current setting. + + For compatibility with older Python versions, accessing + \class{stat_result} as a tuple always returns integers. For + compatibility with Python 2.2, accessing the time stamps by field name + also returns integers. Applications that want to determine the + fractions of a second in a time stamp can use this function to have + time stamps represented as floats. Whether they will actually observe + non-zero fractions depends on the system. + + Future Python releases will change the default of this setting; + applications that cannot deal with floating point time stamps can then + use this function to turn the feature off. + + It is recommended that this setting is only changed at program startup + time in the \var{__main__} module; libraries should never change this + setting. If an application uses a library that works incorrectly if + floating point time stamps are processed, this application should turn + the feature off until the library has been corrected. + + \end{funcdesc} + \begin{funcdesc}{statvfs}{path} Perform a \cfunction{statvfs()} system call on the given path. The *************** *** 893,896 **** --- 1008,1015 ---- managing files created using paths returned by \function{tempnam()}; no automatic cleanup is provided. + On \UNIX, the environment variable \envvar{TMPDIR} overrides + \var{dir}, while on Windows the \envvar{TMP} is used. The specific + behavior of this function depends on the C library implementation; + some aspects are underspecified in system documentation. \warning{Use of \function{tempnam()} is vulnerable to symlink attacks; consider using \function{tmpfile()} instead.} *************** *** 1012,1015 **** --- 1131,1248 ---- \end{funcdesc} + The following exit codes are a defined, and can be used with + \function{_exit()}, although they are not required. These are + typically used for system programs written in Python, such as a + mail server's external command delivery program. + + \begin{datadesc}{EX_OK} + Exit code that means no error occurred. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_USAGE} + Exit code that means the command was used incorrectly, such as when + the wrong number of arguments are given. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_DATAERR} + Exit code that means the input data was incorrect. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_NOINPUT} + Exit code that means an input file did not exist or was not readable. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_NOUSER} + Exit code that means a specified user did not exist. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_NOHOST} + Exit code that means a specified host did not exist. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_UNAVAILABLE} + Exit code that means that a required service is unavailable. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_SOFTWARE} + Exit code that means an internal software error was detected. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_OSERR} + Exit code that means an operating system error was detected, such as + the inability to fork or create a pipe. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_OSFILE} + Exit code that means some system file did not exist, could not be + opened, or had some other kind of error. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_CANTCREAT} + Exit code that means a user specified output file could not be created. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_IOERR} + Exit code that means that an error occurred while doing I/O on some file. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_TEMPFAIL} + Exit code that means a temporary failure occurred. This indicates + something that may not really be an error, such as a network + connection that couldn't be made during a retryable operation. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_PROTOCOL} + Exit code that means that a protocol exchange was illegal, invalid, or + not understood. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_NOPERM} + Exit code that means that there were insufficient permissions to + perform the operation (but not intended for file system problems). + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_CONFIG} + Exit code that means that some kind of configuration error occurred. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{EX_NOTFOUND} + Exit code that means something like ``an entry was not found''. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + \begin{funcdesc}{fork}{} Fork a child process. Return \code{0} in the child, the child's *************** *** 1037,1040 **** --- 1270,1281 ---- \end{funcdesc} + \begin{funcdesc}{killpg}{pgid, sig} + \index{process!killing} + \index{process!signalling} + Kill the process group \var{pgid} with the signal \var{sig}. + Availability: \UNIX. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{nice}{increment} Add \var{increment} to the process's ``niceness''. Return the new *************** *** 1348,1351 **** --- 1589,1600 ---- \end{datadesc} + \begin{funcdesc}{getloadavg}{} + Return the number of processes in the system run queue averaged over + the last 1, 5, and 15 minutes or raises OSError if the load average + was unobtainable. + + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{sysconf}{name} Return integer-valued system configuration values. *************** *** 1377,1380 **** --- 1626,1630 ---- directory. For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh. + Also available via \module{os.path}. \end{datadesc} *************** *** 1383,1386 **** --- 1633,1637 ---- directory. For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh. + Also available via \module{os.path}. \end{datadesc} *************** *** 1391,1394 **** --- 1642,1646 ---- parse or concatenate pathnames --- use \function{os.path.split()} and \function{os.path.join()} --- but it is occasionally useful. + Also available via \module{os.path}. \end{datadesc} *************** *** 1396,1401 **** An alternative character used by the operating system to separate pathname components, or \code{None} if only one separator character exists. This is ! set to \character{/} on DOS and Windows systems where \code{sep} is a backslash. \end{datadesc} --- 1648,1661 ---- An alternative character used by the operating system to separate pathname components, or \code{None} if only one separator character exists. This is ! set to \character{/} on Windows systems where \code{sep} is a backslash. + Also available via \module{os.path}. + \end{datadesc} + + \begin{datadesc}{extsep} + The character which separates the base filename from the extension; + for example, the \character{.} in \file{os.py}. + Also available via \module{os.path}. + \versionadded{2.2} \end{datadesc} *************** *** 1403,1407 **** The character conventionally used by the operating system to separate search patch components (as in \envvar{PATH}), such as \character{:} for ! \POSIX{} or \character{;} for DOS and Windows. \end{datadesc} --- 1663,1668 ---- The character conventionally used by the operating system to separate search patch components (as in \envvar{PATH}), such as \character{:} for ! \POSIX{} or \character{;} for Windows. ! Also available via \module{os.path}. \end{datadesc} *************** *** 1410,1413 **** --- 1671,1675 ---- \function{spawn*p*()} if the environment doesn't have a \code{'PATH'} key. + Also available via \module{os.path}. \end{datadesc} *************** *** 1416,1419 **** current platform. This may be a single character, such as \code{'\e n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple characters, ! for example, \code{'\e r\e n'} for DOS and Windows. \end{datadesc} --- 1678,1681 ---- current platform. This may be a single character, such as \code{'\e n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple characters, ! for example, \code{'\e r\e n'} for Windows. \end{datadesc} Index: liboperator.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboperator.tex,v retrieving revision 1.21 retrieving revision 1.21.10.1 diff -C2 -d -r1.21 -r1.21.10.1 *** liboperator.tex 20 Oct 2001 04:24:09 -0000 1.21 --- liboperator.tex 28 Apr 2003 17:35:53 -0000 1.21.10.1 *************** *** 49,53 **** The logical operations are also generally applicable to all objects, ! and support truth tests and Boolean operations: \begin{funcdesc}{not_}{o} --- 49,53 ---- The logical operations are also generally applicable to all objects, ! and support truth tests, identity tests, and boolean operations: \begin{funcdesc}{not_}{o} *************** *** 60,64 **** \begin{funcdesc}{truth}{o} ! Return \code{1} if \var{o} is true, and 0 otherwise. \end{funcdesc} --- 60,74 ---- \begin{funcdesc}{truth}{o} ! Return \constant{True} if \var{o} is true, and \constant{False} ! otherwise. This is equivalent to using the \class{bool} ! constructor. ! \end{funcdesc} ! ! \begin{funcdesc}{is_}{a, b} ! Return \code{\var{a} is \var{b}}. Tests object identity. ! \end{funcdesc} ! ! \begin{funcdesc}{is_not}{a, b} ! Return \code{\var{a} is not \var{b}}. Tests object identity. \end{funcdesc} *************** *** 132,135 **** --- 142,151 ---- \end{funcdesc} + \begin{funcdesc}{pow}{a, b} + \funcline{__pow__}{a, b} + Return \var{a} \code{**} \var{b}, for \var{a} and \var{b} numbers. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{rshift}{a, b} \funcline{__rshift__}{a, b} *************** *** 311,314 **** --- 327,336 ---- \lineiii{Bitwise Or}{\code{\var{a} | \var{b}}} {\code{or_(\var{a}, \var{b})}} + \lineiii{Exponentiation}{\code{\var{a} ** \var{b}}} + {\code{pow(\var{a}, \var{b})}} + \lineiii{Identity}{\code{\var{a} is \var{b}}} + {\code{is_(\var{a}, \var{b})}} + \lineiii{Identity}{\code{\var{a} is not \var{b}}} + {\code{is_not(\var{a}, \var{b})}} \lineiii{Indexed Assignment}{\code{\var{o}[\var{k}] = \var{v}}} {\code{setitem(\var{o}, \var{k}, \var{v})}} Index: libobjs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libobjs.tex,v retrieving revision 1.10 retrieving revision 1.10.10.1 diff -C2 -d -r1.10 -r1.10.10.1 *** libobjs.tex 30 Oct 2001 06:22:02 -0000 1.10 --- libobjs.tex 28 Apr 2003 17:35:56 -0000 1.10.10.1 *************** *** 1,5 **** ! \chapter{Built-in Functions, Types, and Exceptions \label{builtin}} ! Names for built-in exceptions and functions are found in a separate symbol table. This table is searched last when the interpreter looks up the meaning of a name, so local and global --- 1,6 ---- ! \chapter{Built-In Objects \label{builtin}} ! Names for built-in exceptions and functions and a number of constants are ! found in a separate symbol table. This table is searched last when the interpreter looks up the meaning of a name, so local and global *************** *** 12,15 **** --- 13,17 ---- \indexii{built-in}{exceptions} \indexii{built-in}{functions} + \indexii{built-in}{constants} \index{symbol table} Index: libnntplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnntplib.tex,v retrieving revision 1.27 retrieving revision 1.27.12.1 diff -C2 -d -r1.27 -r1.27.12.1 *** libnntplib.tex 18 Oct 2001 20:58:25 -0000 1.27 --- libnntplib.tex 28 Apr 2003 17:35:57 -0000 1.27.12.1 *************** *** 59,64 **** connection to the NNTP server running on host \var{host}, listening at port \var{port}. The default \var{port} is 119. If the optional ! \var{user} and \var{password} are provided, the ! \samp{AUTHINFO USER} and \samp{AUTHINFO PASS} commands are used to identify and authenticate the user to the server. If the optional flag \var{readermode} is true, then a \samp{mode reader} command is --- 59,65 ---- connection to the NNTP server running on host \var{host}, listening at port \var{port}. The default \var{port} is 119. If the optional ! \var{user} and \var{password} are provided, ! or if suitable credentials are present in \file{~/.netrc}, ! the \samp{AUTHINFO USER} and \samp{AUTHINFO PASS} commands are used to identify and authenticate the user to the server. If the optional flag \var{readermode} is true, then a \samp{mode reader} command is *************** *** 132,136 **** \end{methoddesc} ! \begin{methoddesc}{newgroups}{date, time} Send a \samp{NEWGROUPS} command. The \var{date} argument should be a string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the --- 133,137 ---- \end{methoddesc} ! \begin{methoddesc}{newgroups}{date, time, \optional{file}} Send a \samp{NEWGROUPS} command. The \var{date} argument should be a string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the *************** *** 139,152 **** \code{(\var{response}, \var{groups})} where \var{groups} is a list of group names that are new since the given date and time. \end{methoddesc} ! \begin{methoddesc}{newnews}{group, date, time} Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or \code{'*'}, and \var{date} and \var{time} have the same meaning as for \method{newgroups()}. Return a pair \code{(\var{response}, \var{articles})} where \var{articles} is a list of article ids. \end{methoddesc} ! \begin{methoddesc}{list}{} Send a \samp{LIST} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of tuples. Each tuple has the --- 140,165 ---- \code{(\var{response}, \var{groups})} where \var{groups} is a list of group names that are new since the given date and time. + If the \var{file} parameter is supplied, then the output of the + \samp{NEWGROUPS} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} ! \begin{methoddesc}{newnews}{group, date, time, \optional{file}} Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or \code{'*'}, and \var{date} and \var{time} have the same meaning as for \method{newgroups()}. Return a pair \code{(\var{response}, \var{articles})} where \var{articles} is a list of article ids. + If the \var{file} parameter is supplied, then the output of the + \samp{NEWNEWS} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} ! \begin{methoddesc}{list}{\optional{file}} Send a \samp{LIST} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of tuples. Each tuple has the *************** *** 157,160 **** --- 170,179 ---- the newsgroup is moderated. (Note the ordering: \var{last}, \var{first}.) + If the \var{file} parameter is supplied, then the output of the + \samp{LIST} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 168,174 **** \end{methoddesc} ! \begin{methoddesc}{help}{} Send a \samp{HELP} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of help strings. \end{methoddesc} --- 187,199 ---- \end{methoddesc} ! \begin{methoddesc}{help}{\optional{file}} Send a \samp{HELP} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of help strings. + If the \var{file} parameter is supplied, then the output of the + \samp{HELP} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 205,209 **** If \var{file} is a file object, then it will start calling \method{write()} on it to store the lines of the body. ! Return as for \method{head()}. If \var{file} is supplied. Then the returned \var{list} is an empty list. \end{methoddesc} --- 230,234 ---- If \var{file} is a file object, then it will start calling \method{write()} on it to store the lines of the body. ! Return as for \method{head()}. If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 218,222 **** \end{methoddesc} ! \begin{methoddesc}{xhdr}{header, string} Send an \samp{XHDR} command. This command is not defined in the RFC but is a common extension. The \var{header} argument is a header --- 243,247 ---- \end{methoddesc} ! \begin{methoddesc}{xhdr}{header, string, \optional{file}} Send an \samp{XHDR} command. This command is not defined in the RFC but is a common extension. The \var{header} argument is a header *************** *** 228,231 **** --- 253,262 ---- (as a string) and \var{text} is the text of the requested header for that article. + If the \var{file} parameter is supplied, then the output of the + \samp{XHDR} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} *************** *** 251,264 **** \end{methoddesc} ! \begin{methoddesc}{xgtitle}{name} Process an \samp{XGTITLE} command, returning a pair \code{(\var{response}, \var{list})}, where \var{list} is a list of tuples containing \code{(\var{name}, \var{title})}. % XXX huh? Should that be name, description? This is an optional NNTP extension, and may not be supported by all servers. \end{methoddesc} ! \begin{methoddesc}{xover}{start, end} Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list of tuples, one for each article in the range delimited by the \var{start} --- 282,301 ---- \end{methoddesc} ! \begin{methoddesc}{xgtitle}{name, \optional{file}} Process an \samp{XGTITLE} command, returning a pair \code{(\var{response}, \var{list})}, where \var{list} is a list of tuples containing \code{(\var{name}, \var{title})}. % XXX huh? Should that be name, description? + If the \var{file} parameter is supplied, then the output of the + \samp{XGTITLE} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. This is an optional NNTP extension, and may not be supported by all servers. \end{methoddesc} ! \begin{methoddesc}{xover}{start, end, \optional{file}} Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list of tuples, one for each article in the range delimited by the \var{start} *************** *** 266,269 **** --- 303,312 ---- \code{(\var{article number}, \var{subject}, \var{poster}, \var{date}, \var{id}, \var{references}, \var{size}, \var{lines})}. + If the \var{file} parameter is supplied, then the output of the + \samp{XOVER} command is stored in a file. If \var{file} is a string, + then the method will open a file object with that name, write to it + then close it. If \var{file} is a file object, then it will start + calling \method{write()} on it to store the lines of the command output. + If \var{file} is supplied, then the returned \var{list} is an empty list. This is an optional NNTP extension, and may not be supported by all servers. Index: libnetrc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnetrc.tex,v retrieving revision 1.8 retrieving revision 1.8.24.1 diff -C2 -d -r1.8 -r1.8.24.1 *** libnetrc.tex 6 Mar 2001 06:55:18 -0000 1.8 --- libnetrc.tex 28 Apr 2003 17:36:00 -0000 1.8.24.1 *************** *** 60,61 **** --- 60,68 ---- Dictionary mapping macro names to string lists. \end{memberdesc} + + \note{Passwords are limited to a subset of the ASCII character set. + Versions of this module prior to 2.3 were extremely limited. Starting with + 2.3, all ASCII punctuation is allowed in passwords. However, note that + whitespace and non-printable characters are not allowed in passwords. This + is a limitation of the way the .netrc file is parsed and may be removed in + the future.} Index: libmultifile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmultifile.tex,v retrieving revision 1.11 retrieving revision 1.11.24.1 diff -C2 -d -r1.11 -r1.11.24.1 *** libmultifile.tex 8 Mar 2001 22:46:41 -0000 1.11 --- libmultifile.tex 28 Apr 2003 17:36:04 -0000 1.11.24.1 *************** *** 35,38 **** --- 35,43 ---- own pattern for section-divider and end-marker lines. + \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{multifile} module.} + \end{seealso} + \subsection{MultiFile Objects \label{MultiFile-objects}} Index: libmimify.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimify.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** libmimify.tex 18 Jun 2002 18:51:30 -0000 1.12 --- libmimify.tex 28 Apr 2003 17:36:07 -0000 1.12.2.1 *************** *** 5,10 **** \modulesynopsis{Mimification and unmimification of mail messages.} ! The mimify module defines two functions to convert mail messages to and from MIME format. The mail message can be either a simple message or a so-called multipart message. Each part is treated separately. --- 5,14 ---- \modulesynopsis{Mimification and unmimification of mail messages.} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{mimify} module. This + module is present only to maintain backward + compatibility.} ! The \module{mimify} module defines two functions to convert mail messages to and from MIME format. The mail message can be either a simple message or a so-called multipart message. Each part is treated separately. Index: libmimewriter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimewriter.tex,v retrieving revision 1.2 retrieving revision 1.2.28.1 diff -C2 -d -r1.2 -r1.2.28.1 *** libmimewriter.tex 3 Apr 2000 20:13:53 -0000 1.2 --- libmimewriter.tex 28 Apr 2003 17:36:07 -0000 1.2.28.1 *************** *** 7,10 **** --- 7,15 ---- \sectionauthor{Christopher G. Petrilli}{petrilli@amber.org} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{MimeWriter} module. This + module is present only to maintain backward + compatibility.} + This module defines the class \class{MimeWriter}. The \class{MimeWriter} class implements a basic formatter for creating Index: libmimetypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetypes.tex,v retrieving revision 1.10 retrieving revision 1.10.10.1 diff -C2 -d -r1.10 -r1.10.10.1 *** libmimetypes.tex 25 Oct 2001 21:49:18 -0000 1.10 --- libmimetypes.tex 28 Apr 2003 17:36:13 -0000 1.10.10.1 *************** *** 48,51 **** --- 48,65 ---- \end{funcdesc} + \begin{funcdesc}{guess_all_extensions}{type\optional{, strict}} + Guess the extensions for a file based on its MIME type, given by + \var{type}. + The return value is a list of strings giving all possible filename extensions, + including the leading dot (\character{.}). The extensions are not guaranteed + to have been associated with any particular data stream, but would be mapped + to the MIME type \var{type} by \function{guess_type()}. If no extension can + be guessed for \var{type}, \code{None} is returned. + + Optional \var{strict} has the same meaning as with the + \function{guess_type()} function. + \end{funcdesc} + + \begin{funcdesc}{guess_extension}{type\optional{, strict}} Guess the extension for a file based on its MIME type, given by *************** *** 81,84 **** --- 95,109 ---- \code{'\var{type}/\var{subtype}'}. If the file \var{filename} does not exist or cannot be read, \code{None} is returned. + \end{funcdesc} + + + \begin{funcdesc}{add_type}{type, ext\optional{, strict}} + Add a mapping from the mimetype \var{type} to the extension \var{ext}. + When the extension is already known, the new type will replace the old + one. When the type is already known the extension will be added + to the list of known extensions. + + When \var{strict} is the mapping will added to the official + MIME types, otherwise to the non-standard ones. \end{funcdesc} Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -C2 -d -r1.21 -r1.21.2.1 *** libmimetools.tex 10 Apr 2002 04:37:09 -0000 1.21 --- libmimetools.tex 28 Apr 2003 17:36:15 -0000 1.21.2.1 *************** *** 5,8 **** --- 5,12 ---- \modulesynopsis{Tools for parsing MIME-style message bodies.} + \deprecated{2.3}{The \refmodule{email} package should be used in + preference to the \module{mimetools} module. This + module is present only to maintain backward + compatibility.} This module defines a subclass of the *************** *** 54,57 **** --- 58,63 ---- \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{mimetools} module.} \seemodule{rfc822}{Provides the base class for \class{mimetools.Message}.} Index: libmath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmath.tex,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -C2 -d -r1.26 -r1.26.2.1 *** libmath.tex 13 May 2002 03:52:47 -0000 1.26 --- libmath.tex 28 Apr 2003 17:36:17 -0000 1.26.2.1 *************** *** 87,92 **** \end{funcdesc} ! \begin{funcdesc}{log}{x} ! Return the natural logarithm of \var{x}. \end{funcdesc} --- 87,94 ---- \end{funcdesc} ! \begin{funcdesc}{log}{x\optional{, base}} ! Returns the logarithm of \var{x} to the given \var{base}. ! If the \var{base} is not specified, returns the natural logarithm of \var{x}. ! \versionchanged[\var{base} argument added]{2.3} \end{funcdesc} Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.24 retrieving revision 1.24.8.1 diff -C2 -d -r1.24 -r1.24.8.1 *** libmailbox.tex 28 Nov 2001 07:26:15 -0000 1.24 --- libmailbox.tex 28 Apr 2003 17:36:19 -0000 1.24.8.1 *************** *** 46,50 **** protect against some variations that are observed in practice. This works since lines in the message which begin with \code{'From '} are ! quoted by mail handling software well before delivery. \end{classdesc} --- 46,50 ---- protect against some variations that are observed in practice. This works since lines in the message which begin with \code{'From '} are ! quoted by mail handling software at delivery-time. \end{classdesc} Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -C2 -d -r1.30 -r1.30.2.1 *** liblocale.tex 13 Jun 2002 17:54:06 -0000 1.30 --- liblocale.tex 28 Apr 2003 17:36:25 -0000 1.30.2.1 *************** *** 4,9 **** \declaremodule{standard}{locale} \modulesynopsis{Internationalization services.} ! \moduleauthor{Martin von L\"owis}{loewis@informatik.hu-berlin.de} ! \sectionauthor{Martin von L\"owis}{loewis@informatik.hu-berlin.de} --- 4,9 ---- \declaremodule{standard}{locale} \modulesynopsis{Internationalization services.} ! \moduleauthor{Martin von L\"owis}{martin@v.loewis.de} ! \sectionauthor{Martin von L\"owis}{martin@v.loewis.de} *************** *** 154,157 **** --- 154,171 ---- \code{None} if their values cannot be determined. \versionadded{2.0} + \end{funcdesc} + + \begin{funcdesc}{getpreferredencoding}{\optional{do_setlocale}} + Return the encoding used for text data, according to user + preferences. User preferences are expressed differently on + different systems, and might not be available programmatically on + some systems, so this function only returns a guess. + + On some systems, it is necessary to invoke \function{setlocale} + to obtain the user preferences, so this function is not thread-safe. + If invoking setlocale is not necessary or desired, \var{do_setlocale} + should be set to \code{False}. + + \versionadded{2.3} \end{funcdesc} Index: libimp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimp.tex,v retrieving revision 1.32 retrieving revision 1.32.2.1 diff -C2 -d -r1.32 -r1.32.2.1 *** libimp.tex 9 Apr 2002 18:14:59 -0000 1.32 --- libimp.tex 28 Apr 2003 17:36:33 -0000 1.32.2.1 *************** *** 107,110 **** --- 107,123 ---- \end{funcdesc} + \begin{funcdesc}{acquire_lock}{} + Acquires the interpreter's import lock for the current thread. This lock + should be used by import hooks to ensure thread-safety when importing modules. + On platforms without threads, this function does nothing. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{release_lock}{} + Release the interpreter's import lock. + On platforms without threads, this function does nothing. + \versionadded{2.3} + \end{funcdesc} + The following constants with integer values, defined in this module, are used to indicate the search result of \function{find_module()}. Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.20 retrieving revision 1.20.2.1 diff -C2 -d -r1.20 -r1.20.2.1 *** libimaplib.tex 17 Jun 2002 07:07:20 -0000 1.20 --- libimaplib.tex 28 Apr 2003 17:36:35 -0000 1.20.2.1 *************** *** 4,19 **** \declaremodule{standard}{imaplib} \modulesynopsis{IMAP4 protocol client (requires sockets).} ! \moduleauthor{Piers Lauder}{piers@staff.cs.usyd.edu.au} ! \sectionauthor{Piers Lauder}{piers@staff.cs.usyd.edu.au} ! % Based on HTML documentation by Piers Lauder ; % converted by Fred L. Drake, Jr. . % Revised by ESR, January 2000. % Changes for IMAP4_SSL by Tino Lange , March 2002 \indexii{IMAP4}{protocol} \indexii{IMAP4_SSL}{protocol} ! This module defines two classes, \class{IMAP4} and \class{IMAP4_SSL}, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in \rfc{2060}. It is backward --- 4,21 ---- \declaremodule{standard}{imaplib} \modulesynopsis{IMAP4 protocol client (requires sockets).} ! \moduleauthor{Piers Lauder}{piers@communitysolutions.com.au} ! \sectionauthor{Piers Lauder}{piers@communitysolutions.com.au} ! % Based on HTML documentation by Piers Lauder ; % converted by Fred L. Drake, Jr. . % Revised by ESR, January 2000. % Changes for IMAP4_SSL by Tino Lange , March 2002 + % Changes for IMAP4_stream by Piers Lauder , November 2002 \indexii{IMAP4}{protocol} \indexii{IMAP4_SSL}{protocol} + \indexii{IMAP4_stream}{protocol} ! This module defines three classes, \class{IMAP4}, \class{IMAP4_SSL} and \class{IMAP4_stream}, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in \rfc{2060}. It is backward *************** *** 21,25 **** \samp{STATUS} command is not supported in IMAP4. ! Two classes are provided by the \module{imaplib} module, \class{IMAP4} is the base class: \begin{classdesc}{IMAP4}{\optional{host\optional{, port}}} --- 23,27 ---- \samp{STATUS} command is not supported in IMAP4. ! Three classes are provided by the \module{imaplib} module, \class{IMAP4} is the base class: \begin{classdesc}{IMAP4}{\optional{host\optional{, port}}} *************** *** 31,35 **** \end{classdesc} ! Two exceptions are defined as attributes of the \class{IMAP4} class: \begin{excdesc}{IMAP4.error} --- 33,37 ---- \end{classdesc} ! Three exceptions are defined as attributes of the \class{IMAP4} class: \begin{excdesc}{IMAP4.error} *************** *** 62,65 **** --- 64,75 ---- \end{classdesc} + The second subclass allows for connections created by a child process: + + \begin{classdesc}{IMAP4_stream}{command} + This is a subclass derived from \class{IMAP4} that connects + to the \code{stdin/stdout} file descriptors created by passing \var{command} to \code{os.popen2()}. + \versionadded{2.3} + \end{classdesc} + The following utility functions are defined: *************** *** 120,124 **** ...])} where \var{type} is usually \code{'OK'} or \code{'NO'}, and \var{data} is either the text from the command response, or ! mandated results from the command. An \class{IMAP4} instance has the following methods: --- 130,137 ---- ...])} where \var{type} is usually \code{'OK'} or \code{'NO'}, and \var{data} is either the text from the command response, or ! mandated results from the command. Each \var{data} ! is either a string, or a tuple. If a tuple, then the first part ! is the header of the response, and the second part contains ! the data (ie: 'literal' value). An \class{IMAP4} instance has the following methods: *************** *** 178,181 **** --- 191,195 ---- Get the \samp{quota} \var{root}'s resource usage and limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087. + \versionadded{2.3} \end{methoddesc} *************** *** 183,186 **** --- 197,201 ---- Get the list of \samp{quota} \samp{roots} for the named \var{mailbox}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. + \versionadded{2.3} \end{methoddesc} *************** *** 197,200 **** --- 212,221 ---- \end{methoddesc} + \begin{methoddesc}{login_cram_md5}{user, password} + Force use of \samp{CRAM-MD5} authentication when identifying the client to protect the password. + Will only work if the server \samp{CAPABILITY} response includes the phrase \samp{AUTH=CRAM-MD5}. + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}{logout}{} Shutdown connection to server. Returns server \samp{BYE} response. *************** *** 224,227 **** --- 245,254 ---- \end{methoddesc} + \begin{methoddesc}{proxyauth}{user} + Assume authentication as \var{user}. + Allows an authorised administrator to proxy into any user's mailbox. + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}{read}{size} Reads \var{size} bytes from the remote server. *************** *** 248,257 **** \end{methoddesc} ! \begin{methoddesc}{search}{charset, criterium\optional{, ...}} Search mailbox for matching messages. Returned data contains a space separated list of matching message numbers. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one ! criterium be specified; an exception will be raised when the server returns an error. --- 275,284 ---- \end{methoddesc} ! \begin{methoddesc}{search}{charset, criterion\optional{, ...}} Search mailbox for matching messages. Returned data contains a space separated list of matching message numbers. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one ! criterion be specified; an exception will be raised when the server returns an error. *************** *** 287,290 **** --- 314,318 ---- Set the \samp{quota} \var{root}'s resource \var{limits}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. + \versionadded{2.3} \end{methoddesc} *************** *** 298,307 **** \end{methoddesc} ! \begin{methoddesc}{sort}{sort_criteria, charset, search_criterium\optional{, ...}} The \code{sort} command is a variant of \code{search} with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. ! Sort has two arguments before the \var{search_criterium} argument(s); a parenthesized list of \var{sort_criteria}, and the searching \var{charset}. Note that unlike \code{search}, the searching \var{charset} argument is mandatory. --- 326,335 ---- \end{methoddesc} ! \begin{methoddesc}{sort}{sort_criteria, charset, search_criterion\optional{, ...}} The \code{sort} command is a variant of \code{search} with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. ! Sort has two arguments before the \var{search_criterion} argument(s); a parenthesized list of \var{sort_criteria}, and the searching \var{charset}. Note that unlike \code{search}, the searching \var{charset} argument is mandatory. Index: libhttplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhttplib.tex,v retrieving revision 1.31 retrieving revision 1.31.2.1 diff -C2 -d -r1.31 -r1.31.2.1 *** libhttplib.tex 24 Mar 2002 16:55:57 -0000 1.31 --- libhttplib.tex 28 Apr 2003 17:36:37 -0000 1.31.2.1 *************** *** 11,17 **** HTTP and HTTPS protocols. It is normally not used directly --- the module \refmodule{urllib}\refstmodindex{urllib} uses it to handle URLs ! that use HTTP and HTTPS. \note{HTTPS support is only ! available if the \refmodule{socket} module was compiled with SSL ! support.} The constants defined in this module are: --- 11,27 ---- HTTP and HTTPS protocols. It is normally not used directly --- the module \refmodule{urllib}\refstmodindex{urllib} uses it to handle URLs ! that use HTTP and HTTPS. ! ! \begin{notice} ! HTTPS support is only available if the \refmodule{socket} module was ! compiled with SSL support. ! \end{notice} ! ! \begin{notice} ! The public interface for this module changed substantially in Python ! 2.0. The \class{HTTP} class is retained only for backward ! compatibility with 1.5.2. It should not be used in new code. Refer ! to the online docstrings for usage. ! \end{notice} The constants defined in this module are: *************** *** 40,43 **** --- 50,54 ---- >>> h3 = httplib.HTTPConnection('www.cwi.nl', 80) \end{verbatim} + \versionadded{2.0} \end{classdesc} *************** *** 45,48 **** --- 56,66 ---- A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. + \versionadded{2.0} + \end{classdesc} + + \begin{classdesc}{HTTPResponse}{sock\optional{, debuglevel=0}\optional{, strict=0}} + Class whose instances are returned upon successful connection. Not + instantiated directly by user. + \versionadded{2.0} \end{classdesc} *************** *** 52,59 **** --- 70,79 ---- The base class of the other exceptions in this module. It is a subclass of \exception{Exception}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{NotConnected} A subclass of \exception{HTTPException}. + \versionadded{2.0} \end{excdesc} *************** *** 61,100 **** A subclass of \exception{HTTPException}, raised if a port is given and is either non-numeric or empty. \end{excdesc} \begin{excdesc}{UnknownProtocol} A subclass of \exception{HTTPException}. \end{excdesc} \begin{excdesc}{UnknownTransferEncoding} A subclass of \exception{HTTPException}. ! \end{excdesc} ! ! \begin{excdesc}{IllegalKeywordArgument} ! A subclass of \exception{HTTPException}. \end{excdesc} \begin{excdesc}{UnimplementedFileMode} A subclass of \exception{HTTPException}. \end{excdesc} \begin{excdesc}{IncompleteRead} A subclass of \exception{HTTPException}. \end{excdesc} \begin{excdesc}{ImproperConnectionState} A subclass of \exception{HTTPException}. \end{excdesc} \begin{excdesc}{CannotSendRequest} A subclass of \exception{ImproperConnectionState}. \end{excdesc} \begin{excdesc}{CannotSendHeader} A subclass of \exception{ImproperConnectionState}. \end{excdesc} \begin{excdesc}{ResponseNotReady} A subclass of \exception{ImproperConnectionState}. \end{excdesc} --- 81,125 ---- A subclass of \exception{HTTPException}, raised if a port is given and is either non-numeric or empty. + \versionadded{2.3} \end{excdesc} \begin{excdesc}{UnknownProtocol} A subclass of \exception{HTTPException}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{UnknownTransferEncoding} A subclass of \exception{HTTPException}. ! \versionadded{2.0} \end{excdesc} \begin{excdesc}{UnimplementedFileMode} A subclass of \exception{HTTPException}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{IncompleteRead} A subclass of \exception{HTTPException}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{ImproperConnectionState} A subclass of \exception{HTTPException}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{CannotSendRequest} A subclass of \exception{ImproperConnectionState}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{CannotSendHeader} A subclass of \exception{ImproperConnectionState}. + \versionadded{2.0} \end{excdesc} \begin{excdesc}{ResponseNotReady} A subclass of \exception{ImproperConnectionState}. + \versionadded{2.0} \end{excdesc} *************** *** 102,105 **** --- 127,131 ---- A subclass of \exception{HTTPException}. Raised if a server responds with a HTTP status code that we don't understand. + \versionadded{2.0} \end{excdesc} Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** libhtmlparser.tex 5 Jul 2001 16:34:36 -0000 1.2 --- libhtmlparser.tex 28 Apr 2003 17:36:38 -0000 1.2.20.1 *************** *** 124,129 **** \end{methoddesc} ! \subsection{Example HTML Parser \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the --- 124,143 ---- \end{methoddesc} + \begin{methoddesc}{handle_pi}{data} + Method called when a processing instruction is encountered. The + \var{data} parameter will contain the entire processing instruction. + For example, for the processing instruction \code{}, + this method would be called as \code{handle_pi("proc color='red'")}. It + is intended to be overridden by a derived class; the base class + implementation does nothing. ! \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instruction. An XHTML processing instruction using the ! trailing \character{?} will cause the \character{?} to be included in ! \var{data}.} ! \end{methoddesc} ! ! ! \subsection{Example HTML Parser Application \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the Index: libhtmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmllib.tex,v retrieving revision 1.23 retrieving revision 1.23.20.1 diff -C2 -d -r1.23 -r1.23.20.1 *** libhtmllib.tex 5 Jul 2001 16:34:36 -0000 1.23 --- libhtmllib.tex 28 Apr 2003 17:36:40 -0000 1.23.20.1 *************** *** 146,153 **** \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! This module defines a single dictionary, \code{entitydefs}, which is used by the \refmodule{htmllib} module to provide the \member{entitydefs} member of the \class{HTMLParser} class. The ! definition provided here contains all the entities defined by HTML 2.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). --- 146,154 ---- \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} ! This module defines three dictionaries, \code{name2codepoint}, ! \code{codepoint2name}, and \code{entitydefs}. \code{entitydefs} is used by the \refmodule{htmllib} module to provide the \member{entitydefs} member of the \class{HTMLParser} class. The ! definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). *************** *** 155,159 **** \begin{datadesc}{entitydefs} ! A dictionary mapping HTML 2.0 entity definitions to their replacement text in ISO Latin-1. \end{datadesc} --- 156,171 ---- \begin{datadesc}{entitydefs} ! A dictionary mapping XHTML 1.0 entity definitions to their replacement text in ISO Latin-1. + + \end{datadesc} + + \begin{datadesc}{name2codepoint} + A dictionary that maps HTML entity names to the Unicode codepoints. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{codepoint2name} + A dictionary that maps Unicode codepoints to HTML entity names. + \versionadded{2.3} \end{datadesc} Index: libgzip.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgzip.tex,v retrieving revision 1.14 retrieving revision 1.14.18.1 diff -C2 -d -r1.14 -r1.14.18.1 *** libgzip.tex 9 Aug 2001 07:21:56 -0000 1.14 --- libgzip.tex 28 Apr 2003 17:36:47 -0000 1.14.18.1 *************** *** 22,27 **** compresslevel\optional{, fileobj}}}}} Constructor for the \class{GzipFile} class, which simulates most of ! the methods of a file object, with the exception of the \method{readinto()}, ! \method{truncate()}, and \method{xreadlines()} methods. At least one of \var{fileobj} and \var{filename} must be given a non-trivial value. --- 22,27 ---- compresslevel\optional{, fileobj}}}}} Constructor for the \class{GzipFile} class, which simulates most of ! the methods of a file object, with the exception of the \method{readinto()} ! and \method{truncate()} methods. At least one of \var{fileobj} and \var{filename} must be given a non-trivial value. *************** *** 42,47 **** whether the file will be read or written. The default is the mode of \var{fileobj} if discernible; otherwise, the default is \code{'rb'}. ! Be aware that only the \code{'rb'}, \code{'ab'}, and \code{'wb'} ! values should be used for cross-platform portability. The \var{compresslevel} argument is an integer from \code{1} to --- 42,47 ---- whether the file will be read or written. The default is the mode of \var{fileobj} if discernible; otherwise, the default is \code{'rb'}. ! If not given, the 'b' flag will be added to the mode to ensure the ! file is opened in binary mode for cross-platform portability. The \var{compresslevel} argument is an integer from \code{1} to Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** libgettext.tex 24 Jun 2002 02:22:39 -0000 1.12 --- libgettext.tex 28 Apr 2003 17:36:48 -0000 1.12.2.1 *************** *** 70,73 **** --- 70,99 ---- \end{funcdesc} + \begin{funcdesc}{ngettext}{singular, plural, n} + + Like \function{gettext()}, but consider plural forms. If a translation + is found, apply the plural formula to \var{n}, and return the + resulting message (some languages have more than two plural forms). + If no translation is found, return \var{singular} if \var{n} is 1; + return \var{plural} otherwise. + + The Plural formula is taken from the catalog header. It is a C or + Python expression that has a free variable n; the expression evaluates + to the index of the plural in the catalog. See the GNU gettext + documentation for the precise syntax to be used in .po files, and the + formulas for a variety of languages. + + \versionadded{2.3} + + \end{funcdesc} + + \begin{funcdesc}{dngettext}{domain, singular, plural, n} + Like \function{ngettext()}, but look the message up in the specified + \var{domain}. + + \versionadded{2.3} + \end{funcdesc} + + Note that GNU \program{gettext} also defines a \function{dcgettext()} method, but this was deemed not useful and so it is currently *************** *** 208,211 **** --- 234,252 ---- \end{methoddesc} + \begin{methoddesc}[NullTranslations]{ngettext}{singular, plural, n} + If a fallback has been set, forward \method{ngettext} to the fallback. + Otherwise, return the translated message. Overridden in derived classes. + + \versionadded{2.3} + \end{methoddesc} + + \begin{methoddesc}[NullTranslations]{ungettext}{singular, plural, n} + If a fallback has been set, forward \method{ungettext} to the fallback. + Otherwise, return the translated message as a Unicode string. + Overridden in derived classes. + + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}[NullTranslations]{info}{} Return the ``protected'' \member{_info} variable. *************** *** 245,255 **** overrides \method{_parse()} to enable reading GNU \program{gettext} format \file{.mo} files in both big-endian and little-endian format. ! It also parses optional meta-data out of the translation catalog. It ! is convention with GNU \program{gettext} to include meta-data as the ! translation for the empty string. This meta-data is in \rfc{822}-style ! \code{key: value} pairs. If the key \code{Content-Type} is found, ! then the \code{charset} property is used to initialize the ! ``protected'' \member{_charset} instance variable. The entire set of key/value pairs are placed into a dictionary and set as the ``protected'' \member{_info} instance variable. --- 286,300 ---- overrides \method{_parse()} to enable reading GNU \program{gettext} format \file{.mo} files in both big-endian and little-endian format. + It also adds the ability to coerce both message ids and message + strings to Unicode. ! \class{GNUTranslations} parses optional meta-data out of the ! translation catalog. It is convention with GNU \program{gettext} to ! include meta-data as the translation for the empty string. This ! meta-data is in \rfc{822}-style \code{key: value} pairs, and must ! contain the \code{Project-Id-Version}. If the key ! \code{Content-Type} is found, then the \code{charset} property is used ! to initialize the ``protected'' \member{_charset} instance variable, ! defaulting to \code{None} if not found. The entire set of key/value pairs are placed into a dictionary and set as the ``protected'' \member{_info} instance variable. *************** *** 262,266 **** returns a Unicode string by passing both the translated message string and the value of the ``protected'' \member{_charset} variable to the ! builtin \function{unicode()} function. \subsubsection{Solaris message catalog support} --- 307,330 ---- returns a Unicode string by passing both the translated message string and the value of the ``protected'' \member{_charset} variable to the ! builtin \function{unicode()} function. Note that if you use ! \method{ugettext()} you probably also want your message ids to be ! Unicode. To do this, set the variable \var{coerce} to \code{True} in ! the \class{GNUTranslations} constructor. This ensures that both the ! message ids and message strings are decoded to Unicode when the file ! is read, using the file's \code{charset} value. If you do this, you ! will not want to use the \method{gettext()} method -- always use ! \method{ugettext()} instead. ! ! To facilitate plural forms, the methods \method{ngettext} and ! \method{ungettext} are overridden as well. ! ! \begin{methoddesc}[GNUTranslations]{__init__}{ ! \optional{fp\optional{, coerce}}} ! Constructs and parses a translation catalog in GNU gettext format. ! \var{fp} is passed to the base class (\class{NullTranslations}) ! constructor. \var{coerce} is a flag specifying whether message ids ! and message strings should be converted to Unicode when the file is ! parsed. It defaults to \code{False} for backward compatibility. ! \end{methoddesc} \subsubsection{Solaris message catalog support} *************** *** 535,538 **** --- 599,603 ---- \item Peter Funk \item James Henstridge + \item Juan David Ib\'a\~nez Palomar \item Marc-Andr\'e Lemburg \item Martin von L\"owis Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** libgc.tex 26 Jan 2002 20:11:50 -0000 1.10 --- libgc.tex 28 Apr 2003 17:36:52 -0000 1.10.2.1 *************** *** 52,55 **** --- 52,61 ---- \end{funcdesc} + \begin{funcdesc}{get_objects}{} + Returns a list of all objects tracked by the collector, excluding the + list returned. + \versionadded{2.2} + \end{funcdesc} + \begin{funcdesc}{set_threshold}{threshold0\optional{, threshold1\optional{, threshold2}}} *************** *** 92,95 **** --- 98,114 ---- \versionadded{2.2} + \end{funcdesc} + + \begin{funcdesc}{get_referents}{*objs} + Return a list of objects directly referred to by any of the arguments. + The referents returned are those objects visited by the arguments' + C-level \member{tp_traverse} methods (if any), and may not be all + objects actually directly reachable. \member{tp_traverse} methods + are supported only by objects that support garbage collection, and are + only required to visit objects that may be involved in a cycle. So, + for example, if an integer is directly reachable from an argument, that + integer object may or may not appear in the result list. + + \versionadded{2.3} \end{funcdesc} Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.109 retrieving revision 1.109.2.1 diff -C2 -d -r1.109 -r1.109.2.1 *** libfuncs.tex 29 Jun 2002 16:06:47 -0000 1.109 --- libfuncs.tex 28 Apr 2003 17:36:56 -0000 1.109.2.1 *************** *** 38,42 **** \var{name} is returned. This is done for compatibility with the bytecode generated for the different kinds of import statement; when ! using \samp{import spam.ham.eggs}, the top-level package \code{spam} must be placed in the importing namespace, but when using \samp{from spam.ham import eggs}, the \code{spam.ham} subpackage must be used --- 38,42 ---- \var{name} is returned. This is done for compatibility with the bytecode generated for the different kinds of import statement; when ! using \samp{import spam.ham.eggs}, the top-level package \module{spam} must be placed in the importing namespace, but when using \samp{from spam.ham import eggs}, the \code{spam.ham} subpackage must be used *************** *** 46,54 **** \begin{verbatim} - import string - def my_import(name): mod = __import__(name) ! components = string.split(name, '.') for comp in components[1:]: mod = getattr(mod, comp) --- 46,52 ---- \begin{verbatim} def my_import(name): mod = __import__(name) ! components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) *************** *** 68,72 **** the \var{args} argument must be a sequence. The \var{function} is called with \var{args} as the argument list; the number of arguments ! is the the length of the tuple. If the optional \var{keywords} argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments --- 66,70 ---- the \var{args} argument must be a sequence. The \var{function} is called with \var{args} as the argument list; the number of arguments ! is the length of the tuple. If the optional \var{keywords} argument is present, it must be a dictionary whose keys are strings. It specifies keyword arguments *************** *** 76,79 **** --- 74,82 ---- exactly one argument. The use of \function{apply()} is equivalent to \code{\var{function}(*\var{args}, **\var{keywords})}. + Use of \function{apply()} is not necessary since the ``extended call + syntax,'' as used in the last example, is completely equivalent. + + \deprecated{2.3}{Use the extended call syntax instead, as described + above.} \end{funcdesc} *************** *** 86,89 **** --- 89,93 ---- \code{True}. \indexii{Boolean}{type} + \versionadded{2.2.1} \end{funcdesc} *************** *** 115,118 **** --- 119,145 ---- \end{funcdesc} + \begin{funcdesc}{classmethod}{function} + Return a class method for \var{function}. + + A class method receives the class as implicit first argument, + just like an instance method receives the instance. + To declare a class method, use this idiom: + + \begin{verbatim} + class C: + def f(cls, arg1, arg2, ...): ... + f = classmethod(f) + \end{verbatim} + + It can be called either on the class (e.g. C.f()) or on an instance + (e.g. C().f()). The instance is ignored except for its class. + If a class method is called for a derived class, the derived class + object is passed as the implied first argument. + + Class methods are different than C++ or Java static methods. + If you want those, see \ref{staticmethod}. + \versionadded{2.2} + \end{funcdesc} + \begin{funcdesc}{cmp}{x, y} Compare the two objects \var{x} and \var{y} and return an integer *************** *** 190,217 **** \begin{funcdesc}{dict}{\optional{mapping-or-sequence}} ! Return a new dictionary initialized from the optional argument. ! If an argument is not specified, return a new empty dictionary. ! If the argument is a mapping object, return a dictionary mapping the ! same keys to the same values as does the mapping object. ! Else the argument must be a sequence, a container that supports ! iteration, or an iterator object. The elements of the argument must ! each also be of one of those kinds, and each must in turn contain exactly two objects. The first is used as a key in the new dictionary, and the second as the key's value. If a given key is seen more than once, the last value associated with it is retained in the new dictionary. For example, these all return a dictionary equal to ! \code{\{1: 2, 2: 3\}}: \begin{itemize} ! \item \code{dict(\{1: 2, 2: 3\})} ! \item \code{dict(\{1: 2, 2: 3\}.items())} ! \item \code{dict(\{1: 2, 2: 3\}.iteritems())} ! \item \code{dict(zip((1, 2), (2, 3)))} ! \item \code{dict([[2, 3], [1, 2]])} ! \item \code{dict([(i-1, i) for i in (2, 3)])} \end{itemize} \versionadded{2.2} \end{funcdesc} --- 217,253 ---- \begin{funcdesc}{dict}{\optional{mapping-or-sequence}} ! Return a new dictionary initialized from an optional positional ! argument or from a set of keyword arguments. ! If no arguments are given, return a new empty dictionary. ! If the positional argument is a mapping object, return a dictionary ! mapping the same keys to the same values as does the mapping object. ! Otherwise the positional argument must be a sequence, a container that ! supports iteration, or an iterator object. The elements of the argument ! must each also be of one of those kinds, and each must in turn contain exactly two objects. The first is used as a key in the new dictionary, and the second as the key's value. If a given key is seen more than once, the last value associated with it is retained in the new dictionary. + + If keyword arguments are given, the keywords themselves with their + associated values are added as items to the dictionary. If a key + is specified both in the positional argument and as a keyword argument, + the value associated with the keyword is retained in the dictionary. For example, these all return a dictionary equal to ! \code{\{"one": 2, "two": 3\}}: \begin{itemize} ! \item \code{dict(\{'one': 2, 'two': 3\})} ! \item \code{dict(\{'one': 2, 'two': 3\}.items())} ! \item \code{dict(\{'one': 2, 'two': 3\}.iteritems())} ! \item \code{dict(zip(('one', 'two'), (2, 3)))} ! \item \code{dict([['two', 3], ['one', 2]])} ! \item \code{dict(one=2, two=3)} ! \item \code{dict([(['one', 'two'][i-2], i) for i in (2, 3)])} \end{itemize} \versionadded{2.2} + \versionchanged[Support for building a dictionary from keyword + arguments added]{2.3} \end{funcdesc} *************** *** 282,286 **** expression (technically speaking, a condition list) using the \var{globals} and \var{locals} dictionaries as global and local name ! space. If the \var{locals} dictionary is omitted it defaults to the \var{globals} dictionary. If both dictionaries are omitted, the expression is executed in the environment where \keyword{eval} is --- 318,327 ---- expression (technically speaking, a condition list) using the \var{globals} and \var{locals} dictionaries as global and local name ! space. If the \var{globals} dictionary is present and lacks ! '__builtins__', the current globals are copied into \var{globals} before ! \var{expression} is parsed. This means that \var{expression} ! normally has full access to the standard ! \refmodule[builtin]{__builtin__} module and restricted environments ! are propagated. If the \var{locals} dictionary is omitted it defaults to the \var{globals} dictionary. If both dictionaries are omitted, the expression is executed in the environment where \keyword{eval} is *************** *** 508,511 **** --- 549,554 ---- long integer or a floating point number. Conversion of floating point numbers to integers truncates (towards zero). + If the argument is outside the integer range a long object will + be returned instead. \end{funcdesc} *************** *** 519,524 **** the names used in Python programs are automatically interned, and the dictionaries used to hold module, class or instance attributes ! have interned keys. Interned strings are immortal (never get ! garbage collected). \end{funcdesc} --- 562,569 ---- the names used in Python programs are automatically interned, and the dictionaries used to hold module, class or instance attributes ! have interned keys. \versionchanged[Interned strings are not ! immortal (like they used to be in Python 2.2 and before); ! you must keep a reference to the return value of \function{intern()} ! around to benefit from it]{2.3} \end{funcdesc} *************** *** 528,532 **** thereof. Also return true if \var{classinfo} is a type object and \var{object} is an object of that type. If \var{object} is not a ! class instance or a object of the given type, the function always returns false. If \var{classinfo} is neither a class object nor a type object, it may be a tuple of class or type objects, or may --- 573,577 ---- thereof. Also return true if \var{classinfo} is a type object and \var{object} is an object of that type. If \var{object} is not a ! class instance or an object of the given type, the function always returns false. If \var{classinfo} is neither a class object nor a type object, it may be a tuple of class or type objects, or may *************** *** 538,546 **** \end{funcdesc} ! \begin{funcdesc}{issubclass}{class1, class2} ! Return true if \var{class1} is a subclass (direct or indirect) of ! \var{class2}. A class is considered a subclass of itself. If ! either argument is not a class object, a \exception{TypeError} ! exception is raised. \end{funcdesc} --- 583,593 ---- \end{funcdesc} ! \begin{funcdesc}{issubclass}{class, classinfo} ! Return true if \var{class} is a subclass (direct or indirect) of ! \var{classinfo}. A class is considered a subclass of itself. ! \var{classinfo} may be a tuple of class objects, in which case every ! entry in \var{classinfo} will be checked. In any other case, a ! \exception{TypeError} exception is raised. ! \versionchanged[Support for a tuple of type information was added]{2.3} \end{funcdesc} *************** *** 578,582 **** \begin{funcdesc}{locals}{} ! Return a dictionary representing the current local symbol table. \warning{The contents of this dictionary should not be modified; changes may not affect the values of local variables used by the --- 625,629 ---- \begin{funcdesc}{locals}{} ! Update and return a dictionary representing the current local symbol table. \warning{The contents of this dictionary should not be modified; changes may not affect the values of local variables used by the *************** *** 665,668 **** --- 712,734 ---- \end{funcdesc} + \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, fdel\optional{, doc}}}}} + Return a property attribute for new-style classes (classes that + derive from \function{object}. + + \var{fget} is a function for getting an attribute value, likewise + \var{fset} is a function for setting, and \var{fdel} a function + for del'ing, an attribute. Typical use is to define a managed attribute x: + + \begin{verbatim} + class C(object): + def getx(self): return self.__x + def setx(self, value): self.__x = value + def delx(self): del self.__x + x = property(getx, setx, delx, "I'm the 'x' property.") + \end{verbatim} + + \versionadded{2.2} + \end{funcdesc} + \begin{funcdesc}{range}{\optional{start,} stop\optional{, step}} This is a versatile function to create lists containing arithmetic *************** *** 718,727 **** Apply \var{function} of two arguments cumulatively to the items of \var{sequence}, from left to right, so as to reduce the sequence to ! a single value. For example, ! \code{reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])} calculates ! \code{((((1+2)+3)+4)+5)}. ! If the optional \var{initializer} is present, it is placed before ! the items of the sequence in the calculation, and serves as a ! default when the sequence is empty. \end{funcdesc} --- 784,793 ---- Apply \var{function} of two arguments cumulatively to the items of \var{sequence}, from left to right, so as to reduce the sequence to ! a single value. For example, \code{reduce(lambda x, y: x+y, [1, 2, ! 3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}. If the optional ! \var{initializer} is present, it is placed before the items of the ! sequence in the calculation, and serves as a default when the ! sequence is empty. If \var{initializer} is not given and ! \var{sequence} contains only one item, the first item is returned. \end{funcdesc} *************** *** 812,815 **** --- 878,925 ---- \end{funcdesc} + \begin{funcdesc}{staticmethod}{function} + Return a static method for \var{function}. + + A static method does not receive an implicit first argument. + To declare a static method, use this idiom: + + \begin{verbatim} + class C: + def f(arg1, arg2, ...): ... + f = staticmethod(f) + \end{verbatim} + + It can be called either on the class (e.g. C.f()) or on an instance + (e.g. C().f()). The instance is ignored except for its class. + + Static methods in Python are similar to those found in Java or C++. + For a more advanced concept, see \ref{classmethod}. + \versionadded{2.2} + \end{funcdesc} + + \begin{funcdesc}{sum}{sequence\optional{, start}} + Sums \var{start} and the items of a \var{sequence}, from left to + right, and returns the total. \var{start} defaults to \code{0}. + The \var{sequence}'s items are normally numbers, and are not allowed + to be strings. The fast, correct way to concatenate sequence of + strings is by calling \code{''.join(\var{sequence})}. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{super}{type\optional{object-or-type}} + Return the superclass of \var{type}. If the second argument is omitted + the super object returned is unbound. If the second argument is an + object, isinstance(obj, type) must be true. If the second argument is a + type, issubclass(type2, type) must be true. + + A typical use for calling a cooperative superclass method is: + \begin{verbatim} + class C(B): + def meth(self, arg): + super(C, self).meth(arg) + \end{verbatim} + \versionadded{2.2} + \end{funcdesc} + \begin{funcdesc}{str}{object} Return a string containing a nicely printable representation of an *************** *** 835,845 **** type\obindex{type} object. The standard module \module{types}\refstmodindex{types} defines names for all built-in ! types. For instance: \begin{verbatim} >>> import types ! >>> if type(x) == types.StringType: print "It's a string" \end{verbatim} \end{funcdesc} --- 945,966 ---- type\obindex{type} object. The standard module \module{types}\refstmodindex{types} defines names for all built-in ! types that don't already have built-in names. For instance: \begin{verbatim} >>> import types ! >>> x = 'abc' ! >>> if type(x) is str: print "It's a string" ! ... ! It's a string ! >>> def f(): pass ! ... ! >>> if type(f) is types.FunctionType: print "It's a function" ! ... ! It's a function \end{verbatim} + + The \function{isinstance()} built-in function is recommended for + testing the type of an object. \end{funcdesc} *************** *** 860,864 **** will decode the object which can either be an 8-bit string or a character buffer using the codec for \var{encoding}. The ! \var{encoding} parameter is a string giving the name of an encoding. Error handling is done according to \var{errors}; this specifies the treatment of characters which are invalid in the input encoding. If --- 981,986 ---- will decode the object which can either be an 8-bit string or a character buffer using the codec for \var{encoding}. The ! \var{encoding} parameter is a string giving the name of an encoding; ! if the encoding is not known, \exception{LookupError} is raised. Error handling is done according to \var{errors}; this specifies the treatment of characters which are invalid in the input encoding. If *************** *** 872,877 **** If no optional parameters are given, \code{unicode()} will mimic the behaviour of \code{str()} except that it returns Unicode strings ! instead of 8-bit strings. More precisely, if \var{object} is an ! Unicode string or subclass it will return a Unicode string without any additional decoding applied. --- 994,999 ---- If no optional parameters are given, \code{unicode()} will mimic the behaviour of \code{str()} except that it returns Unicode strings ! instead of 8-bit strings. More precisely, if \var{object} is a ! Unicode string or subclass it will return that Unicode string without any additional decoding applied. Index: libfilecmp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfilecmp.tex,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** libfilecmp.tex 5 Apr 2002 02:21:09 -0000 1.7 --- libfilecmp.tex 28 Apr 2003 17:36:58 -0000 1.7.2.1 *************** *** 17,30 **** Unless \var{shallow} is given and is false, files with identical ! \function{os.stat()} signatures are taken to be equal. If ! \var{use_statcache} is given and is true, ! \function{statcache.stat()} will be called rather then ! \function{os.stat()}; the default is to use \function{os.stat()}. Files that were compared using this function will not be compared again ! unless their \function{os.stat()} signature changes. Note that using ! \var{use_statcache} true will cause the cache invalidation mechanism to ! fail --- the stale stat value will be used from \refmodule{statcache}'s ! cache. Note that no external programs are called from this function, giving it --- 17,25 ---- Unless \var{shallow} is given and is false, files with identical ! \function{os.stat()} signatures are taken to be equal. ! \versionchanged[\var{use_statcache} is obsolete and ignored.]{2.3} Files that were compared using this function will not be compared again ! unless their \function{os.stat()} signature changes. Note that no external programs are called from this function, giving it Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.29 retrieving revision 1.29.2.1 diff -C2 -d -r1.29 -r1.29.2.1 *** libfcntl.tex 14 Jun 2002 01:58:19 -0000 1.29 --- libfcntl.tex 28 Apr 2003 17:36:59 -0000 1.29.2.1 *************** *** 48,55 **** \end{funcdesc} ! \begin{funcdesc}{ioctl}{fd, op, arg} ! This function is identical to the \function{fcntl()} function, except ! that the operations are typically defined in the library module ! \refmodule{termios}. \end{funcdesc} --- 48,102 ---- \end{funcdesc} ! \begin{funcdesc}{ioctl}{fd, op\optional{, arg\optional{, mutate_flag}}} ! This function is identical to the \function{fcntl()} function, ! except that the operations are typically defined in the library ! module \refmodule{termios} and the argument handling is even more ! complicated. ! ! The parameter \var{arg} can be one of an integer, absent (treated ! identically to the integer \code{0}), an object supporting the ! read-only buffer interface (most likely a plain Python string) or an ! object supporting the read-write buffer interface. ! ! In all but the last case, behaviour is as for the \function{fcntl()} ! function. ! ! If a mutable buffer is passed, then the behaviour is determined by ! the value of the \var{mutate_flag} parameter. ! ! If it is false, the buffer's mutability is ignored and behaviour is ! as for a read-only buffer, except that the 1024 byte limit mentioned ! above is avoided -- so long as the buffer you pass is longer than ! what the operating system wants to put there, things should work. ! ! If \var{mutate_flag} is true, then the buffer is (in effect) passed ! to the underlying \function{ioctl()} system call, the latter's ! return code is passed back to the calling Python, and the buffer's ! new contents reflect the action of the \function{ioctl}. This is a ! slight simplification, because if the supplied buffer is less than ! 1024 bytes long it is first copied into a static buffer 1024 bytes ! long which is then passed to \function{ioctl} and copied back into ! the supplied buffer. ! ! If \var{mutate_flag} is not supplied, then in 2.3 it defaults to ! false. This is planned to change over the next few Python versions: ! in 2.4 failing to supply \var{mutate_flag} will get a warning but ! the same behavior and in versions later than 2.5 it will default to ! true. ! ! An example: ! ! \begin{verbatim} ! >>> import array, fnctl, struct, termios, os ! >>> os.getpgrp() ! 13341 ! >>> struct.unpack('h', fcntl.ioctl(0, termios.TIOCGPGRP, " "))[0] ! 13341 ! >>> buf = array.array('h', [0]) ! >>> fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1) ! 0 ! >>> buf ! array('h', [13341]) ! \end{verbatim} \end{funcdesc} *************** *** 119,120 **** --- 166,175 ---- system dependent --- therefore using the \function{flock()} call may be better. + + \begin{seealso} + \seemodule{os}{The \function{os.open} function supports locking flags + and is available on a wider variety of platforms than + the \function{fcntl.lockf} and \function{fcntl.flock} + functions, providing a more platform-independent file + locking facility.} + \end{seealso} Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.46 retrieving revision 1.46.2.1 diff -C2 -d -r1.46 -r1.46.2.1 *** libexcs.tex 29 May 2002 15:54:55 -0000 1.46 --- libexcs.tex 28 Apr 2003 17:37:00 -0000 1.46.2.1 *************** *** 207,212 **** \begin{excdesc}{NameError} Raised when a local or global name is not found. This applies only ! to unqualified names. The associated value is the name that could ! not be found. \end{excdesc} --- 207,212 ---- \begin{excdesc}{NameError} Raised when a local or global name is not found. This applies only ! to unqualified names. The associated value is an error message that ! includes the name that could not be found. \end{excdesc} *************** *** 336,339 **** --- 336,357 ---- \end{excdesc} + \begin{excdesc}{UnicodeEncodeError} + Raised when a Unicode-related error occurs during encoding. It + is a subclass of \exception{UnicodeError}. + \versionadded{2.3} + \end{excdesc} + + \begin{excdesc}{UnicodeDecodeError} + Raised when a Unicode-related error occurs during decoding. It + is a subclass of \exception{UnicodeError}. + \versionadded{2.3} + \end{excdesc} + + \begin{excdesc}{UnicodeTranslateError} + Raised when a Unicode-related error occurs during translating. It + is a subclass of \exception{UnicodeError}. + \versionadded{2.3} + \end{excdesc} + \begin{excdesc}{ValueError} Raised when a built-in operation or function receives an argument *************** *** 363,367 **** The following exceptions are used as warning categories; see the ! \module{warnings} module for more information. \begin{excdesc}{Warning} --- 381,385 ---- The following exceptions are used as warning categories; see the ! \refmodule{warnings} module for more information. \begin{excdesc}{Warning} *************** *** 389,392 **** --- 407,415 ---- \end{excdesc} + \begin{excdesc}{FutureWarning} + Base class for warnings about constructs that will change semantically + in the future. + \end{excdesc} + The class hierarchy for built-in exceptions is: *************** *** 422,425 **** --- 445,451 ---- | +-- ValueError | | +-- UnicodeError + | | +-- UnicodeEncodeError + | | +-- UnicodeDecodeError + | | +-- UnicodeTranslateError | +-- ReferenceError | +-- SystemError *************** *** 432,434 **** --- 458,461 ---- +-- OverflowWarning +-- RuntimeWarning + +-- FutureWarning \end{verbatim} Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.9 retrieving revision 1.9.12.1 diff -C2 -d -r1.9 -r1.9.12.1 *** libdoctest.tex 2 Oct 2001 21:01:22 -0000 1.9 --- libdoctest.tex 28 Apr 2003 17:37:06 -0000 1.9.12.1 *************** *** 153,156 **** --- 153,160 ---- \end{verbatim} + If you want to test the module as the main module, you don't need to + pass M to \function{testmod}; in this case, it will test the current + module. + Then running the module as a script causes the examples in the docstrings to get executed and verified: *************** *** 393,397 **** def _test(): import doctest, sys ! doctest.testmod(sys.modules["__main__"]) \end{verbatim} \end{enumerate} --- 397,401 ---- def _test(): import doctest, sys ! doctest.testmod() \end{verbatim} \end{enumerate} Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.37 retrieving revision 1.37.2.1 diff -C2 -d -r1.37 -r1.37.2.1 *** libdis.tex 26 Jun 2002 22:32:47 -0000 1.37 --- libdis.tex 28 Apr 2003 17:37:07 -0000 1.37.2.1 *************** *** 24,38 **** \begin{verbatim} >>> dis.dis(myfunc) ! 0 SET_LINENO 1 ! ! 3 SET_LINENO 2 ! 6 LOAD_GLOBAL 0 (len) ! 9 LOAD_FAST 0 (alist) ! 12 CALL_FUNCTION 1 ! 15 RETURN_VALUE ! 16 LOAD_CONST 0 (None) ! 19 RETURN_VALUE \end{verbatim} The \module{dis} module defines the following functions and constants: --- 24,37 ---- \begin{verbatim} >>> dis.dis(myfunc) ! 2 0 LOAD_GLOBAL 0 (len) ! 3 LOAD_FAST 0 (alist) ! 6 CALL_FUNCTION 1 ! 9 RETURN_VALUE ! 10 LOAD_CONST 0 (None) ! 13 RETURN_VALUE \end{verbatim} + (The ``2'' is a line number). + The \module{dis} module defines the following functions and constants: *************** *** 57,60 **** --- 56,60 ---- \begin{enumerate} + \item the line number, for the first instruction of each line \item the current instruction, indicated as \samp{-->}, \item a labelled instruction, indicated with \samp{>\code{>}}, *************** *** 304,308 **** \begin{opcodedesc}{SLICE+2}{} ! Implements \code{TOS = TOS1[:TOS1]}. \end{opcodedesc} --- 304,308 ---- \begin{opcodedesc}{SLICE+2}{} ! Implements \code{TOS = TOS1[:TOS]}. \end{opcodedesc} *************** *** 622,626 **** \begin{opcodedesc}{SET_LINENO}{lineno} ! Sets the current line number to \var{lineno}. \end{opcodedesc} --- 622,626 ---- \begin{opcodedesc}{SET_LINENO}{lineno} ! This opcode is obsolete. \end{opcodedesc} Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** libdifflib.tex 29 Apr 2002 01:37:31 -0000 1.12 --- libdifflib.tex 28 Apr 2003 17:37:08 -0000 1.12.2.1 *************** *** 113,117 **** \begin{verbatim} >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), ! ... 'ore\ntree\nemu\n'.splitlines(1))) >>> print ''.join(diff), - one --- 113,117 ---- \begin{verbatim} >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1), ! ... 'ore\ntree\nemu\n'.splitlines(1)) >>> print ''.join(diff), - one Index: libcursespanel.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcursespanel.tex,v retrieving revision 1.3 retrieving revision 1.3.10.1 diff -C2 -d -r1.3 -r1.3.10.1 *** libcursespanel.tex 5 Nov 2001 21:31:33 -0000 1.3 --- libcursespanel.tex 28 Apr 2003 17:37:14 -0000 1.3.10.1 *************** *** 3,7 **** \declaremodule{standard}{curses.panel} ! \sectionauthor{A.M. Kuchling}{akuchlin@mems-exchange.org} \modulesynopsis{A panel stack extension that adds depth to curses windows.} --- 3,7 ---- \declaremodule{standard}{curses.panel} ! \sectionauthor{A.M. Kuchling}{amk@amk.ca} \modulesynopsis{A panel stack extension that adds depth to curses windows.} Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.39 retrieving revision 1.39.2.1 diff -C2 -d -r1.39 -r1.39.2.1 *** libcurses.tex 27 Jun 2002 18:30:34 -0000 1.39 --- libcurses.tex 28 Apr 2003 17:37:14 -0000 1.39.2.1 *************** *** 267,271 **** \begin{funcdesc}{initscr}{} Initialize the library. Returns a \class{WindowObject} which represents ! the whole screen. \end{funcdesc} --- 267,272 ---- \begin{funcdesc}{initscr}{} Initialize the library. Returns a \class{WindowObject} which represents ! the whole screen. \note{If there is an error opening the terminal, ! the underlying curses library may cause the interpreter to exit.} \end{funcdesc} *************** *** 702,706 **** Get a character. Note that the integer returned does \emph{not} have to be in \ASCII{} range: function keys, keypad keys and so on return numbers ! higher than 256. In no-delay mode, an exception is raised if there is no input. \end{methoddesc} --- 703,707 ---- Get a character. Note that the integer returned does \emph{not} have to be in \ASCII{} range: function keys, keypad keys and so on return numbers ! higher than 256. In no-delay mode, -1 is returned if there is no input. \end{methoddesc} Index: libcookie.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcookie.tex,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** libcookie.tex 16 Nov 2001 22:28:17 -0000 1.7 --- libcookie.tex 28 Apr 2003 17:37:20 -0000 1.7.8.1 *************** *** 20,29 **** \begin{excdesc}{CookieError} Exception failing because of \rfc{2109} invalidity: incorrect ! attributes, incorrect \code{Set-Cookie} header, etc. \end{excdesc} \begin{classdesc}{BaseCookie}{\optional{input}} This class is a dictionary-like object whose keys are strings and ! whose values are \class{Morsel}s. Note that upon setting a key to a value, the value is first converted to a \class{Morsel} containing the key and the value. --- 20,29 ---- \begin{excdesc}{CookieError} Exception failing because of \rfc{2109} invalidity: incorrect ! attributes, incorrect \mailheader{Set-Cookie} header, etc. \end{excdesc} \begin{classdesc}{BaseCookie}{\optional{input}} This class is a dictionary-like object whose keys are strings and ! whose values are \class{Morsel} instances. Note that upon setting a key to a value, the value is first converted to a \class{Morsel} containing the key and the value. *************** *** 41,50 **** This class derives from \class{BaseCookie} and overrides \method{value_decode()} and \method{value_encode()} to be the ! \function{pickle.loads()} and \function{pickle.dumps()}. ! \strong{Do not use this class!} Reading pickled values from untrusted cookie data is a huge security hole, as pickle strings can be crafted to cause arbitrary code to execute on your server. It is supported ! for backwards compatibility only, and may eventually go away. \end{classdesc} --- 41,50 ---- This class derives from \class{BaseCookie} and overrides \method{value_decode()} and \method{value_encode()} to be the ! \function{pickle.loads()} and \function{pickle.dumps()}. ! \deprecated{2.3}{Reading pickled values from untrusted cookie data is a huge security hole, as pickle strings can be crafted to cause arbitrary code to execute on your server. It is supported ! for backwards compatibility only, and may eventually go away.} \end{classdesc} *************** *** 56,61 **** string, in which case it returns the value itself. ! \strong{Note:} The same security warning from \class{SerialCookie} ! applies here. \end{classdesc} --- 56,61 ---- string, in which case it returns the value itself. ! \deprecated{2.3}{The same security warning from \class{SerialCookie} ! applies here.} \end{classdesc} Index: libcodeop.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodeop.tex,v retrieving revision 1.5 retrieving revision 1.5.16.1 diff -C2 -d -r1.5 -r1.5.16.1 *** libcodeop.tex 28 Aug 2001 14:25:03 -0000 1.5 --- libcodeop.tex 28 Apr 2003 17:37:24 -0000 1.5.16.1 *************** *** 97,101 **** def CommandCompiler(): from codeop import compile_command ! return compile_comamnd \end{verbatim} --- 97,101 ---- def CommandCompiler(): from codeop import compile_command ! return compile_command \end{verbatim} Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** libcodecs.tex 4 Jun 2002 15:16:29 -0000 1.10 --- libcodecs.tex 28 Apr 2003 17:37:25 -0000 1.10.2.1 *************** *** 6,10 **** \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \index{Unicode} --- 6,10 ---- \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \index{Unicode} *************** *** 18,22 **** This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec ! registry which manages the codec lookup process. It defines the following functions: --- 18,22 ---- This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec ! registry which manages the codec and error handling lookup process. It defines the following functions: *************** *** 46,52 **** Possible values for errors are \code{'strict'} (raise an exception in case of an encoding error), \code{'replace'} (replace malformed ! data with a suitable replacement marker, such as \character{?}) and \code{'ignore'} (ignore malformed data and continue without further ! notice). In case a search function cannot find a given encoding, it should --- 46,56 ---- Possible values for errors are \code{'strict'} (raise an exception in case of an encoding error), \code{'replace'} (replace malformed ! data with a suitable replacement marker, such as \character{?}), \code{'ignore'} (ignore malformed data and continue without further ! notice), \code{'xmlcharrefreplace'} (replace with the appropriate XML ! character reference (for encoding only)) and \code{'backslashreplace'} ! (replace with backslashed escape sequences (for encoding only)) as ! well as any other error handling name defined via ! \function{register_error()}. In case a search function cannot find a given encoding, it should *************** *** 96,99 **** --- 100,151 ---- \end{funcdesc} + \begin{funcdesc}{register_error}{name, error_handler} + Register the error handling function \var{error_handler} under the + name \var{name}. \var{error_handler} will be called during encoding + and decoding in case of an error, when \var{name} is specified as the + errors parameter. + + For encoding \var{error_handler} will be called with a + \exception{UnicodeEncodeError} instance, which contains information about + the location of the error. The error handler must either raise this or + a different exception or return a tuple with a replacement for the + unencodable part of the input and a position where encoding should + continue. The encoder will encode the replacement and continue encoding + the original input at the specified position. Negative position values + will be treated as being relative to the end of the input string. If the + resulting position is out of bound an IndexError will be raised. + + Decoding and translating works similar, except \exception{UnicodeDecodeError} + or \exception{UnicodeTranslateError} will be passed to the handler and + that the replacement from the error handler will be put into the output + directly. + \end{funcdesc} + + \begin{funcdesc}{lookup_error}{name} + Return the error handler previously register under the name \var{name}. + + Raises a \exception{LookupError} in case the handler cannot be found. + \end{funcdesc} + + \begin{funcdesc}{strict_errors}{exception} + Implements the \code{strict} error handling. + \end{funcdesc} + + \begin{funcdesc}{replace_errors}{exception} + Implements the \code{replace} error handling. + \end{funcdesc} + + \begin{funcdesc}{ignore_errors}{exception} + Implements the \code{ignore} error handling. + \end{funcdesc} + + \begin{funcdesc}{xmlcharrefreplace_errors_errors}{exception} + Implements the \code{xmlcharrefreplace} error handling. + \end{funcdesc} + + \begin{funcdesc}{backslashreplace_errors_errors}{exception} + Implements the \code{backslashreplace} error handling. + \end{funcdesc} + To simplify working with encoded files or stream, the module also defines these utility functions: *************** *** 191,202 **** \begin{tableii}{l|l}{code}{Value}{Meaning} ! \lineii{'strict'}{Raise \exception{ValueError} (or a subclass); this is the default.} \lineii{'ignore'}{Ignore the character and continue with the next.} \lineii{'replace'}{Replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT ! CHARACTER for the built-in Unicode codecs.} \end{tableii} \subsubsection{Codec Objects \label{codec-objects}} --- 243,261 ---- \begin{tableii}{l|l}{code}{Value}{Meaning} ! \lineii{'strict'}{Raise \exception{UnicodeError} (or a subclass); this is the default.} \lineii{'ignore'}{Ignore the character and continue with the next.} \lineii{'replace'}{Replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT ! CHARACTER for the built-in Unicode codecs on ! decoding and '?' on encoding.} ! \lineii{'xmlcharrefreplace'}{Replace with the appropriate XML ! character reference (only for encoding).} ! \lineii{'backslashreplace'}{Replace with backslashed escape sequences ! (only for encoding).} \end{tableii} + The set of allowed values can be extended via \method{register_error}. + \subsubsection{Codec Objects \label{codec-objects}} *************** *** 267,271 **** The \class{StreamWriter} may implement different error handling schemes by providing the \var{errors} keyword argument. These ! parameters are defined: \begin{itemize} --- 326,330 ---- The \class{StreamWriter} may implement different error handling schemes by providing the \var{errors} keyword argument. These ! parameters are predefined: \begin{itemize} *************** *** 274,278 **** --- 333,348 ---- \item \code{'ignore'} Ignore the character and continue with the next. \item \code{'replace'} Replace with a suitable replacement character + \item \code{'xmlcharrefreplace'} Replace with the appropriate XML + character reference + \item \code{'backslashreplace'} Replace with backslashed escape sequences. \end{itemize} + + The \var{errors} argument will be assigned to an attribute of the + same name. Assigning to this attribute makes it possible to switch + between different error handling strategies during the lifetime + of the \class{StreamWriter} object. + + The set of allowed values for the \var{errors} argument can + be extended with \function{register_error()}. \end{classdesc} *************** *** 324,327 **** --- 394,405 ---- \item \code{'replace'} Replace with a suitable replacement character. \end{itemize} + + The \var{errors} argument will be assigned to an attribute of the + same name. Assigning to this attribute makes it possible to switch + between different error handling strategies during the lifetime + of the \class{StreamReader} object. + + The set of allowed values for the \var{errors} argument can + be extended with \function{register_error()}. \end{classdesc} *************** *** 445,446 **** --- 523,937 ---- all other methods and attribute from the underlying stream. + \subsection{Standard Encodings} + + Python comes with a number of codecs builtin, either implemented as C + functions, or with dictionaries as mapping tables. The following table + lists the codecs by name, together with a few common aliases, and the + languages for which the encoding is likely used. Neither the list of + aliases nor the list of languages is meant to be exhaustive. Notice + that spelling alternatives that only differ in case or use a hyphen + instead of an underscore are also valid aliases. + + Many of the character sets support the same languages. They vary in + individual characters (e.g. whether the EURO SIGN is supported or + not), and in the assignment of characters to code positions. For the + European languages in particular, the following variants typically + exist: + + \begin{itemize} + \item an ISO 8859 codeset + \item a Microsoft Windows code page, which is typically derived from + a 8859 codeset, but replaces control characters with additional + graphic characters + \item an IBM EBCDIC code page + \item an IBM PC code page, which is ASCII compatible + \end{itemize} + + \begin{longtableiii}{l|l|l}{textrm}{Codec}{Aliases}{Languages} + + \lineiii{ascii} + {646, us-ascii} + {English} + + \lineiii{cp037} + {IBM037, IBM039} + {English} + + \lineiii{cp424} + {EBCDIC-CP-HE, IBM424} + {Hebrew} + + \lineiii{cp437} + {437, IBM437} + {English} + + \lineiii{cp500} + {EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500} + {Western Europe} + + \lineiii{cp737} + {} + {Greek} + + \lineiii{cp775} + {IBM775} + {Baltic languages} + + \lineiii{cp850} + {850, IBM850} + {Western Europe} + + \lineiii{cp852} + {852, IBM852} + {Central and Eastern Europe} + + \lineiii{cp855} + {855, IBM855} + {Bulgarian, Byelorussian, Macedonian, Russian, Serbian} + + \lineiii{cp856} + {} + {Hebrew} + + \lineiii{cp857} + {857, IBM857} + {Turkish} + + \lineiii{cp860} + {860, IBM860} + {Portuguese} + + \lineiii{cp861} + {861, CP-IS, IBM861} + {Icelandic} + + \lineiii{cp862} + {862, IBM862} + {Hebrew} + + \lineiii{cp863} + {863, IBM863} + {Canadian} + + \lineiii{cp864} + {IBM864} + {Arabic} + + \lineiii{cp865} + {865, IBM865} + {Danish, Norwegian} + + \lineiii{cp869} + {869, CP-GR, IBM869} + {Greek} + + \lineiii{cp874} + {} + {Thai} + + \lineiii{cp875} + {} + {Greek} + + \lineiii{cp1006} + {} + {Urdu} + + \lineiii{cp1026} + {ibm1026} + {Turkish} + + \lineiii{cp1140} + {ibm1140} + {Western Europe} + + \lineiii{cp1250} + {windows-1250} + {Central and Eastern Europe} + + \lineiii{cp1251} + {windows-1251} + {Bulgarian, Byelorussian, Macedonian, Russian, Serbian} + + \lineiii{cp1252} + {windows-1252} + {Western Europe} + + \lineiii{cp1253} + {windows-1253} + {Greek} + + \lineiii{cp1254} + {windows-1254} + {Turkish} + + \lineiii{cp1255} + {windows-1255} + {Hebrew} + + \lineiii{cp1256} + {windows1256} + {Arabic} + + \lineiii{cp1257} + {windows-1257} + {Baltic languages} + + \lineiii{cp1258} + {windows-1258} + {Vietnamese} + + \lineiii{latin_1} + {iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1} + {West Europe} + + \lineiii{iso8859_2} + {iso-8859-2, latin2, L2} + {Central and Eastern Europe} + + \lineiii{iso8859_3} + {iso-8859-3, latin3, L3} + {Esperanto, Maltese} + + \lineiii{iso8859_4} + {iso-8859-4, latin4, L4} + {Baltic languagues} + + \lineiii{iso8859_5} + {iso-8859-5, cyrillic} + {Bulgarian, Byelorussian, Macedonian, Russian, Serbian} + + \lineiii{iso8859_6} + {iso-8859-6, arabic} + {Arabic} + + \lineiii{iso8859_7} + {iso-8859-7, greek, greek8} + {Greek} + + \lineiii{iso8859_8} + {iso-8859-8, hebrew} + {Hebrew} + + \lineiii{iso8859_9} + {iso-8859-9, latin5, L5} + {Turkish} + + \lineiii{iso8859_10} + {iso-8859-10, latin6, L6} + {Nordic languages} + + \lineiii{iso8859_13} + {iso-8859-13} + {Baltic languages} + + \lineiii{iso8859_14} + {iso-8859-14, latin8, L8} + {Celtic languages} + + \lineiii{iso8859_15} + {iso-8859-15} + {Western Europe} + + \lineiii{koi8_r} + {} + {Russian} + + \lineiii{koi8_u} + {} + {Ukrainian} + + \lineiii{mac_cyrillic} + {maccyrillic} + {Bulgarian, Byelorussian, Macedonian, Russian, Serbian} + + \lineiii{mac_greek} + {macgreek} + {Greek} + + \lineiii{mac_iceland} + {maciceland} + {Icelandic} + + \lineiii{mac_latin2} + {maclatin2, maccentraleurope} + {Central and Eastern Europe} + + \lineiii{mac_roman} + {macroman} + {Western Europe} + + \lineiii{mac_turkish} + {macturkish} + {Turkish} + + \lineiii{utf_16} + {U16, utf16} + {all languages} + + \lineiii{utf_16_be} + {UTF-16BE} + {all languages (BMP only)} + + \lineiii{utf_16_le} + {UTF-16LE} + {all languages (BMP only)} + + \lineiii{utf_7} + {U7} + {all languages} + + \lineiii{utf_8} + {U8, UTF, utf8} + {all languages} + + \end{longtableiii} + + A number of codecs are specific to Python, so their codec names have + no meaning outside Python. Some of them don't convert from Unicode + strings to byte strings, but instead use the property of the Python + codecs machinery that any bijective function with one argument can be + considered as an encoding. + + For the codecs listed below, the result in the ``encoding'' direction + is always a byte string. The result of the ``decoding'' direction is + listed as operand type in the table. + + \begin{tableiv}{l|l|l|l}{textrm}{Codec}{Aliases}{Operand type}{Purpose} + + \lineiv{base64_codec} + {base64, base-64} + {byte string} + {Convert operand to MIME base64} + + \lineiv{hex_codec} + {hex} + {byte string} + {Convert operand to hexadecimal representation, with two digits per byte} + + \lineiv{idna} + {} + {Unicode string} + {Implements \rfc{3490}. \versionadded{2.3}. See also \module{encodings.idna}} + + \lineiv{mbcs} + {dbcs} + {Unicode string} + {Windows only: Encode operand according to the ANSI codepage (CP_ACP)} + + \lineiv{palmos} + {} + {Unicode string} + {Encoding of PalmOS 3.5} + + \lineiv{punycode} + {} + {Unicode string} + {Implements \rfc{3492}. \versionadded{2.3}} + + \lineiv{quopri_codec} + {quopri, quoted-printable, quotedprintable} + {byte string} + {Convert operand to MIME quoted printable} + + \lineiv{raw_unicode_escape} + {} + {Unicode string} + {Produce a string that is suitable as raw Unicode literal in Python source code} + + \lineiv{rot_13} + {rot13} + {byte string} + {Returns the Caesar-cypher encryption of the operand} + + \lineiv{string_escape} + {} + {byte string} + {Produce a string that is suitable as string literal in Python source code} + + \lineiv{undefined} + {} + {any} + {Raise an exception for all conversion. Can be used as the system encoding if no automatic coercion between byte and Unicode strings is desired.} + + \lineiv{unicode_escape} + {} + {Unicode string} + {Produce a string that is suitable as Unicode literal in Python source code} + + \lineiv{unicode_internal} + {} + {Unicode string} + {Return the internal represenation of the operand} + + \lineiv{uu_codec} + {uu} + {byte string} + {Convert the operand using uuencode} + + \lineiv{zlib_codec} + {zip, zlib} + {byte string} + {Compress the operand using gzip} + + \end{tableiv} + + \subsection{\module{encodings.idna} --- + Internationalized Domain Names in Applications} + + \declaremodule{standard}{encodings.idna} + \modulesynopsis{Internationalized Domain Names implementation} + \moduleauthor{Martin v. L\"owis} + + This module implements \rfc{3490} (Internationalized Domain Names in + Applications) and \rfc{3492} (Nameprep: A Stringprep Profile for + Internationalized Domain Names (IDN)). It builds upon the + \code{punycode} encoding and \module{stringprep}. \versionadded{2.3} + + These RFCs together define a protocol to support non-ASCII characters + in domain names. A domain name containing non-ASCII characters (such + as ``www.Alliancefran\c{c}aise.nu'') is converted into an + ASCII-compatible encoding (ACE, such as + ``www.xn--alliancefranaise-npb.nu''). The ACE form of the domain name + is then used in all places where arbitrary characters are not allowed + by the protocol, such as DNS queries, HTTP \code{Host:} fields, and so + on. This conversion is carried out in the application; if possible + invisible to the user: The application should transparently convert + Unicode domain labels to IDNA on the wire, and convert back ACE labels + to Unicode before presenting them to the user. + + Python supports this conversion in several ways: The \code{idna} codec + allows to convert between Unicode and the ACE. Furthermore, the + \module{socket} module transparently converts Unicode host names to + ACE, so that applications need not be concerned about converting host + names themselves when they pass them to the socket module. On top of + that, modules that have host names as function parameters, such as + \module{httplib} and \module{ftplib}, accept Unicode host names + (\module{httplib} then also transparently sends an IDNA hostname in + the \code{Host:} field if it sends that field at all). + + When receiving host names from the wire (such as in reverse name + lookup), no automatic conversion to Unicode is performed: Applications + wishing to present such host names to the user should decode them to + Unicode. + + The module \module{encodings.idna} also implements the nameprep + procedure, which performs certain normalizations on host names, to + achieve case-insensitivity of international domain names, and to unify + similar characters. The nameprep functions can be used directly if + desired. + + \begin{funcdesc}{nameprep}{label} + Return the nameprepped version of \var{label}. The implementation + currently assumes query strings, so \code{AllowUnassigned} is + true. + \end{funcdesc} + + \begin{funcdesc}{ToASCCII}{label} + Convert a label to ASCII, as specified in \rfc{3490}. + \code{UseSTD3ASCIIRules} is assumed to be false. + \end{funcdesc} + + \begin{funcdesc}{ToUnicode}{label} + Convert a label to Unicode, as specified in \rfc{3490}. + \end{funcdesc} Index: libcmd.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcmd.tex,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** libcmd.tex 27 Dec 2001 05:10:18 -0000 1.12 --- libcmd.tex 28 Apr 2003 17:37:29 -0000 1.12.2.1 *************** *** 12,16 **** later be wrapped in a more sophisticated interface. ! \begin{classdesc}{Cmd}{\optional{completekey}} A \class{Cmd} instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate --- 12,16 ---- later be wrapped in a more sophisticated interface. ! \begin{classdesc}{Cmd}{\optional{completekey},\optional{stdin},\optional{stdout}} A \class{Cmd} instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate *************** *** 19,26 **** \class{Cmd}'s methods and encapsulate action methods. ! The optional argument is the \refmodule{readline} name of a completion ! key; it defaults to \kbd{Tab}. If \var{completekey} is not \code{None} ! and \module{readline} is available, command completion is done ! automatically. \end{classdesc} --- 19,33 ---- \class{Cmd}'s methods and encapsulate action methods. ! The optional argument \var{completekey} is the \refmodule{readline} name ! of a completion key; it defaults to \kbd{Tab}. If \var{completekey} is ! not \code{None} and \module{readline} is available, command completion ! is done automatically. ! ! The optional arguments \var{stdin} and \var{stdout} specify the ! input and output file objects that the Cmd instance or subclass ! instance will use for input and output. If not specified, they ! will default to \var{sys.stdin} and \var{sys.stdout}. ! ! \versionchanged[The \var{stdin} and \var{stdout} parameters were added.]{2.3} \end{classdesc} Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -C2 -d -r1.36 -r1.36.2.1 *** libcgi.tex 26 Apr 2002 20:44:14 -0000 1.36 --- libcgi.tex 28 Apr 2003 17:37:33 -0000 1.36.2.1 *************** *** 205,212 **** \begin{verbatim} - from types import ListType - item = form.getvalue("item") ! if isinstance(item, ListType): # The user is requesting more than one item. else: --- 205,210 ---- \begin{verbatim} item = form.getvalue("item") ! if isinstance(item, list): # The user is requesting more than one item. else: *************** *** 253,260 **** more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser ! and should not be counted on. If no such form field or value exists ! then the method returns the value specified by the optional ! parameter \var{default}. This parameter defaults to \code{None} if ! not specified. \end{methoddesc} --- 251,262 ---- more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser ! and should not be counted on.\footnote{Note that some recent ! versions of the HTML specification do state what order the ! field values should be supplied in, but knowing whether a ! request was received from a conforming browser, or even from a ! browser at all, is tedious and error-prone.} If no such form ! field or value exists then the method returns the value specified by ! the optional parameter \var{default}. This parameter defaults to ! \code{None} if not specified. \end{methoddesc} *************** *** 271,275 **** import cgi form = cgi.FieldStorage() ! user = form.getfirst("user").toupper() # This way it's safe. for item in form.getlist("item"): do_something(item) --- 273,277 ---- import cgi form = cgi.FieldStorage() ! user = form.getfirst("user", "").toupper() # This way it's safe. for item in form.getlist("item"): do_something(item) *************** *** 350,353 **** --- 352,358 ---- are silently ignored. If true, errors raise a ValueError exception. + + Use the \function{\refmodule{cgi}.urlencode()} function to convert + such lists of pairs into query strings. \end{funcdesc} *************** *** 403,407 **** true, the double-quote character (\character{"}) is also translated; this helps for inclusion in an HTML attribute value, as in \code{}. If the value to be qouted might include single- or double-quote characters, or both, consider using the \function{quoteattr()} function in the \refmodule{xml.sax.saxutils} --- 408,412 ---- true, the double-quote character (\character{"}) is also translated; this helps for inclusion in an HTML attribute value, as in \code{}. If the value to be quoted might include single- or double-quote characters, or both, consider using the \function{quoteattr()} function in the \refmodule{xml.sax.saxutils} Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** libcfgparser.tex 5 Apr 2002 02:21:09 -0000 1.22 --- libcfgparser.tex 28 Apr 2003 17:37:35 -0000 1.22.2.1 *************** *** 17,21 **** programs which can be customized by end users easily. ! The configuration file consists of sections, lead by a \samp{[section]} header and followed by \samp{name: value} entries, with continuations in the style of \rfc{822}; \samp{name=value} is --- 17,26 ---- programs which can be customized by end users easily. ! \begin{notice}[warning] ! This library does \emph{not} interpret or write the value-type ! prefixes used in the Windows Registry extended version of INI syntax. ! \end{notice} ! ! The configuration file consists of sections, led by a \samp{[section]} header and followed by \samp{name: value} entries, with continuations in the style of \rfc{822}; \samp{name=value} is *************** *** 23,27 **** The optional values can contain format strings which refer to other values in the same section, or values in a special ! \code{DEFAULT} section. Additional defaults can be provided upon initialization and retrieval. Lines beginning with \character{\#} or \character{;} are ignored and may be used to provide comments. --- 28,32 ---- The optional values can contain format strings which refer to other values in the same section, or values in a special ! \code{DEFAULT} section. Additional defaults can be provided on initialization and retrieval. Lines beginning with \character{\#} or \character{;} are ignored and may be used to provide comments. *************** *** 30,33 **** --- 35,39 ---- \begin{verbatim} + [My Section] foodir: %(dir)s/whatever dir=frob *************** *** 43,50 **** others. \begin{classdesc}{ConfigParser}{\optional{defaults}} ! Return a new instance of the \class{ConfigParser} class. When ! \var{defaults} is given, it is initialized into the dictionary of ! intrinsic defaults. The keys must be strings, and the values must be appropriate for the \samp{\%()s} string interpolation. Note that \var{__name__} is an intrinsic default; its value is the section name, --- 49,63 ---- others. + \begin{classdesc}{RawConfigParser}{\optional{defaults}} + The basic configuration object. When \var{defaults} is given, it is + initialized into the dictionary of intrinsic defaults. This class + does not support the magical interpolation behavior. + \versionadded{2.3} + \end{classdesc} + \begin{classdesc}{ConfigParser}{\optional{defaults}} ! Derived class of \class{RawConfigParser} that implements the magical ! interpolation feature and adds optional arguments the \method{get()} ! and \method{items()} methods. The values in \var{defaults} must be appropriate for the \samp{\%()s} string interpolation. Note that \var{__name__} is an intrinsic default; its value is the section name, *************** *** 52,55 **** --- 65,78 ---- \end{classdesc} + \begin{classdesc}{SafeConfigParser}{\optional{defaults}} + Derived class of \class{ConfigParser} that implements a more-sane + variant of the magical interpolation feature. This implementation is + more predictable as well. + % XXX Need to explain what's safer/more predictable about it. + New applications should prefer this version if they don't need to be + compatible with older versions of Python. + \versionadded{2.3} + \end{classdesc} + \begin{excdesc}{NoSectionError} Exception raised when a specified section is not found. *************** *** 68,72 **** \begin{excdesc}{InterpolationError} ! Exception raised when problems occur performing string interpolation. \end{excdesc} --- 91,96 ---- \begin{excdesc}{InterpolationError} ! Base class for exceptions raised when problems occur performing string ! interpolation. \end{excdesc} *************** *** 74,77 **** --- 98,115 ---- Exception raised when string interpolation cannot be completed because the number of iterations exceeds \constant{MAX_INTERPOLATION_DEPTH}. + Subclass of \exception{InterpolationError}. + \end{excdesc} + + \begin{excdesc}{InterpolationMissingOptionError} + Exception raised when an option referenced from a value does not exist. + Subclass of \exception{InterpolationError}. + \versionadded{2.3} + \end{excdesc} + + \begin{excdesc}{InterpolationSyntaxError} + Exception raised when the source text into which substitutions are + made does not conform to the required syntax. + Subclass of \exception{InterpolationError}. + \versionadded{2.3} \end{excdesc} *************** *** 87,92 **** \begin{datadesc}{MAX_INTERPOLATION_DEPTH} The maximum depth for recursive interpolation for \method{get()} when ! the \var{raw} parameter is false. Setting this does not change the ! allowed recursion depth. \end{datadesc} --- 125,130 ---- \begin{datadesc}{MAX_INTERPOLATION_DEPTH} The maximum depth for recursive interpolation for \method{get()} when ! the \var{raw} parameter is false. This is relevant only for the ! \class{ConfigParser} class. \end{datadesc} *************** *** 94,105 **** \begin{seealso} \seemodule{shlex}{Support for a creating \UNIX{} shell-like ! minilanguages which can be used as an alternate format ! for application configuration files.} \end{seealso} ! \subsection{ConfigParser Objects \label{ConfigParser-objects}} ! \class{ConfigParser} instances have the following methods: \begin{methoddesc}{defaults}{} --- 132,143 ---- \begin{seealso} \seemodule{shlex}{Support for a creating \UNIX{} shell-like ! mini-languages which can be used as an alternate ! format for application configuration files.} \end{seealso} ! \subsection{RawConfigParser Objects \label{RawConfigParser-objects}} ! \class{RawConfigParser} instances have the following methods: \begin{methoddesc}{defaults}{} *************** *** 163,171 **** \end{methoddesc} ! \begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}} ! Get an \var{option} value for the provided \var{section}. All the ! \character{\%} interpolations are expanded in the return values, based on ! the defaults passed into the constructor, as well as the options ! \var{vars} provided, unless the \var{raw} argument is true. \end{methoddesc} --- 201,206 ---- \end{methoddesc} ! \begin{methoddesc}{get}{section, option} ! Get an \var{option} value for the named \var{section}. \end{methoddesc} *************** *** 190,193 **** --- 225,233 ---- \end{methoddesc} + \begin{methoddesc}{items}{section} + Return a list of \code{(\var{name}, \var{value})} pairs for each + option in the given \var{section}. + \end{methoddesc} + \begin{methoddesc}{set}{section, option, value} If the given section exists, set the given option to the specified value; *************** *** 224,226 **** --- 264,286 ---- behavior. Setting this to \function{str()}, for example, would make option names case sensitive. + \end{methoddesc} + + + \subsection{ConfigParser Objects \label{ConfigParser-objects}} + + The \class{ConfigParser} class extends some methods of the + \class{RawConfigParser} interface, adding some optional arguments. + + \begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}} + Get an \var{option} value for the named \var{section}. All the + \character{\%} interpolations are expanded in the return values, based + on the defaults passed into the constructor, as well as the options + \var{vars} provided, unless the \var{raw} argument is true. + \end{methoddesc} + + \begin{methoddesc}{items}{section\optional{, raw\optional{, vars}}} + Create a generator which will return a tuple \code{(name, value)} for + each option in the given \var{section}. Optional arguments have the + same meaning as for the \code{get()} method. + \versionadded{2.3} \end{methoddesc} Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** libcalendar.tex 13 Jun 2002 01:34:50 -0000 1.15 --- libcalendar.tex 28 Apr 2003 17:37:36 -0000 1.15.2.1 *************** *** 16,19 **** --- 16,26 ---- dates are given as integers. + Most of these functions rely on the \module{datetime} module which + uses an idealized calendar, the current Gregorian calendar indefinitely + extended in both directions. This matches the definition of the + "proleptic Gregorian" calendar in Dershowitz and Reingold's book + "Calendrical Calculations", where it's the base calendar for all + computations. + \begin{funcdesc}{setfirstweekday}{weekday} Sets the weekday (\code{0} is Monday, \code{6} is Sunday) to start Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** libbsddb.tex 23 Apr 2002 02:11:03 -0000 1.7 --- libbsddb.tex 28 Apr 2003 17:37:40 -0000 1.7.2.1 *************** *** 130,134 **** \begin{methoddesc}{previous}{} ! Set the cursor to the first item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This is not supported on hashtable databases (those opened --- 130,134 ---- \begin{methoddesc}{previous}{} ! Set the cursor to the previous item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This is not supported on hashtable databases (those opened Index: libatexit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libatexit.tex,v retrieving revision 1.7 retrieving revision 1.7.26.1 diff -C2 -d -r1.7 -r1.7.26.1 *** libatexit.tex 9 Sep 2000 03:25:11 -0000 1.7 --- libatexit.tex 28 Apr 2003 17:37:43 -0000 1.7.26.1 *************** *** 73,74 **** --- 73,89 ---- atexit.register(savecounter) \end{verbatim} + + Positional and keyword arguments may also be passed to + \function{register()} to be passed along to the registered function + when it is called: + + \begin{verbatim} + def goodbye(name, adjective): + print 'Goodbye, %s, it was %s to meet you.' % (name, adjective) + + import atexit + atexit.register(goodbye, 'Donny', 'nice') + + # or: + atexit.register(goodbye, adjective='nice', name='Donny') + \end{verbatim} Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** libasyncore.tex 3 Jul 2002 18:36:39 -0000 1.13 --- libasyncore.tex 28 Apr 2003 17:37:45 -0000 1.13.2.1 *************** *** 60,64 **** if you want to retain this behavior). ! Channels (instances of \class{asyncore.despatcher}, \class{asynchat.async_chat} and subclasses thereof) can freely be mixed in the map. \end{funcdesc} --- 60,64 ---- if you want to retain this behavior). ! Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} and subclasses thereof) can freely be mixed in the map. \end{funcdesc} Index: libasynchat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasynchat.tex,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** libasynchat.tex 3 Jul 2002 18:36:39 -0000 1.1 --- libasynchat.tex 28 Apr 2003 17:37:46 -0000 1.1.2.1 *************** *** 14,31 **** \method{collect_incoming_data()} and \method{found_terminator()} methods. It uses the same asynchronous loop as \refmodule{asyncore}, and ! the two types of channel, \class{asyncore.despatcher} and \class{asynchat.async_chat}, can freely be mixed in the channel map. ! Typically an \class{asyncore.despatcher} server channel generates new \class{asynchat.async_chat} channel objects as it receives incoming connection requests. \begin{classdesc}{async_chat}{} ! This class is an abstract subclass of \class{asyncore.despatcher}. To make practical use of the code you must subclass \class{async_chat}, providing meaningful \method{collect_incoming_data()} and \method{found_terminator()} ! methods. The \class{asyncore.despatcher} methods can be used, although not all make sense in a message/response context. ! Like \class{asyncore.despatcher}, \class{async_chat} defines a set of events that are generated by an analysis of socket conditions after a \cfunction{select()} call. Once the polling loop has been started the --- 14,31 ---- \method{collect_incoming_data()} and \method{found_terminator()} methods. It uses the same asynchronous loop as \refmodule{asyncore}, and ! the two types of channel, \class{asyncore.dispatcher} and \class{asynchat.async_chat}, can freely be mixed in the channel map. ! Typically an \class{asyncore.dispatcher} server channel generates new \class{asynchat.async_chat} channel objects as it receives incoming connection requests. \begin{classdesc}{async_chat}{} ! This class is an abstract subclass of \class{asyncore.dispatcher}. To make practical use of the code you must subclass \class{async_chat}, providing meaningful \method{collect_incoming_data()} and \method{found_terminator()} ! methods. The \class{asyncore.dispatcher} methods can be used, although not all make sense in a message/response context. ! Like \class{asyncore.dispatcher}, \class{async_chat} defines a set of events that are generated by an analysis of socket conditions after a \cfunction{select()} call. Once the polling loop has been started the *************** *** 33,37 **** framework with no action on the part of the programmer. ! Unlike \class{asyncore.despatcher}, \class{async_chat} allows you to define a first-in-first-out queue (fifo) of \emph{producers}. A producer need have only one method, \method{more()}, which should return data to be transmitted --- 33,37 ---- framework with no action on the part of the programmer. ! Unlike \class{asyncore.dispatcher}, \class{async_chat} allows you to define a first-in-first-out queue (fifo) of \emph{producers}. A producer need have only one method, \method{more()}, which should return data to be transmitted *************** *** 236,240 **** if self.reading_headers: self.reading_headers = False ! self.parse_headers("".join(self.ibuffer) self.ibuffer = [] if self.op.upper() == "POST": --- 236,240 ---- if self.reading_headers: self.reading_headers = False ! self.parse_headers("".join(self.ibuffer)) self.ibuffer = [] if self.op.upper() == "POST": Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.202 retrieving revision 1.202.2.1 diff -C2 -d -r1.202 -r1.202.2.1 *** lib.tex 3 Jul 2002 18:36:38 -0000 1.202 --- lib.tex 28 Apr 2003 17:37:47 -0000 1.202.2.1 *************** *** 71,74 **** --- 71,75 ---- \input{libstdtypes} \input{libexcs} + \input{libconsts} \input{libpython} % Python Runtime Services *************** *** 91,94 **** --- 92,96 ---- \input{libwarnings} \input{libimp} + \input{libpkgutil} \input{libcode} \input{libcodeop} *************** *** 111,114 **** --- 113,117 ---- \input{libcodecs} \input{libunicodedata} + \input{libstringprep} \input{libmisc} % Miscellaneous Services *************** *** 121,125 **** --- 124,131 ---- \input{libwhrandom} \input{libbisect} + \input{libheapq} \input{libarray} + \input{libsets} + \input{libitertools} \input{libcfgparser} \input{libfileinput} *************** *** 138,141 **** --- 144,148 ---- \input{libfilecmp} \input{libpopen2} + \input{libdatetime} \input{libtime} \input{libsched} *************** *** 146,149 **** --- 153,157 ---- \input{libcursespanel} \input{libgetopt} + \input{liboptparse} \input{libtempfile} \input{liberrno} *************** *** 153,156 **** --- 161,165 ---- \input{liblocale} \input{libgettext} + \input{liblogging} \input{libsomeos} % Optional Operating System Services *************** *** 160,163 **** --- 169,174 ---- \input{libthread} \input{libthreading} + \input{libdummythread} + \input{libdummythreading} \input{libqueue} \input{libmmap} *************** *** 168,172 **** --- 179,185 ---- \input{libzlib} \input{libgzip} + \input{libbz2} \input{libzipfile} + \input{libtarfile} \input{libreadline} \input{librlcompleter} *************** *** 194,197 **** --- 207,212 ---- \input{libprofile} % The Python Profiler + \input{libhotshot} % New profiler + \input{libtimeit} \input{internet} % Internet Protocols *************** *** 217,220 **** --- 232,236 ---- \input{libxmlrpclib} \input{libsimplexmlrpc} + \input{libdocxmlrpc} \input{libasyncore} \input{libasynchat} *************** *** 246,249 **** --- 262,266 ---- \input{libnetrc} \input{librobotparser} + \input{libcsv} \input{markup} % Structured Markup Processing Tools *************** *** 272,275 **** --- 289,293 ---- \input{libimghdr} \input{libsndhdr} + \input{libossaudiodev} \input{libcrypto} % Cryptographic Services Index: emailutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailutil.tex,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** emailutil.tex 22 May 2002 01:22:46 -0000 1.6 --- emailutil.tex 28 Apr 2003 17:37:47 -0000 1.6.2.1 *************** *** 7,11 **** \begin{funcdesc}{quote}{str} Return a new string with backslashes in \var{str} replaced by two ! backslashes and double quotes replaced by backslash-double quote. \end{funcdesc} --- 7,11 ---- \begin{funcdesc}{quote}{str} Return a new string with backslashes in \var{str} replaced by two ! backslashes, and double quotes replaced by backslash-double quote. \end{funcdesc} *************** *** 22,29 **** \emph{realname} and \emph{email address} parts. Returns a tuple of that information, unless the parse fails, in which case a 2-tuple of ! \code{(None, None)} is returned. \end{funcdesc} ! \begin{funcdesc}{dump_address_pair}{pair} The inverse of \method{parseaddr()}, this takes a 2-tuple of the form \code{(realname, email_address)} and returns the string value suitable --- 22,29 ---- \emph{realname} and \emph{email address} parts. Returns a tuple of that information, unless the parse fails, in which case a 2-tuple of ! \code{('', '')} is returned. \end{funcdesc} ! \begin{funcdesc}{formataddr}{pair} The inverse of \method{parseaddr()}, this takes a 2-tuple of the form \code{(realname, email_address)} and returns the string value suitable *************** *** 49,73 **** \end{funcdesc} - \begin{funcdesc}{decode}{s} - This method decodes a string according to the rules in \rfc{2047}. It - returns the decoded string as a Python unicode string. - \end{funcdesc} - - \begin{funcdesc}{encode}{s\optional{, charset\optional{, encoding}}} - This method encodes a string according to the rules in \rfc{2047}. It - is not actually the inverse of \function{decode()} since it doesn't - handle multiple character sets or multiple string parts needing - encoding. In fact, the input string \var{s} must already be encoded - in the \var{charset} character set (Python can't reliably guess what - character set a string might be encoded in). The default - \var{charset} is \samp{iso-8859-1}. - - \var{encoding} must be either the letter \character{q} for - Quoted-Printable or \character{b} for Base64 encoding. If - neither, a \exception{ValueError} is raised. Both the \var{charset} and - the \var{encoding} strings are case-insensitive, and coerced to lower - case in the returned string. - \end{funcdesc} - \begin{funcdesc}{parsedate}{date} Attempts to parse a date according to the rules in \rfc{2822}. --- 49,52 ---- *************** *** 107,111 **** \begin{funcdesc}{formatdate}{\optional{timeval\optional{, localtime}}} ! Returns a date string as per Internet standard \rfc{2822}, e.g.: \begin{verbatim} --- 86,90 ---- \begin{funcdesc}{formatdate}{\optional{timeval\optional{, localtime}}} ! Returns a date string as per \rfc{2822}, e.g.: \begin{verbatim} *************** *** 117,122 **** otherwise the current time is used. ! Optional \var{localtime} is a flag that when true, interprets \var{timeval}, and returns a date relative to the local timezone instead of UTC, properly taking daylight savings time into account. \end{funcdesc} --- 96,142 ---- otherwise the current time is used. ! Optional \var{localtime} is a flag that when \code{True}, interprets \var{timeval}, and returns a date relative to the local timezone instead of UTC, properly taking daylight savings time into account. + The default is \code{False} meaning UTC is used. + \end{funcdesc} + + \begin{funcdesc}{make_msgid}{\optional{idstring}} + Returns a string suitable for an \rfc{2822}-compliant + \mailheader{Message-ID} header. Optional \var{idstring} if given, is + a string used to strengthen the uniqueness of the message id. + \end{funcdesc} + + \begin{funcdesc}{decode_rfc2231}{s} + Decode the string \var{s} according to \rfc{2231}. + \end{funcdesc} + + \begin{funcdesc}{encode_rfc2231}{s\optional{, charset\optional{, language}}} + Encode the string \var{s} according to \rfc{2231}. Optional + \var{charset} and \var{language}, if given is the character set name + and language name to use. If neither is given, \var{s} is returned + as-is. If \var{charset} is given but \var{language} is not, the + string is encoded using the empty string for \var{language}. + \end{funcdesc} + + \begin{funcdesc}{decode_params}{params} + Decode parameters list according to \rfc{2231}. \var{params} is a + sequence of 2-tuples containing elements of the form + \code{(content-type, string-value)}. + \end{funcdesc} + + The following functions have been deprecated: + + \begin{funcdesc}{dump_address_pair}{pair} + \deprecated{2.2.2}{Use \function{formataddr()} instead.} + \end{funcdesc} + + \begin{funcdesc}{decode}{s} + \deprecated{2.2.2}{Use \method{Header.decode_header()} instead.} \end{funcdesc} + + + \begin{funcdesc}{encode}{s\optional{, charset\optional{, encoding}}} + \deprecated{2.2.2}{Use \method{Header.encode()} instead.} + \end{funcdesc} + Index: emailparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailparser.tex,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** emailparser.tex 22 Feb 2002 21:24:32 -0000 1.5 --- emailparser.tex 28 Apr 2003 17:37:48 -0000 1.5.2.1 *************** *** 1,9 **** \declaremodule{standard}{email.Parser} \modulesynopsis{Parse flat text email messages to produce a message ! object tree.} ! Message object trees can be created in one of two ways: they can be created from whole cloth by instantiating \class{Message} objects and ! stringing them together via \method{add_payload()} and \method{set_payload()} calls, or they can be created by parsing a flat text representation of the email message. --- 1,9 ---- \declaremodule{standard}{email.Parser} \modulesynopsis{Parse flat text email messages to produce a message ! object structure.} ! Message object structures can be created in one of two ways: they can be created from whole cloth by instantiating \class{Message} objects and ! stringing them together via \method{attach()} and \method{set_payload()} calls, or they can be created by parsing a flat text representation of the email message. *************** *** 12,19 **** most email document structures, including MIME documents. You can pass the parser a string or a file object, and the parser will return ! to you the root \class{Message} instance of the object tree. For simple, non-MIME messages the payload of this root object will likely be a string containing the text of the message. For MIME ! messages, the root object will return true from its \method{is_multipart()} method, and the subparts can be accessed via the \method{get_payload()} and \method{walk()} methods. --- 12,19 ---- most email document structures, including MIME documents. You can pass the parser a string or a file object, and the parser will return ! to you the root \class{Message} instance of the object structure. For simple, non-MIME messages the payload of this root object will likely be a string containing the text of the message. For MIME ! messages, the root object will return \code{True} from its \method{is_multipart()} method, and the subparts can be accessed via the \method{get_payload()} and \method{walk()} methods. *************** *** 28,43 **** headers and the payload of the message. In the case of \mimetype{multipart} messages, it will recursively parse the body of ! the container message. The \module{email.Parser} module also provides ! a second class, called \class{HeaderParser} which can be used if ! you're only interested in the headers of the message. ! \class{HeaderParser} can be much faster in this situations, since it ! does not attempt to parse the message body, instead setting the ! payload to the raw body as a string. \class{HeaderParser} has the ! same API as the \class{Parser} class. \subsubsection{Parser class API} ! \begin{classdesc}{Parser}{\optional{_class}} ! The constructor for the \class{Parser} class takes a single optional argument \var{_class}. This must be a callable factory (such as a function or a class), and it is used whenever a sub-message object --- 28,47 ---- headers and the payload of the message. In the case of \mimetype{multipart} messages, it will recursively parse the body of ! the container message. Two modes of parsing are supported, ! \emph{strict} parsing, which will usually reject any non-RFC compliant ! message, and \emph{lax} parsing, which attempts to adjust for common ! MIME formatting problems. ! ! The \module{email.Parser} module also provides a second class, called ! \class{HeaderParser} which can be used if you're only interested in ! the headers of the message. \class{HeaderParser} can be much faster in ! these situations, since it does not attempt to parse the message body, ! instead setting the payload to the raw body as a string. ! \class{HeaderParser} has the same API as the \class{Parser} class. \subsubsection{Parser class API} ! \begin{classdesc}{Parser}{\optional{_class\optional{, strict}}} ! The constructor for the \class{Parser} class takes an optional argument \var{_class}. This must be a callable factory (such as a function or a class), and it is used whenever a sub-message object *************** *** 45,53 **** \refmodule{email.Message}). The factory will be called without arguments. \end{classdesc} The other public \class{Parser} methods are: ! \begin{methoddesc}[Parser]{parse}{fp} Read all the data from the file-like object \var{fp}, parse the resulting text, and return the root message object. \var{fp} must --- 49,71 ---- \refmodule{email.Message}). The factory will be called without arguments. + + The optional \var{strict} flag specifies whether strict or lax parsing + should be performed. Normally, when things like MIME terminating + boundaries are missing, or when messages contain other formatting + problems, the \class{Parser} will raise a + \exception{MessageParseError}. However, when lax parsing is enabled, + the \class{Parser} will attempt to work around such broken formatting + to produce a usable message structure (this doesn't mean + \exception{MessageParseError}s are never raised; some ill-formatted + messages just can't be parsed). The \var{strict} flag defaults to + \code{False} since lax parsing usually provides the most convenient + behavior. + + \versionchanged[The \var{strict} flag was added]{2.2.2} \end{classdesc} The other public \class{Parser} methods are: ! \begin{methoddesc}[Parser]{parse}{fp\optional{, headersonly}} Read all the data from the file-like object \var{fp}, parse the resulting text, and return the root message object. \var{fp} must *************** *** 56,86 **** The text contained in \var{fp} must be formatted as a block of \rfc{2822} ! style headers and header continuation lines, optionally preceeded by a ! \emph{Unix-From} header. The header block is terminated either by the end of the data or by a blank line. Following the header block is the body of the message (which may contain MIME-encoded subparts). \end{methoddesc} ! \begin{methoddesc}[Parser]{parsestr}{text} Similar to the \method{parse()} method, except it takes a string object instead of a file-like object. Calling this method on a string is exactly equivalent to wrapping \var{text} in a \class{StringIO} instance first and calling \method{parse()}. \end{methoddesc} ! Since creating a message object tree from a string or a file object is ! such a common task, two functions are provided as a convenience. They ! are available in the top-level \module{email} package namespace. ! \begin{funcdesc}{message_from_string}{s\optional{, _class}} ! Return a message object tree from a string. This is exactly ! equivalent to \code{Parser().parsestr(s)}. Optional \var{_class} is ! interpreted as with the \class{Parser} class constructor. \end{funcdesc} ! \begin{funcdesc}{message_from_file}{fp\optional{, _class}} ! Return a message object tree from an open file object. This is exactly ! equivalent to \code{Parser().parse(fp)}. Optional \var{_class} is ! interpreted as with the \class{Parser} class constructor. \end{funcdesc} --- 74,120 ---- The text contained in \var{fp} must be formatted as a block of \rfc{2822} ! style headers and header continuation lines, optionally preceded by a ! envelope header. The header block is terminated either by the end of the data or by a blank line. Following the header block is the body of the message (which may contain MIME-encoded subparts). + + Optional \var{headersonly} is as with the \method{parse()} method. + + \versionchanged[The \var{headersonly} flag was added]{2.2.2} \end{methoddesc} ! \begin{methoddesc}[Parser]{parsestr}{text\optional{, headersonly}} Similar to the \method{parse()} method, except it takes a string object instead of a file-like object. Calling this method on a string is exactly equivalent to wrapping \var{text} in a \class{StringIO} instance first and calling \method{parse()}. + + Optional \var{headersonly} is a flag specifying whether to stop + parsing after reading the headers or not. The default is \code{False}, + meaning it parses the entire contents of the file. + + \versionchanged[The \var{headersonly} flag was added]{2.2.2} \end{methoddesc} ! Since creating a message object structure from a string or a file ! object is such a common task, two functions are provided as a ! convenience. They are available in the top-level \module{email} ! package namespace. ! \begin{funcdesc}{message_from_string}{s\optional{, _class\optional{, strict}}} ! Return a message object structure from a string. This is exactly ! equivalent to \code{Parser().parsestr(s)}. Optional \var{_class} and ! \var{strict} are interpreted as with the \class{Parser} class constructor. ! ! \versionchanged[The \var{strict} flag was added]{2.2.2} \end{funcdesc} ! \begin{funcdesc}{message_from_file}{fp\optional{, _class\optional{, strict}}} ! Return a message object structure tree from an open file object. This ! is exactly equivalent to \code{Parser().parse(fp)}. Optional ! \var{_class} and \var{strict} are interpreted as with the ! \class{Parser} class constructor. ! ! \versionchanged[The \var{strict} flag was added]{2.2.2} \end{funcdesc} *************** *** 100,113 **** \item Most non-\mimetype{multipart} type messages are parsed as a single message object with a string payload. These objects will return ! 0 for \method{is_multipart()}. ! \item One exception is for \mimetype{message/delivery-status} type ! messages. Because the body of such messages consist of ! blocks of headers, \class{Parser} will create a non-multipart ! object containing non-multipart subobjects for each header ! block. ! \item Another exception is for \mimetype{message/*} types (more ! general than \mimetype{message/delivery-status}). These are ! typically \mimetype{message/rfc822} messages, represented as a ! non-multipart object containing a singleton payload which is ! another non-multipart \class{Message} instance. \end{itemize} --- 134,152 ---- \item Most non-\mimetype{multipart} type messages are parsed as a single message object with a string payload. These objects will return ! \code{False} for \method{is_multipart()}. Their ! \method{get_payload()} method will return a string object. ! ! \item All \mimetype{multipart} type messages will be parsed as a ! container message object with a list of sub-message objects for ! their payload. The outer container message will return ! \code{True} for \method{is_multipart()} and their ! \method{get_payload()} method will return the list of ! \class{Message} subparts. ! ! \item Most messages with a content type of \mimetype{message/*} ! (e.g. \mimetype{message/deliver-status} and ! \mimetype{message/rfc822}) will also be parsed as container ! object containing a list payload of length 1. Their ! \method{is_multipart()} method will return \code{True}. The ! single element in the list payload will be a sub-message object. \end{itemize} Index: emailmessage.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmessage.tex,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** emailmessage.tex 22 May 2002 20:44:03 -0000 1.5 --- emailmessage.tex 28 Apr 2003 17:37:50 -0000 1.5.2.1 *************** *** 13,22 **** Headers are stored and returned in case-preserving form but are ! matched case-insensitively. There may also be a single ! \emph{Unix-From} header, also known as the envelope header or the \code{From_} header. The payload is either a string in the case of ! simple message objects, a list of \class{Message} objects for ! multipart MIME documents, or a single \class{Message} instance for ! \mimetype{message/rfc822} type objects. \class{Message} objects provide a mapping style interface for --- 13,22 ---- Headers are stored and returned in case-preserving form but are ! matched case-insensitively. There may also be a single envelope ! header, also known as the \emph{Unix-From} header or the \code{From_} header. The payload is either a string in the case of ! simple message objects or a list of \class{Message} objects for ! MIME container documents (e.g. \mimetype{multipart/*} and ! \mimetype{message/rfc822}). \class{Message} objects provide a mapping style interface for *************** *** 34,129 **** \begin{methoddesc}[Message]{as_string}{\optional{unixfrom}} ! Return the entire formatted message as a string. Optional ! \var{unixfrom}, when true, specifies to include the \emph{Unix-From} ! envelope header; it defaults to 0. \end{methoddesc} \begin{methoddesc}[Message]{__str__}{} ! Equivalent to \method{aMessage.as_string(unixfrom=1)}. \end{methoddesc} \begin{methoddesc}[Message]{is_multipart}{} ! Return 1 if the message's payload is a list of sub-\class{Message} ! objects, otherwise return 0. When \method{is_multipart()} returns 0, ! the payload should either be a string object, or a single ! \class{Message} instance. \end{methoddesc} \begin{methoddesc}[Message]{set_unixfrom}{unixfrom} ! Set the \emph{Unix-From} (a.k.a envelope header or \code{From_} ! header) to \var{unixfrom}, which should be a string. \end{methoddesc} \begin{methoddesc}[Message]{get_unixfrom}{} ! Return the \emph{Unix-From} header. Defaults to \code{None} if the ! \emph{Unix-From} header was never set. ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{add_payload}{payload} ! Add \var{payload} to the message object's existing payload. If, prior ! to calling this method, the object's payload was \code{None} ! (i.e. never before set), then after this method is called, the payload ! will be the argument \var{payload}. ! ! If the object's payload was already a list ! (i.e. \method{is_multipart()} returns 1), then \var{payload} is ! appended to the end of the existing payload list. ! ! For any other type of existing payload, \method{add_payload()} will ! transform the new payload into a list consisting of the old payload ! and \var{payload}, but only if the document is already a MIME ! multipart document. This condition is satisfied if the message's ! \mailheader{Content-Type} header's main type is either ! \mimetype{multipart}, or there is no \mailheader{Content-Type} ! header. In any other situation, ! \exception{MultipartConversionError} is raised. \end{methoddesc} \begin{methoddesc}[Message]{attach}{payload} ! Synonymous with \method{add_payload()}. \end{methoddesc} \begin{methoddesc}[Message]{get_payload}{\optional{i\optional{, decode}}} ! Return the current payload, which will be a list of \class{Message} ! objects when \method{is_multipart()} returns 1, or a scalar (either a ! string or a single \class{Message} instance) when ! \method{is_multipart()} returns 0. ! With optional \var{i}, \method{get_payload()} will return the \var{i}-th element of the payload, counting from zero, if ! \method{is_multipart()} returns 1. An \exception{IndexError} will be raised ! if \var{i} is less than 0 or greater than or equal to the number of ! items in the payload. If the payload is scalar ! (i.e. \method{is_multipart()} returns 0) and \var{i} is given, a \exception{TypeError} is raised. Optional \var{decode} is a flag indicating whether the payload should be decoded or not, according to the \mailheader{Content-Transfer-Encoding} header. ! When true and the message is not a multipart, the payload will be decoded if this header's value is \samp{quoted-printable} or \samp{base64}. If some other encoding is used, or \mailheader{Content-Transfer-Encoding} header is ! missing, the payload is returned as-is (undecoded). If the message is ! a multipart and the \var{decode} flag is true, then \code{None} is ! returned. \end{methoddesc} ! \begin{methoddesc}[Message]{set_payload}{payload} Set the entire message object's payload to \var{payload}. It is the ! client's responsibility to ensure the payload invariants. \end{methoddesc} The following methods implement a mapping-like interface for accessing ! the message object's \rfc{2822} headers. Note that there are some semantic differences between these methods and a normal mapping (i.e. dictionary) interface. For example, in a dictionary there are no duplicate keys, but here there may be duplicate message headers. Also, in dictionaries there is no guaranteed order to the keys returned by ! \method{keys()}, but in a \class{Message} object, there is an explicit ! order. These semantic differences are intentional and are biased ! toward maximal convenience. ! Note that in all cases, any optional \emph{Unix-From} header the message ! may have is not included in the mapping interface. \begin{methoddesc}[Message]{__len__}{} --- 34,162 ---- \begin{methoddesc}[Message]{as_string}{\optional{unixfrom}} ! Return the entire message flatten as a string. When optional ! \var{unixfrom} is \code{True}, the envelope header is included in the ! returned string. \var{unixfrom} defaults to \code{False}. ! ! Note that this method is provided as a convenience and may not always ! format the message the way you want. For more flexibility, ! instantiate a \class{Generator} instance and use its ! \method{flatten()} method directly. For example: ! ! \begin{verbatim} ! from cStringIO import StringIO ! from email.Generator import Generator ! fp = StringIO() ! g = Generator(mangle_from_=False, maxheaderlen=60) ! g.flatten(msg) ! text = fp.getvalue() ! \end{verbatim} \end{methoddesc} \begin{methoddesc}[Message]{__str__}{} ! Equivalent to \method{as_string(unixfrom=True)}. \end{methoddesc} \begin{methoddesc}[Message]{is_multipart}{} ! Return \code{True} if the message's payload is a list of ! sub-\class{Message} objects, otherwise return \code{False}. When ! \method{is_multipart()} returns False, the payload should be a string ! object. \end{methoddesc} \begin{methoddesc}[Message]{set_unixfrom}{unixfrom} ! Set the message's envelope header to \var{unixfrom}, which should be a string. \end{methoddesc} \begin{methoddesc}[Message]{get_unixfrom}{} ! Return the message's envelope header. Defaults to \code{None} if the ! envelope header was never set. \end{methoddesc} \begin{methoddesc}[Message]{attach}{payload} ! Add the given \var{payload} to the current payload, which must be ! \code{None} or a list of \class{Message} objects before the call. ! After the call, the payload will always be a list of \class{Message} ! objects. If you want to set the payload to a scalar object (e.g. a ! string), use \method{set_payload()} instead. \end{methoddesc} \begin{methoddesc}[Message]{get_payload}{\optional{i\optional{, decode}}} ! Return a reference the current payload, which will be a list of ! \class{Message} objects when \method{is_multipart()} is \code{True}, or a ! string when \method{is_multipart()} is \code{False}. If the ! payload is a list and you mutate the list object, you modify the ! message's payload in place. ! With optional argument \var{i}, \method{get_payload()} will return the \var{i}-th element of the payload, counting from zero, if ! \method{is_multipart()} is \code{True}. An \exception{IndexError} ! will be raised if \var{i} is less than 0 or greater than or equal to ! the number of items in the payload. If the payload is a string ! (i.e. \method{is_multipart()} is \code{False}) and \var{i} is given, a \exception{TypeError} is raised. Optional \var{decode} is a flag indicating whether the payload should be decoded or not, according to the \mailheader{Content-Transfer-Encoding} header. ! When \code{True} and the message is not a multipart, the payload will be decoded if this header's value is \samp{quoted-printable} or \samp{base64}. If some other encoding is used, or \mailheader{Content-Transfer-Encoding} header is ! missing, or if the payload has bogus base64 data, the payload is ! returned as-is (undecoded). If the message is a multipart and the ! \var{decode} flag is \code{True}, then \code{None} is returned. The ! default for \var{decode} is \code{False}. \end{methoddesc} ! \begin{methoddesc}[Message]{set_payload}{payload\optional{, charset}} Set the entire message object's payload to \var{payload}. It is the ! client's responsibility to ensure the payload invariants. Optional ! \var{charset} sets the message's default character set; see ! \method{set_charset()} for details. ! ! \versionchanged[\var{charset} argument added]{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{set_charset}{charset} ! Set the character set of the payload to \var{charset}, which can ! either be a \class{Charset} instance (see \refmodule{email.Charset}), a ! string naming a character set, ! or \code{None}. If it is a string, it will be converted to a ! \class{Charset} instance. If \var{charset} is \code{None}, the ! \code{charset} parameter will be removed from the ! \mailheader{Content-Type} header. Anything else will generate a ! \exception{TypeError}. ! ! The message will be assumed to be of type \mimetype{text/*} encoded with ! \code{charset.input_charset}. It will be converted to ! \code{charset.output_charset} ! and encoded properly, if needed, when generating the plain text ! representation of the message. MIME headers ! (\mailheader{MIME-Version}, \mailheader{Content-Type}, ! \mailheader{Content-Transfer-Encoding}) will be added as needed. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{get_charset}{} ! Return the \class{Charset} instance associated with the message's payload. ! \versionadded{2.2.2} \end{methoddesc} The following methods implement a mapping-like interface for accessing ! the message's \rfc{2822} headers. Note that there are some semantic differences between these methods and a normal mapping (i.e. dictionary) interface. For example, in a dictionary there are no duplicate keys, but here there may be duplicate message headers. Also, in dictionaries there is no guaranteed order to the keys returned by ! \method{keys()}, but in a \class{Message} object, headers are always ! returned in the order they appeared in the original message, or were ! added to the message later. Any header deleted and then re-added are ! always appended to the end of the header list. ! These semantic differences are intentional and are biased toward ! maximal convenience. ! ! Note that in all cases, any envelope header present in the message is ! not included in the mapping interface. \begin{methoddesc}[Message]{__len__}{} *************** *** 162,167 **** with the same name. If you want to ensure that the new header is the only one present in the message with field name ! \var{name}, first use \method{__delitem__()} to delete all named ! fields, e.g.: \begin{verbatim} --- 195,199 ---- with the same name. If you want to ensure that the new header is the only one present in the message with field name ! \var{name}, delete the field first, e.g.: \begin{verbatim} *************** *** 178,207 **** \begin{methoddesc}[Message]{has_key}{name} ! Return 1 if the message contains a header field named \var{name}, ! otherwise return 0. \end{methoddesc} \begin{methoddesc}[Message]{keys}{} ! Return a list of all the message's header field names. These keys ! will be sorted in the order in which they were added to the message ! via \method{__setitem__()}, and may contain duplicates. Any fields ! deleted and then subsequently re-added are always appended to the end ! of the header list. \end{methoddesc} \begin{methoddesc}[Message]{values}{} ! Return a list of all the message's field values. These will be sorted ! in the order in which they were added to the message via ! \method{__setitem__()}, and may contain duplicates. Any fields ! deleted and then subsequently re-added are always appended to the end ! of the header list. \end{methoddesc} \begin{methoddesc}[Message]{items}{} ! Return a list of 2-tuples containing all the message's field headers and ! values. These will be sorted in the order in which they were added to ! the message via \method{__setitem__()}, and may contain duplicates. ! Any fields deleted and then subsequently re-added are always appended ! to the end of the header list. \end{methoddesc} --- 210,228 ---- \begin{methoddesc}[Message]{has_key}{name} ! Return true if the message contains a header field named \var{name}, ! otherwise return false. \end{methoddesc} \begin{methoddesc}[Message]{keys}{} ! Return a list of all the message's header field names. \end{methoddesc} \begin{methoddesc}[Message]{values}{} ! Return a list of all the message's field values. \end{methoddesc} \begin{methoddesc}[Message]{items}{} ! Return a list of 2-tuples containing all the message's field headers ! and values. \end{methoddesc} *************** *** 215,224 **** \begin{methoddesc}[Message]{get_all}{name\optional{, failobj}} ! Return a list of all the values for the field named \var{name}. These ! will be sorted in the order in which they were added to the message ! via \method{__setitem__()}. Any fields ! deleted and then subsequently re-added are always appended to the end ! of the list. ! If there are no such named headers in the message, \var{failobj} is returned (defaults to \code{None}). --- 236,240 ---- \begin{methoddesc}[Message]{get_all}{name\optional{, failobj}} ! Return a list of all the values for the field named \var{name}. If there are no such named headers in the message, \var{failobj} is returned (defaults to \code{None}). *************** *** 228,233 **** Extended header setting. This method is similar to \method{__setitem__()} except that additional header parameters can be ! provided as keyword arguments. \var{_name} is the header to set and ! \var{_value} is the \emph{primary} value for the header. For each item in the keyword argument dictionary \var{_params}, the --- 244,249 ---- Extended header setting. This method is similar to \method{__setitem__()} except that additional header parameters can be ! provided as keyword arguments. \var{_name} is the header field to add ! and \var{_value} is the \emph{primary} value for the header. For each item in the keyword argument dictionary \var{_params}, the *************** *** 250,276 **** \end{methoddesc} ! \begin{methoddesc}[Message]{get_type}{\optional{failobj}} ! Return the message's content type, as a string of the form ! \mimetype{maintype/subtype} as taken from the ! \mailheader{Content-Type} header. ! The returned string is coerced to lowercase. ! If there is no \mailheader{Content-Type} header in the message, ! \var{failobj} is returned (defaults to \code{None}). \end{methoddesc} ! \begin{methoddesc}[Message]{get_main_type}{\optional{failobj}} ! Return the message's \emph{main} content type. This essentially returns the ! \var{maintype} part of the string returned by \method{get_type()}, with the ! same semantics for \var{failobj}. \end{methoddesc} ! \begin{methoddesc}[Message]{get_subtype}{\optional{failobj}} ! Return the message's sub-content type. This essentially returns the ! \var{subtype} part of the string returned by \method{get_type()}, with the ! same semantics for \var{failobj}. \end{methoddesc} ! \begin{methoddesc}[Message]{get_params}{\optional{failobj\optional{, header}}} Return the message's \mailheader{Content-Type} parameters, as a list. The elements of the returned list are 2-tuples of key/value pairs, as --- 266,330 ---- \end{methoddesc} ! \begin{methoddesc}[Message]{replace_header}{_name, _value} ! Replace a header. Replace the first header found in the message that ! matches \var{_name}, retaining header order and field name case. If ! no matching header was found, a \exception{KeyError} is raised. ! \versionadded{2.2.2} \end{methoddesc} ! \begin{methoddesc}[Message]{get_content_type}{} ! Return the message's content type. The returned string is coerced to ! lower case of the form \mimetype{maintype/subtype}. If there was no ! \mailheader{Content-Type} header in the message the default type as ! given by \method{get_default_type()} will be returned. Since ! according to \rfc{2045}, messages always have a default type, ! \method{get_content_type()} will always return a value. ! ! \rfc{2045} defines a message's default type to be ! \mimetype{text/plain} unless it appears inside a ! \mimetype{multipart/digest} container, in which case it would be ! \mimetype{message/rfc822}. If the \mailheader{Content-Type} header ! has an invalid type specification, \rfc{2045} mandates that the ! default type be \mimetype{text/plain}. ! ! \versionadded{2.2.2} \end{methoddesc} ! \begin{methoddesc}[Message]{get_content_maintype}{} ! Return the message's main content type. This is the ! \mimetype{maintype} part of the string returned by ! \method{get_content_type()}. ! ! \versionadded{2.2.2} \end{methoddesc} ! \begin{methoddesc}[Message]{get_content_subtype}{} ! Return the message's sub-content type. This is the \mimetype{subtype} ! part of the string returned by \method{get_content_type()}. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{get_default_type}{} ! Return the default content type. Most messages have a default content ! type of \mimetype{text/plain}, except for messages that are subparts ! of \mimetype{multipart/digest} containers. Such subparts have a ! default content type of \mimetype{message/rfc822}. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{set_default_type}{ctype} ! Set the default content type. \var{ctype} should either be ! \mimetype{text/plain} or \mimetype{message/rfc822}, although this is ! not enforced. The default content type is not stored in the ! \mailheader{Content-Type} header. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{get_params}{\optional{failobj\optional{, ! header\optional{, unquote}}}} Return the message's \mailheader{Content-Type} parameters, as a list. The elements of the returned list are 2-tuples of key/value pairs, as *************** *** 278,290 **** \character{=} is the key, while the right hand side is the value. If there is no \character{=} sign in the parameter the value is the empty ! string. The value is always unquoted with \method{Utils.unquote()}. Optional \var{failobj} is the object to return if there is no \mailheader{Content-Type} header. Optional \var{header} is the header to search instead of \mailheader{Content-Type}. \end{methoddesc} \begin{methoddesc}[Message]{get_param}{param\optional{, ! failobj\optional{, header}}} Return the value of the \mailheader{Content-Type} header's parameter \var{param} as a string. If the message has no \mailheader{Content-Type} --- 332,347 ---- \character{=} is the key, while the right hand side is the value. If there is no \character{=} sign in the parameter the value is the empty ! string, otherwise the value is as described in \method{get_param()} and is ! unquoted if optional \var{unquote} is \code{True} (the default). Optional \var{failobj} is the object to return if there is no \mailheader{Content-Type} header. Optional \var{header} is the header to search instead of \mailheader{Content-Type}. + + \versionchanged[\var{unquote} argument added]{2.2.2} \end{methoddesc} \begin{methoddesc}[Message]{get_param}{param\optional{, ! failobj\optional{, header\optional{, unquote}}}} Return the value of the \mailheader{Content-Type} header's parameter \var{param} as a string. If the message has no \mailheader{Content-Type} *************** *** 294,311 **** Optional \var{header} if given, specifies the message header to use instead of \mailheader{Content-Type}. \end{methoddesc} ! \begin{methoddesc}[Message]{get_charsets}{\optional{failobj}} ! Return a list containing the character set names in the message. If ! the message is a \mimetype{multipart}, then the list will contain one ! element for each subpart in the payload, otherwise, it will be a list ! of length 1. ! Each item in the list will be a string which is the value of the ! \code{charset} parameter in the \mailheader{Content-Type} header for the ! represented subpart. However, if the subpart has no ! \mailheader{Content-Type} header, no \code{charset} parameter, or is not of ! the \mimetype{text} main MIME type, then that item in the returned list ! will be \var{failobj}. \end{methoddesc} --- 351,428 ---- Optional \var{header} if given, specifies the message header to use instead of \mailheader{Content-Type}. + + Parameter keys are always compared case insensitively. The return + value can either be a string, or a 3-tuple if the parameter was + \rfc{2231} encoded. When it's a 3-tuple, the elements of the value are of + the form \code{(CHARSET, LANGUAGE, VALUE)}, where \code{LANGUAGE} may + be the empty string. Your application should be prepared to deal with + 3-tuple return values, which it can convert to a Unicode string like + so: + + \begin{verbatim} + param = msg.get_param('foo') + if isinstance(param, tuple): + param = unicode(param[2], param[0]) + \end{verbatim} + + In any case, the parameter value (either the returned string, or the + \code{VALUE} item in the 3-tuple) is always unquoted, unless + \var{unquote} is set to \code{False}. + + \versionchanged[\var{unquote} argument added, and 3-tuple return value + possible]{2.2.2} \end{methoddesc} ! \begin{methoddesc}[Message]{set_param}{param, value\optional{, ! header\optional{, requote\optional{, charset\optional{, language}}}}} ! Set a parameter in the \mailheader{Content-Type} header. If the ! parameter already exists in the header, its value will be replaced ! with \var{value}. If the \mailheader{Content-Type} header as not yet ! been defined for this message, it will be set to \mimetype{text/plain} ! and the new parameter value will be appended as per \rfc{2045}. ! ! Optional \var{header} specifies an alternative header to ! \mailheader{Content-Type}, and all parameters will be quoted as ! necessary unless optional \var{requote} is \code{False} (the default ! is \code{True}). ! ! If optional \var{charset} is specified, the parameter will be encoded ! according to \rfc{2231}. Optional \var{language} specifies the RFC ! 2231 language, defaulting to the empty string. Both \var{charset} and ! \var{language} should be strings. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{del_param}{param\optional{, header\optional{, ! requote}}} ! Remove the given parameter completely from the ! \mailheader{Content-Type} header. The header will be re-written in ! place without the parameter or its value. All values will be quoted ! as necessary unless \var{requote} is \code{False} (the default is ! \code{True}). Optional \var{header} specifies an alternative to ! \mailheader{Content-Type}. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Message]{set_type}{type\optional{, header}\optional{, ! requote}} ! Set the main type and subtype for the \mailheader{Content-Type} ! header. \var{type} must be a string in the form ! \mimetype{maintype/subtype}, otherwise a \exception{ValueError} is ! raised. ! ! This method replaces the \mailheader{Content-Type} header, keeping all ! the parameters in place. If \var{requote} is \code{False}, this ! leaves the existing header's quoting as is, otherwise the parameters ! will be quoted (the default). ! ! An alternative header can be specified in the \var{header} argument. ! When the \mailheader{Content-Type} header is set a ! \mailheader{MIME-Version} header is also added. ! ! \versionadded{2.2.2} \end{methoddesc} *************** *** 327,335 **** \begin{methoddesc}[Message]{set_boundary}{boundary} ! Set the \code{boundary} parameter of the \mailheader{Content-Type} header ! to \var{boundary}. \method{set_boundary()} will always quote ! \var{boundary} so you should not quote it yourself. A ! \exception{HeaderParseError} is raised if the message object has no ! \mailheader{Content-Type} header. Note that using this method is subtly different than deleting the old --- 444,451 ---- \begin{methoddesc}[Message]{set_boundary}{boundary} ! Set the \code{boundary} parameter of the \mailheader{Content-Type} ! header to \var{boundary}. \method{set_boundary()} will always quote ! \var{boundary} if necessary. A \exception{HeaderParseError} is raised ! if the message object has no \mailheader{Content-Type} header. Note that using this method is subtly different than deleting the old *************** *** 341,357 **** \end{methoddesc} \begin{methoddesc}[Message]{walk}{} The \method{walk()} method is an all-purpose generator which can be used to iterate over all the parts and subparts of a message object tree, in depth-first traversal order. You will typically use ! \method{walk()} as the iterator in a \code{for ... in} loop; each iteration returns the next subpart. ! Here's an example that prints the MIME type of every part of a message ! object tree: \begin{verbatim} >>> for part in msg.walk(): ! >>> print part.get_type('text/plain') multipart/report text/plain --- 457,500 ---- \end{methoddesc} + \begin{methoddesc}[Message]{get_content_charset}{\optional{failobj}} + Return the \code{charset} parameter of the \mailheader{Content-Type} + header, coerced to lower case. If there is no + \mailheader{Content-Type} header, or if that header has no + \code{charset} parameter, \var{failobj} is returned. + + Note that this method differs from \method{get_charset()} which + returns the \class{Charset} instance for the default encoding of the + message body. + + \versionadded{2.2.2} + \end{methoddesc} + + \begin{methoddesc}[Message]{get_charsets}{\optional{failobj}} + Return a list containing the character set names in the message. If + the message is a \mimetype{multipart}, then the list will contain one + element for each subpart in the payload, otherwise, it will be a list + of length 1. + + Each item in the list will be a string which is the value of the + \code{charset} parameter in the \mailheader{Content-Type} header for the + represented subpart. However, if the subpart has no + \mailheader{Content-Type} header, no \code{charset} parameter, or is not of + the \mimetype{text} main MIME type, then that item in the returned list + will be \var{failobj}. + \end{methoddesc} + \begin{methoddesc}[Message]{walk}{} The \method{walk()} method is an all-purpose generator which can be used to iterate over all the parts and subparts of a message object tree, in depth-first traversal order. You will typically use ! \method{walk()} as the iterator in a \code{for} loop; each iteration returns the next subpart. ! Here's an example that prints the MIME type of every part of a ! multipart message structure: \begin{verbatim} >>> for part in msg.walk(): ! >>> print part.get_content_type() multipart/report text/plain *************** *** 381,385 **** is writing out the plain text representation of a MIME message, and it finds the message has a \var{preamble} attribute, it will write this ! text in the area between the headers and the first boundary. Note that if the message object has no preamble, the --- 524,529 ---- is writing out the plain text representation of a MIME message, and it finds the message has a \var{preamble} attribute, it will write this ! text in the area between the headers and the first boundary. See ! \refmodule{email.Parser} and \refmodule{email.Generator} for details. Note that if the message object has no preamble, the *************** *** 402,403 **** --- 546,603 ---- set the \var{epilogue} to the empty string. \end{datadesc} + + \subsubsection{Deprecated methods} + + The following methods are deprecated in \module{email} version 2. + They are documented here for completeness. + + \begin{methoddesc}[Message]{add_payload}{payload} + Add \var{payload} to the message object's existing payload. If, prior + to calling this method, the object's payload was \code{None} + (i.e. never before set), then after this method is called, the payload + will be the argument \var{payload}. + + If the object's payload was already a list + (i.e. \method{is_multipart()} returns 1), then \var{payload} is + appended to the end of the existing payload list. + + For any other type of existing payload, \method{add_payload()} will + transform the new payload into a list consisting of the old payload + and \var{payload}, but only if the document is already a MIME + multipart document. This condition is satisfied if the message's + \mailheader{Content-Type} header's main type is either + \mimetype{multipart}, or there is no \mailheader{Content-Type} + header. In any other situation, + \exception{MultipartConversionError} is raised. + + \deprecated{2.2.2}{Use the \method{attach()} method instead.} + \end{methoddesc} + + \begin{methoddesc}[Message]{get_type}{\optional{failobj}} + Return the message's content type, as a string of the form + \mimetype{maintype/subtype} as taken from the + \mailheader{Content-Type} header. + The returned string is coerced to lowercase. + + If there is no \mailheader{Content-Type} header in the message, + \var{failobj} is returned (defaults to \code{None}). + + \deprecated{2.2.2}{Use the \method{get_content_type()} method instead.} + \end{methoddesc} + + \begin{methoddesc}[Message]{get_main_type}{\optional{failobj}} + Return the message's \emph{main} content type. This essentially returns the + \var{maintype} part of the string returned by \method{get_type()}, with the + same semantics for \var{failobj}. + + \deprecated{2.2.2}{Use the \method{get_content_maintype()} method instead.} + \end{methoddesc} + + \begin{methoddesc}[Message]{get_subtype}{\optional{failobj}} + Return the message's sub-content type. This essentially returns the + \var{subtype} part of the string returned by \method{get_type()}, with the + same semantics for \var{failobj}. + + \deprecated{2.2.2}{Use the \method{get_content_subtype()} method instead.} + \end{methoddesc} + Index: emailiter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailiter.tex,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -C2 -d -r1.2 -r1.2.14.1 *** emailiter.tex 26 Sep 2001 22:21:52 -0000 1.2 --- emailiter.tex 28 Apr 2003 17:37:51 -0000 1.2.14.1 *************** *** 7,11 **** trees. ! \begin{funcdesc}{body_line_iterator}{msg} This iterates over all the payloads in all the subparts of \var{msg}, returning the string payloads line-by-line. It skips over all the --- 7,11 ---- trees. ! \begin{funcdesc}{body_line_iterator}{msg\optional{, decode}} This iterates over all the payloads in all the subparts of \var{msg}, returning the string payloads line-by-line. It skips over all the *************** *** 14,17 **** --- 14,19 ---- flat text representation of the message from a file using \method{readline()}, skipping over all the intervening headers. + + Optional \var{decode} is passed through to \method{Message.get_payload()}. \end{funcdesc} *************** *** 30,31 **** --- 32,65 ---- \end{funcdesc} + The following function has been added as a useful debugging tool. It + should \emph{not} be considered part of the supported public interface + for the package. + + \begin{funcdesc}{_structure}{msg\optional{, fp\optional{, level}}} + Prints an indented representation of the content types of the + message object structure. For example: + + \begin{verbatim} + >>> msg = email.message_from_file(somefile) + >>> _structure(msg) + multipart/mixed + text/plain + text/plain + multipart/digest + message/rfc822 + text/plain + message/rfc822 + text/plain + message/rfc822 + text/plain + message/rfc822 + text/plain + message/rfc822 + text/plain + text/plain + \end{verbatim} + + Optional \var{fp} is a file-like object to print the output to. It + must be suitable for Python's extended print statement. \var{level} + is used internally. + \end{funcdesc} Index: emailgenerator.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailgenerator.tex,v retrieving revision 1.3 retrieving revision 1.3.10.1 diff -C2 -d -r1.3 -r1.3.10.1 *** emailgenerator.tex 5 Nov 2001 01:55:03 -0000 1.3 --- emailgenerator.tex 28 Apr 2003 17:37:52 -0000 1.3.10.1 *************** *** 1,10 **** \declaremodule{standard}{email.Generator} ! \modulesynopsis{Generate flat text email messages from a message object tree.} One of the most common tasks is to generate the flat text of the email ! message represented by a message object tree. You will need to do this if you want to send your message via the \refmodule{smtplib} module or the \refmodule{nntplib} module, or print the message on the ! console. Taking a message object tree and producing a flat text document is the job of the \class{Generator} class. --- 1,10 ---- \declaremodule{standard}{email.Generator} ! \modulesynopsis{Generate flat text email messages from a message structure.} One of the most common tasks is to generate the flat text of the email ! message represented by a message object structure. You will need to do this if you want to send your message via the \refmodule{smtplib} module or the \refmodule{nntplib} module, or print the message on the ! console. Taking a message object structure and producing a flat text document is the job of the \class{Generator} class. *************** *** 14,21 **** generate most email in a standards-compliant way, should handle MIME and non-MIME email messages just fine, and is designed so that the ! transformation from flat text, to an object tree via the ! \class{Parser} class, ! and back to flat text, is idempotent (the input is identical to the ! output). Here are the public methods of the \class{Generator} class: --- 14,20 ---- generate most email in a standards-compliant way, should handle MIME and non-MIME email messages just fine, and is designed so that the ! transformation from flat text, to a message structure via the ! \class{Parser} class, and back to flat text, is idempotent (the input ! is identical to the output). Here are the public methods of the \class{Generator} class: *************** *** 26,39 **** object called \var{outfp} for an argument. \var{outfp} must support the \method{write()} method and be usable as the output file in a ! Python 2.0 extended print statement. ! Optional \var{mangle_from_} is a flag that, when true, puts a \samp{>} ! character in front of any line in the body that starts exactly as ! \samp{From } (i.e. \code{From} followed by a space at the front of the ! line). This is the only guaranteed portable way to avoid having such ! lines be mistaken for \emph{Unix-From} headers (see \ulink{WHY THE CONTENT-LENGTH FORMAT IS BAD} {http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html} ! for details). Optional \var{maxheaderlen} specifies the longest length for a --- 25,40 ---- object called \var{outfp} for an argument. \var{outfp} must support the \method{write()} method and be usable as the output file in a ! Python extended print statement. ! Optional \var{mangle_from_} is a flag that, when \code{True}, puts a ! \samp{>} character in front of any line in the body that starts exactly as ! \samp{From }, i.e. \code{From} followed by a space at the beginning of the ! line. This is the only guaranteed portable way to avoid having such ! lines be mistaken for a Unix mailbox format envelope header separator (see \ulink{WHY THE CONTENT-LENGTH FORMAT IS BAD} {http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html} ! for details). \var{mangle_from_} defaults to \code{True}, but you ! might want to set this to \code{False} if you are not writing Unix ! mailbox format files. Optional \var{maxheaderlen} specifies the longest length for a *************** *** 48,65 **** The other public \class{Generator} methods are: ! \begin{methoddesc}[Generator]{__call__}{msg\optional{, unixfrom}} ! Print the textual representation of the message object tree rooted at \var{msg} to the output file specified when the \class{Generator} ! instance was created. Sub-objects are visited depth-first and the resulting text will be properly MIME encoded. Optional \var{unixfrom} is a flag that forces the printing of the ! \emph{Unix-From} (a.k.a. envelope header or \code{From_} header) ! delimiter before the first \rfc{2822} header of the root message ! object. If the root object has no \emph{Unix-From} header, a standard ! one is crafted. By default, this is set to 0 to inhibit the printing ! of the \emph{Unix-From} delimiter. ! Note that for sub-objects, no \emph{Unix-From} header is ever printed. \end{methoddesc} --- 49,74 ---- The other public \class{Generator} methods are: ! \begin{methoddesc}[Generator]{flatten}{msg\optional{, unixfrom}} ! Print the textual representation of the message object structure rooted at \var{msg} to the output file specified when the \class{Generator} ! instance was created. Subparts are visited depth-first and the resulting text will be properly MIME encoded. Optional \var{unixfrom} is a flag that forces the printing of the ! envelope header delimiter before the first \rfc{2822} header of the ! root message object. If the root object has no envelope header, a ! standard one is crafted. By default, this is set to \code{False} to ! inhibit the printing of the envelope delimiter. ! Note that for subparts, no envelope header is ever printed. ! ! \versionadded{2.2.2} ! \end{methoddesc} ! ! \begin{methoddesc}[Generator]{clone}{fp} ! Return an independent clone of this \class{Generator} instance with ! the exact same options. ! ! \versionadded{2.2.2} \end{methoddesc} *************** *** 75,76 **** --- 84,141 ---- simplify the generation of a formatted string representation of a message object. For more detail, see \refmodule{email.Message}. + + The \module{email.Generator} module also provides a derived class, + called \class{DecodedGenerator} which is like the \class{Generator} + base class, except that non-\mimetype{text} parts are substituted with + a format string representing the part. + + \begin{classdesc}{DecodedGenerator}{outfp\optional{, mangle_from_\optional{, + maxheaderlen\optional{, fmt}}}} + + This class, derived from \class{Generator} walks through all the + subparts of a message. If the subpart is of main type + \mimetype{text}, then it prints the decoded payload of the subpart. + Optional \var{_mangle_from_} and \var{maxheaderlen} are as with the + \class{Generator} base class. + + If the subpart is not of main type \mimetype{text}, optional \var{fmt} + is a format string that is used instead of the message payload. + \var{fmt} is expanded with the following keywords, \samp{\%(keyword)s} + format: + + \begin{itemize} + \item \code{type} -- Full MIME type of the non-\mimetype{text} part + + \item \code{maintype} -- Main MIME type of the non-\mimetype{text} part + + \item \code{subtype} -- Sub-MIME type of the non-\mimetype{text} part + + \item \code{filename} -- Filename of the non-\mimetype{text} part + + \item \code{description} -- Description associated with the + non-\mimetype{text} part + + \item \code{encoding} -- Content transfer encoding of the + non-\mimetype{text} part + + \end{itemize} + + The default value for \var{fmt} is \code{None}, meaning + + \begin{verbatim} + [Non-text (%(type)s) part of message omitted, filename %(filename)s] + \end{verbatim} + + \versionadded{2.2.2} + \end{classdesc} + + \subsubsection{Deprecated methods} + + The following methods are deprecated in \module{email} version 2. + They are documented here for completeness. + + \begin{methoddesc}[Generator]{__call__}{msg\optional{, unixfrom}} + This method is identical to the \method{flatten()} method. + + \deprecated{2.2.2}{Use the \method{flatten()} method instead.} + \end{methoddesc} Index: emailexc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailexc.tex,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -C2 -d -r1.2 -r1.2.14.1 *** emailexc.tex 26 Sep 2001 22:21:52 -0000 1.2 --- emailexc.tex 28 Apr 2003 17:37:53 -0000 1.2.14.1 *************** *** 22,26 **** \method{Parser.parsestr()} methods. ! Situations where it can be raised include finding a \emph{Unix-From} header after the first \rfc{2822} header of the message, finding a continuation line before the first \rfc{2822} header is found, or finding --- 22,26 ---- \method{Parser.parsestr()} methods. ! Situations where it can be raised include finding an envelope header after the first \rfc{2822} header of the message, finding a continuation line before the first \rfc{2822} header is found, or finding *************** *** 36,40 **** Situations where it can be raised include not being able to find the ! starting or terminating boundary in a \mimetype{multipart/*} message. \end{excclassdesc} --- 36,41 ---- Situations where it can be raised include not being able to find the ! starting or terminating boundary in a \mimetype{multipart/*} message ! when strict parsing is used. \end{excclassdesc} *************** *** 46,48 **** --- 47,54 ---- multiply inherits from \exception{MessageError} and the built-in \exception{TypeError}. + + Since \method{Message.add_payload()} is deprecated, this exception is + rarely raised in practice. However the exception may also be raised + if the \method{attach()} method is called on an instance of a class + derived from \class{MIMENonMultipart} (e.g. \class{MIMEImage}). \end{excclassdesc} Index: emailencoders.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailencoders.tex,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -C2 -d -r1.2 -r1.2.14.1 *** emailencoders.tex 26 Sep 2001 22:21:52 -0000 1.2 --- emailencoders.tex 28 Apr 2003 17:37:53 -0000 1.2.14.1 *************** *** 18,23 **** \begin{funcdesc}{encode_quopri}{msg} ! Encodes the payload into \emph{Quoted-Printable} form and sets the ! \code{Content-Transfer-Encoding:} header to \code{quoted-printable}\footnote{Note that encoding with \method{encode_quopri()} also encodes all tabs and space characters in --- 18,23 ---- \begin{funcdesc}{encode_quopri}{msg} ! Encodes the payload into quoted-printable form and sets the ! \mailheader{Content-Transfer-Encoding} header to \code{quoted-printable}\footnote{Note that encoding with \method{encode_quopri()} also encodes all tabs and space characters in *************** *** 28,36 **** \begin{funcdesc}{encode_base64}{msg} ! Encodes the payload into \emph{Base64} form and sets the \mailheader{Content-Transfer-Encoding} header to \code{base64}. This is a good encoding to use when most of your payload is unprintable data since it is a more compact form than ! Quoted-Printable. The drawback of Base64 encoding is that it renders the text non-human readable. \end{funcdesc} --- 28,36 ---- \begin{funcdesc}{encode_base64}{msg} ! Encodes the payload into base64 form and sets the \mailheader{Content-Transfer-Encoding} header to \code{base64}. This is a good encoding to use when most of your payload is unprintable data since it is a more compact form than ! quoted-printable. The drawback of base64 encoding is that it renders the text non-human readable. \end{funcdesc} Index: email.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/email.tex,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** email.tex 26 Jun 2002 07:51:32 -0000 1.11 --- email.tex 28 Apr 2003 17:37:54 -0000 1.11.2.1 *************** *** 1,3 **** ! % Copyright (C) 2001 Python Software Foundation % Author: barry@zope.com (Barry Warsaw) --- 1,3 ---- ! % Copyright (C) 2001,2002 Python Software Foundation % Author: barry@zope.com (Barry Warsaw) *************** *** 20,30 **** \module{mimecntl}. It is specifically \emph{not} designed to do any sending of email messages to SMTP (\rfc{2821}) servers; that is the ! function of the \refmodule{smtplib} module\footnote{For this reason, ! line endings in the \module{email} package are always native line ! endings. The \module{smtplib} module is responsible for converting ! from native line endings to \rfc{2821} line endings, just as your mail ! server would be responsible for converting from \rfc{2821} line ! endings to native line endings when it stores messages in a local ! mailbox.}. The primary distinguishing feature of the \module{email} package is --- 20,27 ---- \module{mimecntl}. It is specifically \emph{not} designed to do any sending of email messages to SMTP (\rfc{2821}) servers; that is the ! function of the \refmodule{smtplib} module. The \module{email} ! package attempts to be as RFC-compliant as possible, supporting in ! addition to \rfc{2822}, such MIME-related RFCs as ! \rfc{2045}-\rfc{2047}, and \rfc{2231}. The primary distinguishing feature of the \module{email} package is *************** *** 43,54 **** \module{email} package. The ordering follows a progression that should be common in applications: an email message is read as flat ! text from a file or other source, the text is parsed to produce an ! object model representation of the email message, this model is ! manipulated, and finally the model is rendered back into ! flat text. ! It is perfectly feasible to create the object model out of whole cloth ! --- i.e. completely from scratch. From there, a similar progression ! can be taken as above. Also included are detailed specifications of all the classes and --- 40,50 ---- \module{email} package. The ordering follows a progression that should be common in applications: an email message is read as flat ! text from a file or other source, the text is parsed to produce the ! object structure of the email message, this structure is manipulated, ! and finally rendered back into flat text. ! It is perfectly feasible to create the object structure out of whole ! cloth --- i.e. completely from scratch. From there, a similar ! progression can be taken as above. Also included are detailed specifications of all the classes and *************** *** 56,61 **** classes you might encounter while using the \module{email} package, some auxiliary utilities, and a few examples. For users of the older ! \module{mimelib} package, from which the \module{email} package is ! descended, a section on differences and porting is provided. \begin{seealso} --- 52,57 ---- classes you might encounter while using the \module{email} package, some auxiliary utilities, and a few examples. For users of the older ! \module{mimelib} package, or previous versions of the \module{email} ! package, a section on differences and porting is provided. \begin{seealso} *************** *** 73,215 **** \subsection{Creating email and MIME objects from scratch} ! Ordinarily, you get a message object tree by passing some text to a ! parser, which parses the text and returns the root of the message ! object tree. However you can also build a complete object tree from ! scratch, or even individual \class{Message} objects by hand. In fact, ! you can also take an existing tree and add new \class{Message} ! objects, move them around, etc. This makes a very convenient ! interface for slicing-and-dicing MIME messages. ! ! You can create a new object tree by creating \class{Message} ! instances, adding payloads and all the appropriate headers manually. ! For MIME messages though, the \module{email} package provides some ! convenient classes to make things easier. Each of these classes ! should be imported from a module with the same name as the class, from ! within the \module{email} package. E.g.: ! ! \begin{verbatim} ! import email.MIMEImage.MIMEImage ! \end{verbatim} ! ! or ! ! \begin{verbatim} ! from email.MIMEText import MIMEText ! \end{verbatim} ! ! Here are the classes: ! \begin{classdesc}{MIMEBase}{_maintype, _subtype, **_params} ! This is the base class for all the MIME-specific subclasses of ! \class{Message}. Ordinarily you won't create instances specifically ! of \class{MIMEBase}, although you could. \class{MIMEBase} is provided ! primarily as a convenient base class for more specific MIME-aware ! subclasses. ! \var{_maintype} is the \mailheader{Content-Type} major type ! (e.g. \mimetype{text} or \mimetype{image}), and \var{_subtype} is the ! \mailheader{Content-Type} minor type ! (e.g. \mimetype{plain} or \mimetype{gif}). \var{_params} is a parameter ! key/value dictionary and is passed directly to ! \method{Message.add_header()}. ! The \class{MIMEBase} class always adds a \mailheader{Content-Type} header ! (based on \var{_maintype}, \var{_subtype}, and \var{_params}), and a ! \mailheader{MIME-Version} header (always set to \code{1.0}). ! \end{classdesc} ! \begin{classdesc}{MIMEAudio}{_audiodata\optional{, _subtype\optional{, ! _encoder\optional{, **_params}}}} ! A subclass of \class{MIMEBase}, the \class{MIMEAudio} class is used to ! create MIME message objects of major type \mimetype{audio}. ! \var{_audiodata} is a string containing the raw audio data. If this ! data can be decoded by the standard Python module \refmodule{sndhdr}, ! then the subtype will be automatically included in the ! \mailheader{Content-Type} header. Otherwise you can explicitly specify the ! audio subtype via the \var{_subtype} parameter. If the minor type could ! not be guessed and \var{_subtype} was not given, then \exception{TypeError} ! is raised. ! Optional \var{_encoder} is a callable (i.e. function) which will ! perform the actual encoding of the audio data for transport. This ! callable takes one argument, which is the \class{MIMEAudio} instance. ! It should use \method{get_payload()} and \method{set_payload()} to ! change the payload to encoded form. It should also add any ! \mailheader{Content-Transfer-Encoding} or other headers to the message ! object as necessary. The default encoding is \emph{Base64}. See the ! \refmodule{email.Encoders} module for a list of the built-in encoders. ! \var{_params} are passed straight through to the \class{MIMEBase} ! constructor. ! \end{classdesc} ! \begin{classdesc}{MIMEImage}{_imagedata\optional{, _subtype\optional{, ! _encoder\optional{, **_params}}}} ! A subclass of \class{MIMEBase}, the \class{MIMEImage} class is used to ! create MIME message objects of major type \mimetype{image}. ! \var{_imagedata} is a string containing the raw image data. If this ! data can be decoded by the standard Python module \refmodule{imghdr}, ! then the subtype will be automatically included in the ! \mailheader{Content-Type} header. Otherwise you can explicitly specify the ! image subtype via the \var{_subtype} parameter. If the minor type could ! not be guessed and \var{_subtype} was not given, then \exception{TypeError} ! is raised. ! Optional \var{_encoder} is a callable (i.e. function) which will ! perform the actual encoding of the image data for transport. This ! callable takes one argument, which is the \class{MIMEImage} instance. ! It should use \method{get_payload()} and \method{set_payload()} to ! change the payload to encoded form. It should also add any ! \mailheader{Content-Transfer-Encoding} or other headers to the message ! object as necessary. The default encoding is \emph{Base64}. See the ! \refmodule{email.Encoders} module for a list of the built-in encoders. ! \var{_params} are passed straight through to the \class{MIMEBase} ! constructor. ! \end{classdesc} ! \begin{classdesc}{MIMEText}{_text\optional{, _subtype\optional{, ! _charset\optional{, _encoder}}}} ! A subclass of \class{MIMEBase}, the \class{MIMEText} class is used to ! create MIME objects of major type \mimetype{text}. \var{_text} is the ! string for the payload. \var{_subtype} is the minor type and defaults ! to \mimetype{plain}. \var{_charset} is the character set of the text and is ! passed as a parameter to the \class{MIMEBase} constructor; it defaults ! to \code{us-ascii}. No guessing or encoding is performed on the text ! data, but a newline is appended to \var{_text} if it doesn't already ! end with a newline. ! The \var{_encoding} argument is as with the \class{MIMEImage} class ! constructor, except that the default encoding for \class{MIMEText} ! objects is one that doesn't actually modify the payload, but does set ! the \mailheader{Content-Transfer-Encoding} header to \code{7bit} or ! \code{8bit} as appropriate. ! \end{classdesc} ! \begin{classdesc}{MIMEMessage}{_msg\optional{, _subtype}} ! A subclass of \class{MIMEBase}, the \class{MIMEMessage} class is used to ! create MIME objects of main type \mimetype{message}. \var{_msg} is used as ! the payload, and must be an instance of class \class{Message} (or a ! subclass thereof), otherwise a \exception{TypeError} is raised. ! Optional \var{_subtype} sets the subtype of the message; it defaults ! to \mimetype{rfc822}. ! \end{classdesc} ! \subsection{Encoders} ! \input{emailencoders} ! \subsection{Exception classes} ! \input{emailexc} ! \subsection{Miscellaneous utilities} ! \input{emailutil} ! \subsection{Iterators} ! \input{emailiter} \subsection{Differences from \module{mimelib}} --- 69,172 ---- \subsection{Creating email and MIME objects from scratch} + \input{emailmimebase} ! \subsection{Internationalized headers} ! \input{emailheaders} ! \subsection{Representing character sets} ! \input{emailcharsets} ! \subsection{Encoders} ! \input{emailencoders} ! \subsection{Exception classes} ! \input{emailexc} ! \subsection{Miscellaneous utilities} ! \input{emailutil} ! \subsection{Iterators} ! \input{emailiter} ! \subsection{Differences from \module{email} v1 (up to Python 2.2.1)} ! Version 1 of the \module{email} package was bundled with Python ! releases up to Python 2.2.1. Version 2 was developed for the Python ! 2.3 release, and backported to Python 2.2.2. It was also available as ! a separate distutils based package. \module{email} version 2 is ! almost entirely backward compatible with version 1, with the ! following differences: ! \begin{itemize} ! \item The \module{email.Header} and \module{email.Charset} modules ! have been added. ! \item The pickle format for \class{Message} instances has changed. ! Since this was never (and still isn't) formally defined, this ! isn't considered a backward incompatibility. However if your ! application pickles and unpickles \class{Message} instances, be ! aware that in \module{email} version 2, \class{Message} ! instances now have private variables \var{_charset} and ! \var{_default_type}. ! \item Several methods in the \class{Message} class have been ! deprecated, or their signatures changed. Also, many new methods ! have been added. See the documentation for the \class{Message} ! class for details. The changes should be completely backward ! compatible. ! \item The object structure has changed in the face of ! \mimetype{message/rfc822} content types. In \module{email} ! version 1, such a type would be represented by a scalar payload, ! i.e. the container message's \method{is_multipart()} returned ! false, \method{get_payload()} was not a list object, but a single ! \class{Message} instance. ! This structure was inconsistent with the rest of the package, so ! the object representation for \mimetype{message/rfc822} content ! types was changed. In \module{email} version 2, the container ! \emph{does} return \code{True} from \method{is_multipart()}, and ! \method{get_payload()} returns a list containing a single ! \class{Message} item. ! Note that this is one place that backward compatibility could ! not be completely maintained. However, if you're already ! testing the return type of \method{get_payload()}, you should be ! fine. You just need to make sure your code doesn't do a ! \method{set_payload()} with a \class{Message} instance on a ! container with a content type of \mimetype{message/rfc822}. ! \item The \class{Parser} constructor's \var{strict} argument was ! added, and its \method{parse()} and \method{parsestr()} methods ! grew a \var{headersonly} argument. The \var{strict} flag was ! also added to functions \function{email.message_from_file()} ! and \function{email.message_from_string()}. ! \item \method{Generator.__call__()} is deprecated; use ! \method{Generator.flatten()} instead. The \class{Generator} ! class has also grown the \method{clone()} method. ! \item The \class{DecodedGenerator} class in the ! \module{email.Generator} module was added. ! \item The intermediate base classes \class{MIMENonMultipart} and ! \class{MIMEMultipart} have been added, and interposed in the ! class hierarchy for most of the other MIME-related derived ! classes. ! \item The \var{_encoder} argument to the \class{MIMEText} constructor ! has been deprecated. Encoding now happens implicitly based ! on the \var{_charset} argument. ! \item The following functions in the \module{email.Utils} module have ! been deprecated: \function{dump_address_pairs()}, ! \function{decode()}, and \function{encode()}. The following ! functions have been added to the module: ! \function{make_msgid()}, \function{decode_rfc2231()}, ! \function{encode_rfc2231()}, and \function{decode_params()}. ! \item The non-public function \function{email.Iterators._structure()} ! was added. ! \end{itemize} \subsection{Differences from \module{mimelib}} *************** *** 223,227 **** have also changed. For the most part, any functionality available in \module{mimelib} is still available in the \refmodule{email} package, ! albeit often in a different way. Here is a brief description of the differences between the --- 180,186 ---- have also changed. For the most part, any functionality available in \module{mimelib} is still available in the \refmodule{email} package, ! albeit often in a different way. Backward compatibility between ! the \module{mimelib} package and the \module{email} package was not a ! priority. Here is a brief description of the differences between the *************** *** 236,241 **** --- 195,202 ---- \item \function{messageFromString()} has been renamed to \function{message_from_string()}. + \item \function{messageFromFile()} has been renamed to \function{message_from_file()}. + \end{itemize} *************** *** 244,258 **** --- 205,227 ---- \begin{itemize} \item The method \method{asString()} was renamed to \method{as_string()}. + \item The method \method{ismultipart()} was renamed to \method{is_multipart()}. + \item The \method{get_payload()} method has grown a \var{decode} optional argument. + \item The method \method{getall()} was renamed to \method{get_all()}. + \item The method \method{addheader()} was renamed to \method{add_header()}. + \item The method \method{gettype()} was renamed to \method{get_type()}. + \item The method\method{getmaintype()} was renamed to \method{get_main_type()}. + \item The method \method{getsubtype()} was renamed to \method{get_subtype()}. + \item The method \method{getparams()} was renamed to \method{get_params()}. *************** *** 261,280 **** --- 230,257 ---- the key/value pairs of the parameters, split on the \character{=} sign. + \item The method \method{getparam()} was renamed to \method{get_param()}. + \item The method \method{getcharsets()} was renamed to \method{get_charsets()}. + \item The method \method{getfilename()} was renamed to \method{get_filename()}. + \item The method \method{getboundary()} was renamed to \method{get_boundary()}. + \item The method \method{setboundary()} was renamed to \method{set_boundary()}. + \item The method \method{getdecodedpayload()} was removed. To get similar functionality, pass the value 1 to the \var{decode} flag of the {get_payload()} method. + \item The method \method{getpayloadastext()} was removed. Similar functionality is supported by the \class{DecodedGenerator} class in the \refmodule{email.Generator} module. + \item The method \method{getbodyastext()} was removed. You can get similar functionality by creating an iterator with *************** *** 303,312 **** --- 280,292 ---- and \var{_minor} have changed to \var{_maintype} and \var{_subtype} respectively. + \item The \code{Image} class/module has been renamed to \code{MIMEImage}. The \var{_minor} argument has been renamed to \var{_subtype}. + \item The \code{Text} class/module has been renamed to \code{MIMEText}. The \var{_minor} argument has been renamed to \var{_subtype}. + \item The \code{MessageRFC822} class/module has been renamed to \code{MIMEMessage}. Note that an earlier version of *************** *** 337,629 **** First, let's see how to create and send a simple text message: ! \begin{verbatim} ! # Import smtplib for the actual sending function ! import smtplib ! ! # Here are the email pacakge modules we'll need ! from email import Encoders ! from email.MIMEText import MIMEText ! ! # Open a plain text file for reading ! fp = open(textfile) ! # Create a text/plain message, using Quoted-Printable encoding for non-ASCII ! # characters. ! msg = MIMEText(fp.read(), _encoder=Encoders.encode_quopri) ! fp.close() ! ! # me == the sender's email address ! # you == the recipient's email address ! msg['Subject'] = 'The contents of %s' % textfile ! msg['From'] = me ! msg['To'] = you ! ! # Send the message via our own SMTP server. Use msg.as_string() with ! # unixfrom=0 so as not to confuse SMTP. ! s = smtplib.SMTP() ! s.connect() ! s.sendmail(me, [you], msg.as_string(0)) ! s.close() ! \end{verbatim} Here's an example of how to send a MIME message containing a bunch of ! family pictures: ! ! \begin{verbatim} ! # Import smtplib for the actual sending function ! import smtplib ! ! # Here are the email pacakge modules we'll need ! from email.MIMEImage import MIMEImage ! from email.MIMEBase import MIMEBase ! ! COMMASPACE = ', ' ! ! # Create the container (outer) email message. ! # me == the sender's email address ! # family = the list of all recipients' email addresses ! msg = MIMEBase('multipart', 'mixed') ! msg['Subject'] = 'Our family reunion' ! msg['From'] = me ! msg['To'] = COMMASPACE.join(family) ! msg.preamble = 'Our family reunion' ! # Guarantees the message ends in a newline ! msg.epilogue = '' ! ! # Assume we know that the image files are all in PNG format ! for file in pngfiles: ! # Open the files in binary mode. Let the MIMEIMage class automatically ! # guess the specific image type. ! fp = open(file, 'rb') ! img = MIMEImage(fp.read()) ! fp.close() ! msg.attach(img) ! ! # Send the email via our own SMTP server. ! s = smtplib.SMTP() ! s.connect() ! s.sendmail(me, family, msg.as_string(unixfrom=0)) ! s.close() ! \end{verbatim} ! ! Here's an example\footnote{Thanks to Matthew Dixon Cowles for the ! original inspiration and examples.} of how to send the entire contents ! of a directory as an email message: ! ! \begin{verbatim} ! #!/usr/bin/env python ! ! """Send the contents of a directory as a MIME message. ! ! Usage: dirmail [options] from to [to ...]* ! ! Options: ! -h / --help ! Print this message and exit. ! ! -d directory ! --directory=directory ! Mail the contents of the specified directory, otherwise use the ! current directory. Only the regular files in the directory are sent, ! and we don't recurse to subdirectories. ! ! `from' is the email address of the sender of the message. ! ! `to' is the email address of the recipient of the message, and multiple ! recipients may be given. ! ! The email is sent by forwarding to your local SMTP server, which then does the ! normal delivery process. Your local machine must be running an SMTP server. ! """ ! ! import sys ! import os ! import getopt ! import smtplib ! # For guessing MIME type based on file name extension ! import mimetypes ! ! from email import Encoders ! from email.Message import Message ! from email.MIMEAudio import MIMEAudio ! from email.MIMEBase import MIMEBase ! from email.MIMEImage import MIMEImage ! from email.MIMEText import MIMEText ! ! COMMASPACE = ', ' ! ! ! def usage(code, msg=''): ! print >> sys.stderr, __doc__ ! if msg: ! print >> sys.stderr, msg ! sys.exit(code) ! ! ! def main(): ! try: ! opts, args = getopt.getopt(sys.argv[1:], 'hd:', ['help', 'directory=']) ! except getopt.error, msg: ! usage(1, msg) ! ! dir = os.curdir ! for opt, arg in opts: ! if opt in ('-h', '--help'): ! usage(0) ! elif opt in ('-d', '--directory'): ! dir = arg ! ! if len(args) < 2: ! usage(1) ! ! sender = args[0] ! recips = args[1:] ! ! # Create the enclosing (outer) message ! outer = MIMEBase('multipart', 'mixed') ! outer['Subject'] = 'Contents of directory %s' % os.path.abspath(dir) ! outer['To'] = COMMASPACE.join(recips) ! outer['From'] = sender ! outer.preamble = 'You will not see this in a MIME-aware mail reader.\n' ! # To guarantee the message ends with a newline ! outer.epilogue = '' ! ! for filename in os.listdir(dir): ! path = os.path.join(dir, filename) ! if not os.path.isfile(path): ! continue ! # Guess the Content-Type: based on the file's extension. Encoding ! # will be ignored, although we should check for simple things like ! # gzip'd or compressed files ! ctype, encoding = mimetypes.guess_type(path) ! if ctype is None or encoding is not None: ! # No guess could be made, or the file is encoded (compressed), so ! # use a generic bag-of-bits type. ! ctype = 'application/octet-stream' ! maintype, subtype = ctype.split('/', 1) ! if maintype == 'text': ! fp = open(path) ! # Note: we should handle calculating the charset ! msg = MIMEText(fp.read(), _subtype=subtype) ! fp.close() ! elif maintype == 'image': ! fp = open(path, 'rb') ! msg = MIMEImage(fp.read(), _subtype=subtype) ! fp.close() ! elif maintype == 'audio': ! fp = open(path, 'rb') ! msg = MIMEAudio(fp.read(), _subtype=subtype) ! fp.close() ! else: ! fp = open(path, 'rb') ! msg = MIMEBase(maintype, subtype) ! msg.add_payload(fp.read()) ! fp.close() ! # Encode the payload using Base64 ! Encoders.encode_base64(msg) ! # Set the filename parameter ! msg.add_header('Content-Disposition', 'attachment', filename=filename) ! outer.attach(msg) ! fp = open('/tmp/debug.pck', 'w') ! import cPickle ! cPickle.dump(outer, fp) ! fp.close() ! # Now send the message ! s = smtplib.SMTP() ! s.connect() ! s.sendmail(sender, recips, outer.as_string(0)) ! s.close() ! if __name__ == '__main__': ! main() ! \end{verbatim} And finally, here's an example of how to unpack a MIME message like the one above, into a directory of files: ! \begin{verbatim} ! #!/usr/bin/env python ! ! """Unpack a MIME message into a directory of files. ! ! Usage: unpackmail [options] msgfile ! ! Options: ! -h / --help ! Print this message and exit. ! ! -d directory ! --directory=directory ! Unpack the MIME message into the named directory, which will be ! created if it doesn't already exist. ! ! msgfile is the path to the file containing the MIME message. ! """ ! ! import sys ! import os ! import getopt ! import errno ! import mimetypes ! import email ! ! ! def usage(code, msg=''): ! print >> sys.stderr, __doc__ ! if msg: ! print >> sys.stderr, msg ! sys.exit(code) ! ! ! def main(): ! try: ! opts, args = getopt.getopt(sys.argv[1:], 'hd:', ['help', 'directory=']) ! except getopt.error, msg: ! usage(1, msg) ! ! dir = os.curdir ! for opt, arg in opts: ! if opt in ('-h', '--help'): ! usage(0) ! elif opt in ('-d', '--directory'): ! dir = arg ! ! try: ! msgfile = args[0] ! except IndexError: ! usage(1) ! ! try: ! os.mkdir(dir) ! except OSError, e: ! # Ignore directory exists error ! if e.errno <> errno.EEXIST: raise ! ! fp = open(msgfile) ! msg = email.message_from_file(fp) ! fp.close() ! ! counter = 1 ! for part in msg.walk(): ! # multipart/* are just containers ! if part.get_main_type() == 'multipart': ! continue ! # Applications should really sanitize the given filename so that an ! # email message can't be used to overwrite important files ! filename = part.get_filename() ! if not filename: ! ext = mimetypes.guess_extension(part.get_type()) ! if not ext: ! # Use a generic bag-of-bits extension ! ext = '.bin' ! filename = 'part-%03d%s' % (counter, ext) ! counter += 1 ! fp = open(os.path.join(dir, filename), 'wb') ! fp.write(part.get_payload(decode=1)) ! fp.close() ! ! ! if __name__ == '__main__': ! main() ! \end{verbatim} --- 317,336 ---- First, let's see how to create and send a simple text message: ! \verbatiminput{email-simple.py} Here's an example of how to send a MIME message containing a bunch of ! family pictures that may be residing in a directory: ! \verbatiminput{email-mime.py} + Here's an example of how to send the entire contents of a directory as + an email message: + \footnote{Thanks to Matthew Dixon Cowles for the original inspiration + and examples.} ! \verbatiminput{email-dir.py} And finally, here's an example of how to unpack a MIME message like the one above, into a directory of files: ! \verbatiminput{email-unpack.py} From jhylton@users.sourceforge.net Mon Apr 28 18:39:51 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:39:51 -0700 Subject: [Python-checkins] python/dist/src/Demo/threads find.py,1.6,1.6.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/threads In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/threads Modified Files: Tag: ast-branch find.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: find.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/find.py,v retrieving revision 1.6 retrieving revision 1.6.24.1 diff -C2 -d -r1.6 -r1.6.24.1 *** find.py 21 Jan 2001 07:06:51 -0000 1.6 --- find.py 28 Apr 2003 17:38:18 -0000 1.6.24.1 *************** *** 4,15 **** # It really does do more stats/sec when using multiple threads, # although the improvement is only about 20-30 percent. # I'm too lazy to write a command line parser for the full find(1) # command line syntax, so the predicate it searches for is wired-in, # see function selector() below. (It currently searches for files with ! # group or world write permission.) # Usage: parfind.py [-w nworkers] [directory] ... ! # Default nworkers is 4, maximum appears to be 8 (on Irix 4.0.2) --- 4,17 ---- # It really does do more stats/sec when using multiple threads, # although the improvement is only about 20-30 percent. + # (That was 8 years ago. In 2002, on Linux, I can't measure + # a speedup. :-( ) # I'm too lazy to write a command line parser for the full find(1) # command line syntax, so the predicate it searches for is wired-in, # see function selector() below. (It currently searches for files with ! # world write permission.) # Usage: parfind.py [-w nworkers] [directory] ... ! # Default nworkers is 4 *************** *** 99,103 **** def main(): - sys.argv.append("/tmp") nworkers = 4 opts, args = getopt.getopt(sys.argv[1:], '-w:') --- 101,104 ---- *************** *** 123,128 **** def selector(dir, name, fullname, stat): ! # Look for group or world writable files ! return (stat[ST_MODE] & 0022) != 0 --- 124,129 ---- def selector(dir, name, fullname, stat): ! # Look for world writable files that are not symlinks ! return (stat[ST_MODE] & 0002) != 0 and not S_ISLNK(stat[ST_MODE]) From jhylton@users.sourceforge.net Mon Apr 28 18:39:49 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:39:49 -0700 Subject: [Python-checkins] python/dist/src/Demo/tkinter README,1.5,1.5.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tkinter In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/tkinter Modified Files: Tag: ast-branch README Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/README,v retrieving revision 1.5 retrieving revision 1.5.30.1 diff -C2 -d -r1.5 -r1.5.30.1 *** README 23 Oct 1995 14:31:28 -0000 1.5 --- README 28 Apr 2003 17:38:16 -0000 1.5.30.1 *************** *** 9,11 **** guido my original example set (fairly random collection) matt Matt Conway's examples, to go with his lifesaver document - www a progressing sequence of www clients using Tk --- 9,10 ---- From jhylton@users.sourceforge.net Mon Apr 28 18:39:51 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:39:51 -0700 Subject: [Python-checkins] python/dist/src/Doc python-docs.txt,NONE,1.1.8.1 README,1.46,1.46.2.1 Makefile.deps,1.87,1.87.2.1 Makefile,1.244,1.244.2.1 ACKS,1.37,1.37.2.1 .cvsignore,1.22,1.22.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc Modified Files: Tag: ast-branch README Makefile.deps Makefile ACKS .cvsignore Added Files: Tag: ast-branch python-docs.txt Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. --- NEW FILE: python-docs.txt --- This message is being sent in response to your message to the Python documentation maintainers (python-docs@python.org). Your message will be handled by a human, but this message serves to answer the most common questions sent to this address. You will only receive this message if it has not been sent to you for at least three months. If your question is answered below, you may not receive an additional message from the documentation maintainers. If you feel the answers below are not sufficient and you do not receive an additional response within a week, please do send a note letting us know that your question has not been properly answered, and be specific regarding what additional information you are looking for. -Fred Frequently Asked Questions about the Python Documentation --------------------------------------------------------- 1. Can I download HTML/PDF/PostScript versions of the docs? 2. Where can I download Python? 3. I can't unpack a downloaded copy on Windows; what should I do? 4. I can't unpack a downloaded copy on MacOS; what should I do? 5. What can I use Python for? 6. How do I use module/function/whatever XXX? 7. What about JPython? 8. I found a bug in the documentation, who should I tell? 9. Can I get an algorithm to do THIS in language THAT? 10. How do I decode an XXX file from my email on a YYY computer? 11. Acrobat Reader won't print the PDF. What's wrong? 12. Where can I find documentation in my native language? Answers to the Questions ------------------------ 1. Can I download HTML/PDF/PostScript/ versions of the docs? Yes. These are available via the Web and traditional FTP. For Web access to the latest version, see: http://www.python.org/doc/ For FTP access to the latest version and archives of previous versions, see: ftp.python.org:/pub/python/doc/ 2. Where can I download Python? You can get Python in source form and as a Windows installer from the main Python website. You can also find information about pre-built packages for other platforms there as well. Downloading information at the website is at the URL: http://www.python.org/download/ The sources and Windows installer can be downloaded from the FTP site as well: ftp://ftp.python.org/pub/python/ 3. I can't unpack a downloaded archive on Windows; what should I do? Make sure the archive was saved with the .tgz extension; you may need to watch carefully when telling the browser where to save the file, as the default may change the extension to .tar or even .exe. Once you're sure the file has the right extension, use a recent version of WinZip to upack the file (version 7.0 works). Get WinZip from: http://www.winzip.com/ 4. I can't unpack a downloaded archive on MacOS; what should I do? Stuffit Expander 4.5 (and probably other versions) cannot handle the "tar" archive, although it can decompress it from the .tgz file. Expander Enhancer, which you have to pay for, can handle the tar archive. 5. What can I use Python for? Python is a general purpose programming language. See the Python home page at http://www.python.org/ for more information; introductory material is available at: http://www.python.org/doc/Intros.html 6. How do I use module/function/whatever XXX? Start by reading the documentation for XXX. If the documentation doesn't make sense or seems incomplete, please file a specific bug report to python-docs@python.org (the address you sent your question to). Otherwise, you probably sent your question to the wrong place (which does not preclude an answer, if I know it). If you're looking for examples or tutorial information on how to use a particular Python library component, check the Demo/ directory of the source distribution or Windows installation; there might be an example. If that doesn't help, point your Web browser to http://www.python.org/doc/ and look around; there may be a link to some interesting examples online. After that, try searching the Python Web site at http://www.python.org/search/. If your question still hasn't been answered, you may send your query to the Python newsgroup (comp.lang.python) or the mailing list (see http://www.python.org/mailman/listinfo/python-list). If you'd rather not send you message to a public forum, you can try sending it to python-help@python.org. (This is typically slower than sending your question to the public list, however.) 7. What about Jython and JPython? If your question is specific to Jython or JPython, you should consult the Jython website at: http://www.jython.org/ Chances are very good that the person who answers questions posted to python-docs@python.org doesn't use Jython very often, and won't be able to give you a meaningful answer beyond "Look at the Jython website." Sorry, I don't have *all* the answers! 8. I found a bug in the documentation, who should I tell? If you're reading this, you've found the right address! Send all documentation bug reports to python-docs@python.org. If you prefer to use a Web-based reporting mechanism, you can use the bug database at http://www.python.org/python-bugs/. 9. Can I get an algorithm to do THIS in language THAT? If THAT is Python, look in the standard library. If THAT isn't Python, use your favorite Internet search engine. 10. How do I decode an XXX file from my email on a YYY computer? I really, honestly do not know. I don't even know why this question gets asked here. Since I don't have a YYY computer, I couldn't even try a few things out for you. 11. Acrobat Reader won't print the PDF. What's wrong? Adobe has reportedly admitted that there is a bug Acrobat Reader 5.0 which causes it not to print at least some PDF files generated by pdfTeX. This software is used to produce the PDF version of the Python documentation, and our documents definately trigger this bug in Acrobat Reader. To print the PDF files, use Acrobat Reader 4.x, ghostscript, or xpdf. Information on ghostscript can be found at: http://www.ghostscript.com/ Information on xpdf can be found at: http://www.foolabs.com/xpdf/ 12. There is a lot of contributed documentation in languages other than English. Some of the documents are translations of English documents, and others were originally authored in other languages. If we know about it, it will be listed at: http://www.python.org/doc/NonEnglish.html Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/README,v retrieving revision 1.46 retrieving revision 1.46.2.1 diff -C2 -d -r1.46 -r1.46.2.1 *** README 27 Feb 2002 13:29:45 -0000 1.46 --- README 28 Apr 2003 17:38:14 -0000 1.46.2.1 *************** *** 158,167 **** As distributed, the LaTeX documents use PostScript Times fonts. This is done since they are much better looking and produce smaller ! PostScript files. If, however, your TeX installation does not support them, they may be easily disabled. Edit the file ! texiinputs/manual.cls and comment out the line that starts "\RequirePackage{times}" by inserting a "%" character at the beginning ! of the line. An alternative is to install the right fonts and LaTeX ! style file. --- 158,168 ---- As distributed, the LaTeX documents use PostScript Times fonts. This is done since they are much better looking and produce smaller ! PostScript files. If, however, your TeX installation does not support them, they may be easily disabled. Edit the file ! texinputs/pypaper.sty and comment out the line that starts "\RequirePackage{times}" by inserting a "%" character at the beginning ! of the line. If you're formatting the docs for A4 paper instead of ! US-Letter paper, change paper-a4/pypaper.sty instead. An alternative ! is to install the right fonts and LaTeX style file. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.87 retrieving revision 1.87.2.1 diff -C2 -d -r1.87 -r1.87.2.1 *** Makefile.deps 3 Jul 2002 18:36:38 -0000 1.87 --- Makefile.deps 28 Apr 2003 17:38:14 -0000 1.87.2.1 *************** *** 84,87 **** --- 84,88 ---- # LaTeX source files for the Python Library Reference LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ + texinputs/reportingbugs.tex \ lib/lib.tex \ lib/asttable.tex \ *************** *** 96,104 **** lib/emailparser.tex \ lib/emailutil.tex \ - texinputs/reportingbugs.tex \ lib/libintro.tex \ lib/libobjs.tex \ lib/libstdtypes.tex \ lib/libexcs.tex \ lib/libfuncs.tex \ lib/libpython.tex \ --- 97,105 ---- lib/emailparser.tex \ lib/emailutil.tex \ lib/libintro.tex \ lib/libobjs.tex \ lib/libstdtypes.tex \ lib/libexcs.tex \ + lib/libconsts.tex \ lib/libfuncs.tex \ lib/libpython.tex \ *************** *** 106,109 **** --- 107,111 ---- lib/libfpectl.tex \ lib/libgc.tex \ + lib/libsets.tex \ lib/libweakref.tex \ lib/libinspect.tex \ *************** *** 120,123 **** --- 122,126 ---- lib/libwarnings.tex \ lib/libimp.tex \ + lib/libpkgutil.tex \ lib/libparser.tex \ lib/libbltin.tex \ *************** *** 128,131 **** --- 131,135 ---- lib/libcodecs.tex \ lib/libunicodedata.tex \ + lib/libstringprep.tex \ lib/libstruct.tex \ lib/libmisc.tex \ *************** *** 136,141 **** --- 140,151 ---- lib/liballos.tex \ lib/libos.tex \ + lib/libdatetime.tex \ + lib/tzinfo-examples.py \ lib/libtime.tex \ lib/libgetopt.tex \ + lib/liboptparse.tex \ + lib/caseless.py \ + lib/required_1.py \ + lib/required_2.py \ lib/libtempfile.tex \ lib/liberrno.tex \ *************** *** 145,148 **** --- 155,159 ---- lib/libselect.tex \ lib/libthread.tex \ + lib/libdummythread.tex \ lib/libunix.tex \ lib/libposix.tex \ *************** *** 157,162 **** --- 168,176 ---- lib/libposixfile.tex \ lib/libsyslog.tex \ + lib/liblogging.tex \ lib/libpdb.tex \ lib/libprofile.tex \ + lib/libhotshot.tex \ + lib/libtimeit.tex \ lib/libcgi.tex \ lib/libcgitb.tex \ *************** *** 181,184 **** --- 195,199 ---- lib/libjpeg.tex \ lib/librgbimg.tex \ + lib/libossaudiodev.tex \ lib/libcrypto.tex \ lib/libmd5.tex \ *************** *** 227,230 **** --- 242,246 ---- lib/libcmath.tex \ lib/libgzip.tex \ + lib/libbz2.tex \ lib/libzipfile.tex \ lib/libpprint.tex \ *************** *** 237,240 **** --- 253,257 ---- lib/libxmlrpclib.tex \ lib/libsimplexmlrpc.tex \ + lib/libdocxmlrpc.tex \ lib/libpyexpat.tex \ lib/xmldom.tex \ *************** *** 262,265 **** --- 279,283 ---- lib/libpopen2.tex \ lib/libbisect.tex \ + lib/libheapq.tex \ lib/libmimetypes.tex \ lib/libsmtplib.tex \ *************** *** 267,270 **** --- 285,289 ---- lib/libmultifile.tex \ lib/libthreading.tex \ + lib/libdummythreading.tex \ lib/libwebbrowser.tex \ lib/internet.tex \ *************** *** 321,324 **** --- 340,345 ---- lib/tkinter.tex \ lib/libturtle.tex \ + lib/libtarfile.tex \ + lib/libcsv.tex \ lib/libcfgparser.tex *************** *** 327,341 **** mac/mac.tex \ mac/using.tex \ mac/toolbox.tex \ mac/undoc.tex \ mac/libcolorpicker.tex \ mac/libmac.tex \ mac/libaepack.tex \ mac/libaetypes.tex \ - mac/libctb.tex \ mac/libmacfs.tex \ mac/libmacos.tex \ mac/libmacostools.tex \ - mac/libmacspeech.tex \ mac/libmacui.tex \ mac/libmacic.tex \ --- 348,363 ---- mac/mac.tex \ mac/using.tex \ + mac/scripting.tex \ mac/toolbox.tex \ mac/undoc.tex \ mac/libcolorpicker.tex \ mac/libmac.tex \ + mac/libgensuitemodule.tex \ + mac/libaetools.tex \ mac/libaepack.tex \ mac/libaetypes.tex \ mac/libmacfs.tex \ mac/libmacos.tex \ mac/libmacostools.tex \ mac/libmacui.tex \ mac/libmacic.tex \ Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.244 retrieving revision 1.244.2.1 diff -C2 -d -r1.244 -r1.244.2.1 *** Makefile 25 May 2002 20:28:46 -0000 1.244 --- Makefile 28 Apr 2003 17:38:14 -0000 1.244.2.1 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.3a0 PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.3b1 PYTHON= python *************** *** 74,81 **** --- 74,83 ---- MKDVI= $(PYTHON) ../tools/mkhowto --paper=$(PAPER) --dvi MKHTML= $(PYTHON) tools/mkhowto --html --about html/stdabout.dat \ + --iconserver ../icons --favicon ../icons/pyfav.gif \ --address $(PYTHONDOCS) --up-link ../index.html \ --up-title "Python Documentation Index" \ --global-module-index "../modindex.html" --dvips-safe MKISILOHTML=$(PYTHON) tools/mkhowto --html --about html/stdabout.dat \ + --iconserver ../icons \ --l2h-init perl/isilo.perl --numeric --split 1 \ --dvips-safe *************** *** 192,197 **** cd paper-$(PAPER) && $(MKPDF) api.tex ! paper-$(PAPER)/api.tex: api/api.tex $(ANNOAPI) ! $(PYTHON) $(TOOLSDIR)/anno-api.py -o $@ api/api.tex paper-$(PAPER)/abstract.tex: api/abstract.tex $(ANNOAPI) --- 194,199 ---- cd paper-$(PAPER) && $(MKPDF) api.tex ! paper-$(PAPER)/api.tex: api/api.tex ! cp api/api.tex $@ paper-$(PAPER)/abstract.tex: api/abstract.tex $(ANNOAPI) *************** *** 207,212 **** $(PYTHON) $(TOOLSDIR)/anno-api.py -o $@ api/init.tex ! paper-$(PAPER)/intro.tex: api/intro.tex $(ANNOAPI) ! $(PYTHON) $(TOOLSDIR)/anno-api.py -o $@ api/intro.tex paper-$(PAPER)/memory.tex: api/memory.tex $(ANNOAPI) --- 209,214 ---- $(PYTHON) $(TOOLSDIR)/anno-api.py -o $@ api/init.tex ! paper-$(PAPER)/intro.tex: api/intro.tex ! cp api/intro.tex $@ paper-$(PAPER)/memory.tex: api/memory.tex $(ANNOAPI) *************** *** 282,289 **** # What's New in Python X.Y ! paper-$(PAPER)/$(WHATSNEW).dvi: cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex ! paper-$(PAPER)/$(WHATSNEW).pdf: cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex --- 284,291 ---- # What's New in Python X.Y ! paper-$(PAPER)/$(WHATSNEW).dvi: whatsnew/$(WHATSNEW).tex cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex ! paper-$(PAPER)/$(WHATSNEW).pdf: whatsnew/$(WHATSNEW).tex cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex *************** *** 317,320 **** --- 319,323 ---- html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml $(PYTHON) $(TOOLSDIR)/mkackshtml --address $(PYTHONDOCS) \ + --favicon icons/pyfav.gif \ --output html/acks.html pkglist.html *************** *** 653,657 **** rm -rf isilo/ref/ isilo/tut/ isilo/inst/ isilo/dist/ rm -rf isilo/whatsnew/ ! rm -f isilo/python-*-$(RELEASE).pdb isilo-$(RELEASE).zip realclean distclean: clobber --- 687,691 ---- rm -rf isilo/ref/ isilo/tut/ isilo/inst/ isilo/dist/ rm -rf isilo/whatsnew/ ! rm -f isilo/python-*.pdb isilo-$(RELEASE).zip realclean distclean: clobber Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ACKS,v retrieving revision 1.37 retrieving revision 1.37.2.1 diff -C2 -d -r1.37 -r1.37.2.1 *** ACKS 2 Jul 2002 20:32:50 -0000 1.37 --- ACKS 28 Apr 2003 17:38:15 -0000 1.37.2.1 *************** *** 131,134 **** --- 131,135 ---- Ng Pheng Siong Koray Oner + Tomas Oppelstrup Denis S. Otkidach Zooko O'Whielacronx Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/.cvsignore,v retrieving revision 1.22 retrieving revision 1.22.18.1 diff -C2 -d -r1.22 -r1.22.18.1 *** .cvsignore 18 Jul 2001 21:04:35 -0000 1.22 --- .cvsignore 28 Apr 2003 17:38:15 -0000 1.22.18.1 *************** *** 3,4 **** --- 3,5 ---- *.zip *.tar + pkglist.html From jhylton@users.sourceforge.net Mon Apr 28 18:39:51 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:39:51 -0700 Subject: [Python-checkins] python/dist/src/Demo/tix tixwidgets.py,1.6,1.6.2.1 BUGS.txt,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tix In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/tix Modified Files: Tag: ast-branch tixwidgets.py Removed Files: Tag: ast-branch BUGS.txt Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: tixwidgets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tix/tixwidgets.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** tixwidgets.py 17 Mar 2002 18:19:13 -0000 1.6 --- tixwidgets.py 28 Apr 2003 17:38:17 -0000 1.6.2.1 *************** *** 7,12 **** # For Tix, see http://tix.sourceforge.net # ! # This is a demo program of all Tix widgets available from Python. If ! # you have installed Python & Tix properly, you can execute this as # # % python tixwidgets.py --- 7,12 ---- # For Tix, see http://tix.sourceforge.net # ! # This is a demo program of some of the Tix widgets available in Python. ! # If you have installed Python & Tix properly, you can execute this as # # % python tixwidgets.py *************** *** 15,18 **** --- 15,19 ---- import os, os.path, sys, Tix from Tkconstants import * + import traceback, tkMessageBox TCL_DONT_WAIT = 1<<1 *************** *** 66,73 **** help['menu'] = hm - if w.tk.eval ('info commands console') == "console": - fm.add_command(label='Console', underline=1, - command=lambda w=w: w.tk.eval('console show')) - fm.add_command(label='Exit', underline=1, command = lambda self=self: self.quitcmd () ) --- 67,70 ---- *************** *** 77,80 **** --- 74,78 ---- #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w', # ToggleHelp)) + return w *************** *** 82,88 **** top = self.root w = Tix.NoteBook(top, ipadx=5, ipady=5, options=""" ! *TixNoteBook*tagPadX 6 ! *TixNoteBook*tagPadY 4 ! *TixNoteBook*borderWidth 2 """) # This may be required if there is no *Background option --- 80,86 ---- top = self.root w = Tix.NoteBook(top, ipadx=5, ipady=5, options=""" ! tagPadX 6 ! tagPadY 4 ! borderWidth 2 """) # This may be required if there is no *Background option *************** *** 116,121 **** z = root.winfo_toplevel() z.wm_title('Tix Widget Demonstration') ! z.geometry('790x590+10+10') ! demo.balloon = Tix.Balloon(root) frame1 = self.MkMainMenu() --- 114,121 ---- z = root.winfo_toplevel() z.wm_title('Tix Widget Demonstration') ! if z.winfo_screenwidth() <= 800: ! z.geometry('790x590+10+10') ! else: ! z.geometry('890x640+10+10') demo.balloon = Tix.Balloon(root) frame1 = self.MkMainMenu() *************** *** 128,131 **** --- 128,135 ---- z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) + # To show Tcl errors - uncomment this to see the listbox bug. + # Tkinter defines a Tcl tkerror procedure that in effect + # silences all background Tcl error reporting. + # root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}') def quitcmd (self): """Quit our mainloop. It is up to you to call root.destroy() after.""" *************** *** 133,152 **** def loop(self): ! import tkMessageBox, traceback while self.exit < 0: try: ! self.root.tk.dooneevent(TCL_ALL_EVENTS) except SystemExit: #print 'Exit' self.exit = 1 ! break except KeyboardInterrupt: if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes': # self.tk.eval('exit') return - else: - pass continue except: t, v, tb = sys.exc_info() text = "" --- 137,164 ---- def loop(self): ! """This is an explict replacement for _tkinter mainloop() ! It lets you catch keyboard interrupts easier, and avoids ! the 20 msec. dead sleep() which burns a constant CPU.""" while self.exit < 0: + # There are 2 whiles here. The outer one lets you continue + # after a ^C interrupt. try: ! # This is the replacement for _tkinter mainloop() ! # It blocks waiting for the next Tcl event using select. ! while self.exit < 0: ! self.root.tk.dooneevent(TCL_ALL_EVENTS) except SystemExit: + # Tkinter uses SystemExit to exit #print 'Exit' self.exit = 1 ! return except KeyboardInterrupt: if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes': # self.tk.eval('exit') + self.exit = 1 return continue except: + # Otherwise it's some other error - be nice and say why t, v, tb = sys.exc_info() text = "" *************** *** 160,164 **** def destroy (self): self.root.destroy() ! def RunMain(root): global demo --- 172,176 ---- def destroy (self): self.root.destroy() ! def RunMain(root): global demo *************** *** 255,271 **** def MkChoosers(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! til = Tix.LabelFrame(w, label='Chooser Widgets') ! cbx = Tix.LabelFrame(w, label='tixComboBox') ! ctl = Tix.LabelFrame(w, label='tixControl') ! sel = Tix.LabelFrame(w, label='tixSelect') ! opt = Tix.LabelFrame(w, label='tixOptionMenu') ! fil = Tix.LabelFrame(w, label='tixFileEntry') ! fbx = Tix.LabelFrame(w, label='tixFileSelectBox') ! tbr = Tix.LabelFrame(w, label='Tool Bar') MkTitle(til.frame) --- 267,280 ---- def MkChoosers(nb, name): w = nb.page(name) ! options = "label.padX 4" ! til = Tix.LabelFrame(w, label='Chooser Widgets', options=options) ! cbx = Tix.LabelFrame(w, label='tixComboBox', options=options) ! ctl = Tix.LabelFrame(w, label='tixControl', options=options) ! sel = Tix.LabelFrame(w, label='tixSelect', options=options) ! opt = Tix.LabelFrame(w, label='tixOptionMenu', options=options) ! fil = Tix.LabelFrame(w, label='tixFileEntry', options=options) ! fbx = Tix.LabelFrame(w, label='tixFileSelectBox', options=options) ! tbr = Tix.LabelFrame(w, label='Tool Bar', options=options) MkTitle(til.frame) *************** *** 294,307 **** def MkCombo(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixComboBox*label.width', 10) ! w.option_add('*' + prefix + '*TixComboBox*label.anchor', Tix.E) ! w.option_add('*' + prefix + '*TixComboBox*entry.width', 14) ! static = Tix.ComboBox(w, label='Static', editable=0) ! editable = Tix.ComboBox(w, label='Editable', editable=1) history = Tix.ComboBox(w, label='History', editable=1, history=1, ! anchor=Tix.E) static.insert(Tix.END, 'January') static.insert(Tix.END, 'February') --- 303,312 ---- def MkCombo(w): ! options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 14) ! static = Tix.ComboBox(w, label='Static', editable=0, options=options) ! editable = Tix.ComboBox(w, label='Editable', editable=1, options=options) history = Tix.ComboBox(w, label='History', editable=1, history=1, ! anchor=Tix.E, options=options) static.insert(Tix.END, 'January') static.insert(Tix.END, 'February') *************** *** 356,369 **** global demo_spintxt ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixControl*label.width', 10) ! w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E) ! w.option_add('*' + prefix + '*TixControl*entry.width', 13) demo_spintxt = Tix.StringVar() demo_spintxt.set(states[0]) ! simple = Tix.Control(w, label='Numbers') ! spintxt = Tix.Control(w, label='States', variable=demo_spintxt) spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1) spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1) --- 361,371 ---- global demo_spintxt ! options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 13) demo_spintxt = Tix.StringVar() demo_spintxt.set(states[0]) ! simple = Tix.Control(w, label='Numbers', options=options) ! spintxt = Tix.Control(w, label='States', variable=demo_spintxt, ! options=options) spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1) spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1) *************** *** 372,385 **** simple.pack(side=Tix.TOP, padx=5, pady=3) spintxt.pack(side=Tix.TOP, padx=5, pady=3) ! def MkSelect(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixSelect*label.anchor', Tix.CENTER) ! w.option_add('*' + prefix + '*TixSelect*orientation', Tix.VERTICAL) ! w.option_add('*' + prefix + '*TixSelect*labelSide', Tix.TOP) ! sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1) ! sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0) sel1.add('eat', text='Eat') --- 374,389 ---- simple.pack(side=Tix.TOP, padx=5, pady=3) spintxt.pack(side=Tix.TOP, padx=5, pady=3) ! def MkSelect(w): ! options = "label.anchor %s" % Tix.CENTER ! sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1, ! orientation=Tix.VERTICAL, ! labelside=Tix.TOP, ! options=options) ! sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0, ! orientation=Tix.VERTICAL, ! labelside= Tix.TOP, ! options=options) sel1.add('eat', text='Eat') *************** *** 399,406 **** def MkOptMenu(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixOptionMenu*label.anchor', Tix.E) ! m = Tix.OptionMenu(w, label='File Format : ', options='menubutton.width 15') m.add_command('text', label='Plain Text') m.add_command('post', label='PostScript') --- 403,409 ---- def MkOptMenu(w): ! options='menubutton.width 15 label.anchor %s' % Tix.E ! ! m = Tix.OptionMenu(w, label='File Format : ', options=options) m.add_command('text', label='Plain Text') m.add_command('post', label='PostScript') *************** *** 414,418 **** def MkFileEnt(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='Press the "open file" icon button and a TixFileSelectDialog will popup.') --- 417,421 ---- def MkFileEnt(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='Press the "open file" icon button and a TixFileSelectDialog will popup.') *************** *** 426,430 **** and your past selections are recorded. """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.') --- 429,433 ---- and your past selections are recorded. """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.') *************** *** 434,448 **** def MkToolBar(w): global demo ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1) ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Select widget is also good for arranging buttons in a tool bar.') bar = Tix.Frame(w, bd=2, relief=Tix.RAISED) ! font = Tix.Select(w, allowzero=1, radio=0, label='') ! para = Tix.Select(w, allowzero=0, radio=1, label='') font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm') --- 437,452 ---- def MkToolBar(w): + """The Select widget is also good for arranging buttons in a tool bar. + """ global demo ! options='frame.borderWidth 1' ! ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Select widget is also good for arranging buttons in a tool bar.') bar = Tix.Frame(w, bd=2, relief=Tix.RAISED) ! font = Tix.Select(w, allowzero=1, radio=0, label='', options=options) ! para = Tix.Select(w, allowzero=0, radio=1, label='', options=options) font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm') *************** *** 462,469 **** def MkTitle(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1) ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='There are many types of "chooser" widgets that allow the user to input different types of information') --- 466,470 ---- def MkTitle(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='There are many types of "chooser" widgets that allow the user to input different types of information') *************** *** 472,483 **** def MkScroll(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! sls = Tix.LabelFrame(w, label='tixScrolledListBox') ! swn = Tix.LabelFrame(w, label='tixScrolledWindow') ! stx = Tix.LabelFrame(w, label='tixScrolledText') MkSList(sls.frame) --- 473,481 ---- def MkScroll(nb, name): w = nb.page(name) ! options='label.padX 4' ! sls = Tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options) ! swn = Tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options) ! stx = Tix.LabelFrame(w, label='Tix.ScrolledText', options=options) MkSList(sls.frame) *************** *** 489,496 **** stx.form(top=0, left=swn, right=-1, bottom=-1) def MkSList(w): top = Tix.Frame(w, width=300, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.') --- 487,498 ---- stx.form(top=0, left=swn, right=-1, bottom=-1) + def MkSList(w): + """This TixScrolledListBox is configured so that it uses scrollbars + only when it is necessary. Use the handles to resize the listbox and + watch the scrollbars automatically appear and disappear. """ top = Tix.Frame(w, width=300, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.') *************** *** 523,534 **** rh.attach_widget(list) - # See below why this is necessary. - global image1 - image1 = None def MkSWindow(w): ! global demo, image1 - text = 'The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.' - file = os.path.join(demo.dir, 'bitmaps', 'tix.gif') if not os.path.isfile(file): --- 525,536 ---- rh.attach_widget(list) def MkSWindow(w): ! """The ScrolledWindow widget allows you to scroll any kind of Tk ! widget. It is more versatile than a scrolled canvas widget. ! """ ! global demo ! ! text = 'The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.' file = os.path.join(demo.dir, 'bitmaps', 'tix.gif') if not os.path.isfile(file): *************** *** 537,541 **** top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text=text) --- 539,543 ---- top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text=text) *************** *** 543,551 **** win = Tix.ScrolledWindow(top, scrollbar='auto') ! # This image is not showing up under Python unless it is set to a ! # global variable - no problem under Tcl. I assume it is being garbage ! # collected some how, even though the tcl command 'image names' shows ! # that as far as Tcl is concerned, the image exists and is called pyimage1. ! image1 = Tix.Image('photo', file=file) lbl = Tix.Label(win.window, image=image1) lbl.pack(expand=1, fill=Tix.BOTH) --- 545,549 ---- win = Tix.ScrolledWindow(top, scrollbar='auto') ! image1 = win.window.image_create('photo', file=file) lbl = Tix.Label(win.window, image=image1) lbl.pack(expand=1, fill=Tix.BOTH) *************** *** 562,565 **** --- 560,564 ---- top.pack(expand=1, fill=Tix.BOTH) bot.pack(fill=Tix.BOTH) + win.bind('', func=lambda arg=0, rh=rh, win=win: win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win))) *************** *** 571,583 **** def MkSText(w): top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, ! text='The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') win = Tix.ScrolledText(top, scrollbar='auto') ! # win.text['wrap'] = 'none' ! win.text.insert(Tix.END, 'This is a text widget embedded in a scrolled window. Although the original Tix demo does not have any text here, I decided to put in some so that you can see the effect of scrollbars etc.') win.place(x=30, y=150, width=190, height=100) --- 570,594 ---- def MkSText(w): + """The TixScrolledWindow widget allows you to scroll any kind of Tk + widget. It is more versatile than a scrolled canvas widget.""" top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, ! text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') win = Tix.ScrolledText(top, scrollbar='auto') ! win.text['wrap'] = 'none' ! win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the ! scrollbars are shown only when needed. ! Additional modifiers can be used to force a ! scrollbar to be shown or hidden. For example, ! "auto -y" means the horizontal scrollbar ! should be shown when needed but the vertical ! scrollbar should always be hidden; ! "auto +x" means the vertical scrollbar ! should be shown when needed but the horizontal ! scrollbar should always be shown, and so on.''' ! ) win.place(x=30, y=150, width=190, height=100) *************** *** 601,611 **** def MkManager(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! pane = Tix.LabelFrame(w, label='tixPanedWindow') ! note = Tix.LabelFrame(w, label='tixNoteBook') MkPanedWindow(pane.frame) --- 612,619 ---- def MkManager(nb, name): w = nb.page(name) ! options='label.padX 4' ! pane = Tix.LabelFrame(w, label='Tix.PanedWindow', options=options) ! note = Tix.LabelFrame(w, label='Tix.NoteBook', options=options) MkPanedWindow(pane.frame) *************** *** 616,620 **** def MkPanedWindow(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.') --- 624,632 ---- def MkPanedWindow(w): ! """The PanedWindow widget allows the user to interactively manipulate ! the sizes of several panes. The panes can be arranged either vertically ! or horizontally. ! """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.') *************** *** 659,674 **** def MkNoteBook(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The NoteBook widget allows you to layout a complex interface into individual pages.') ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixControl*entry.width', 10) ! w.option_add('*' + prefix + '*TixControl*label.width', 18) ! w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E) ! w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8) ! nb = Tix.NoteBook(w, ipadx=6, ipady=6) nb.add('hard_disk', label="Hard Disk", underline=0) nb.add('network', label="Network", underline=0) --- 671,683 ---- def MkNoteBook(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The NoteBook widget allows you to layout a complex interface into individual pages.') ! # prefix = Tix.OptionName(w) ! # if not prefix: prefix = '' ! # w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8) ! options = "entry.width %d label.width %d label.anchor %s" % (10, 18, Tix.E) ! nb = Tix.NoteBook(w, ipadx=6, ipady=6, options=options) nb.add('hard_disk', label="Hard Disk", underline=0) nb.add('network', label="Network", underline=0) *************** *** 715,725 **** def MkDirList(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! dir = Tix.LabelFrame(w, label='tixDirList') ! fsbox = Tix.LabelFrame(w, label='tixExFileSelectBox') MkDirListWidget(dir.frame) MkExFileWidget(fsbox.frame) --- 724,731 ---- def MkDirList(nb, name): w = nb.page(name) ! options = "label.padX 4" ! dir = Tix.LabelFrame(w, label='Tix.DirList', options=options) ! fsbox = Tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options) MkDirListWidget(dir.frame) MkExFileWidget(fsbox.frame) *************** *** 728,734 **** def MkDirListWidget(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The TixDirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.') dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) --- 734,744 ---- def MkDirListWidget(w): ! """The TixDirList widget gives a graphical representation of the file ! system directory and makes it easy for the user to choose and access ! directories. ! """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.') dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) *************** *** 736,742 **** def MkExFileWidget(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The TixExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.') # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED) --- 746,754 ---- def MkExFileWidget(w): ! """The TixExFileSelectBox widget is more user friendly than the Motif ! style FileSelectBox. """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.') # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED) *************** *** 774,795 **** ## {d "Image Types" image } ## } ! ## ## set image { ## {d "Compound Image" cmpimg } ## {d "XPM Image" xpm {i pixmap}} ## } ! ## ## set cmpimg { ! ## {f "In Buttons" CmpImg.tcl } ## {f "In NoteBook" CmpImg2.tcl } ## {f "Notebook Color Tabs" CmpImg4.tcl } ## {f "Icons" CmpImg3.tcl } ## } ! ## ## set xpm { ## {f "In Button" Xpm.tcl {i pixmap}} ## {f "In Menu" Xpm1.tcl {i pixmap}} ## } ! ## ## set file { ##added {f DirList DirList.tcl } --- 786,807 ---- ## {d "Image Types" image } ## } ! ## ## set image { ## {d "Compound Image" cmpimg } ## {d "XPM Image" xpm {i pixmap}} ## } ! ## ## set cmpimg { ! ##done {f "In Buttons" CmpImg.tcl } ## {f "In NoteBook" CmpImg2.tcl } ## {f "Notebook Color Tabs" CmpImg4.tcl } ## {f "Icons" CmpImg3.tcl } ## } ! ## ## set xpm { ## {f "In Button" Xpm.tcl {i pixmap}} ## {f "In Menu" Xpm1.tcl {i pixmap}} ## } ! ## ## set file { ##added {f DirList DirList.tcl } *************** *** 800,804 **** ## {f FileEntry FileEnt.tcl } ## } ! ## ## set hlist { ## {f HList HList1.tcl } --- 812,816 ---- ## {f FileEntry FileEnt.tcl } ## } ! ## ## set hlist { ## {f HList HList1.tcl } *************** *** 809,813 **** ##done {f "Tree (Dynamic)" DynTree.tcl {v win}} ## } ! ## ## set tlist { ## {f "ScrolledTList (1)" STList1.tcl {c tixTList}} --- 821,825 ---- ##done {f "Tree (Dynamic)" DynTree.tcl {v win}} ## } ! ## ## set tlist { ## {f "ScrolledTList (1)" STList1.tcl {c tixTList}} *************** *** 819,823 **** ##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}} ## } ! ## ## set grid { ##na {f "Simple Grid" SGrid0.tcl {c tixGrid}} --- 831,835 ---- ##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}} ## } ! ## ## set grid { ##na {f "Simple Grid" SGrid0.tcl {c tixGrid}} *************** *** 825,829 **** ##na {f "Editable Grid" EditGrid.tcl {c tixGrid}} ## } ! ## ## set scroll { ## {f ScrolledListBox SListBox.tcl } --- 837,841 ---- ##na {f "Editable Grid" EditGrid.tcl {c tixGrid}} ## } ! ## ## set scroll { ## {f ScrolledListBox SListBox.tcl } *************** *** 832,842 **** ##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}} ## } ! ## ## set manager { ! ##na {f ListNoteBook ListNBK.tcl } ##done {f NoteBook NoteBook.tcl } ##done {f PanedWindow PanedWin.tcl } ## } ! ## ## set misc { ##done {f Balloon Balloon.tcl } --- 844,854 ---- ##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}} ## } ! ## ## set manager { ! ## {f ListNoteBook ListNBK.tcl } ##done {f NoteBook NoteBook.tcl } ##done {f PanedWindow PanedWin.tcl } ## } ! ## ## set misc { ##done {f Balloon Balloon.tcl } *************** *** 846,850 **** ## {f LabelEntry LabEntry.tcl } ## {f LabelFrame LabFrame.tcl } ! ##na {f Meter Meter.tcl {c tixMeter}} ##done {f OptionMenu OptMenu.tcl } ##done {f PopupMenu PopMenu.tcl } --- 858,862 ---- ## {f LabelEntry LabEntry.tcl } ## {f LabelFrame LabFrame.tcl } ! ## {f Meter Meter.tcl {c tixMeter}} ##done {f OptionMenu OptMenu.tcl } ##done {f PopupMenu PopMenu.tcl } *************** *** 863,872 **** def MkSample(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! else: ! prefix = '*' + prefix ! w.option_add(prefix + '*TixLabelFrame*label.padX', 4) pane = Tix.PanedWindow(w, orientation='horizontal') --- 875,879 ---- def MkSample(nb, name): w = nb.page(name) ! options = "label.padX 4" pane = Tix.PanedWindow(w, orientation='horizontal') *************** *** 877,899 **** f2['relief'] = 'flat' ! lab = Tix.Label(f1, text='Select a sample program:', anchor=Tix.W) ! lab.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=5, pady=5) ! lab1 = Tix.Label(f2, text='Source:', anchor=Tix.W) ! lab1.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=5, pady=5) ! slb = Tix.Tree(f1, options='hlist.width 25') slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5) ! stext = Tix.ScrolledText(f2, name='stext') font = root.tk.eval('tix option get fixed_font') stext.text.config(font=font) - stext.text.bind('', lambda w=stext.text: w.yview(scroll='-1 unit')) - stext.text.bind('', lambda w=stext.text: w.yview(scroll='1 unit')) - stext.text.bind('', lambda w=stext.text: w.xview(scroll='-1 unit')) - stext.text.bind('', lambda w=stext.text: w.xview(scroll='1 unit')) - stext.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=7) ! frame = Tix.Frame(f2, name='frame') ! frame.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=7) run = Tix.Button(frame, text='Run ...', name='run') --- 884,900 ---- f2['relief'] = 'flat' ! lab = Tix.LabelFrame(f1, label='Select a sample program:') ! lab.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5) ! lab1 = Tix.LabelFrame(f2, label='Source:') ! lab1.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5) ! slb = Tix.Tree(lab.frame, options='hlist.width 20') slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5) ! stext = Tix.ScrolledText(lab1.frame, name='stext') font = root.tk.eval('tix option get fixed_font') stext.text.config(font=font) ! frame = Tix.Frame(lab1.frame, name='frame') run = Tix.Button(frame, text='Run ...', name='run') *************** *** 906,909 **** --- 907,913 ---- stext.text['wrap'] = 'none' stext.text['width'] = 80 + + frame.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X, padx=7) + stext.pack(side=Tix.TOP, expand=0, fill=Tix.BOTH, padx=7) slb.hlist['separator'] = '.' --- BUGS.txt DELETED --- From jhylton@users.sourceforge.net Mon Apr 28 18:39:51 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:39:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.5,1.5.2.1 refcounts.dat,1.43,1.43.2.1 newtypes.tex,1.13,1.13.2.1 init.tex,1.3,1.3.2.1 exceptions.tex,1.7,1.7.2.1 concrete.tex,1.17,1.17.2.1 abstract.tex,1.17,1.17.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc/api Modified Files: Tag: ast-branch utilities.tex refcounts.dat newtypes.tex init.tex exceptions.tex concrete.tex abstract.tex Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** utilities.tex 17 Jun 2002 15:44:18 -0000 1.5 --- utilities.tex 28 Apr 2003 17:38:10 -0000 1.5.2.1 *************** *** 59,63 **** \section{Process Control \label{processControl}} ! \begin{cfuncdesc}{void}{Py_FatalError}{char *message} Print a fatal error message and kill the process. No cleanup is performed. This function should only be invoked when a condition is --- 59,63 ---- \section{Process Control \label{processControl}} ! \begin{cfuncdesc}{void}{Py_FatalError}{const char *message} Print a fatal error message and kill the process. No cleanup is performed. This function should only be invoked when a condition is *************** *** 149,156 **** First check the modules dictionary if there's one there, and if not, create a new one and insert in in the modules dictionary. \note{This function does not load or import the module; if the module wasn't already loaded, you will get an empty module object. Use \cfunction{PyImport_ImportModule()} or one of its variants to ! import a module. Return \NULL{} with an exception set on failure.} \end{cfuncdesc} --- 149,158 ---- First check the modules dictionary if there's one there, and if not, create a new one and insert in in the modules dictionary. + Return \NULL{} with an exception set on failure. \note{This function does not load or import the module; if the module wasn't already loaded, you will get an empty module object. Use \cfunction{PyImport_ImportModule()} or one of its variants to ! import a module. Package structures implied by a dotted name for ! \var{name} are not created if not already present.} \end{cfuncdesc} *************** *** 161,166 **** the module. Return a new reference to the module object, or \NULL{} with an exception set if an error occurred (the module may still be ! created in this case). (This function would reload the module if it ! was already imported.) \end{cfuncdesc} --- 163,170 ---- the module. Return a new reference to the module object, or \NULL{} with an exception set if an error occurred (the module may still be ! created in this case). This function would reload the module if it ! was already imported. If \var{name} points to a dotted name of the ! form \code{package.module}, any package structures not already ! created will still not be created. \end{cfuncdesc} *************** *** 286,295 **** \end{cfuncdesc} - \begin{cfuncdesc}{void}{PyMarshal_WriteShortToFile}{short value, FILE *file} - Marshal a \ctype{short} integer, \var{value}, to \var{file}. This - will only write the least-significant 16 bits of \var{value}; - regardless of the size of the native \ctype{short} type. - \end{cfuncdesc} - \begin{cfuncdesc}{void}{PyMarshal_WriteObjectToFile}{PyObject *value, FILE *file} --- 290,293 ---- *************** *** 490,506 **** Convert a Python integer to a tiny int, stored in a C \ctype{char}. \item[\samp{h} (integer) {[short int]}] Convert a Python integer to a C \ctype{short int}. \item[\samp{i} (integer) {[int]}] Convert a Python integer to a plain C \ctype{int}. \item[\samp{l} (integer) {[long int]}] Convert a Python integer to a C \ctype{long int}. ! \item[\samp{L} (integer) {[LONG_LONG]}] Convert a Python integer to a C \ctype{long long}. This format is only available on platforms that support \ctype{long long} (or \ctype{_int64} on Windows). \item[\samp{c} (string of length 1) {[char]}] --- 488,526 ---- Convert a Python integer to a tiny int, stored in a C \ctype{char}. + \item[\samp{B} (integer) {[unsigned char]}] + Convert a Python integer to a tiny int without overflow checking, + stored in a C \ctype{unsigned char}. \versionadded{2.3} + \item[\samp{h} (integer) {[short int]}] Convert a Python integer to a C \ctype{short int}. + \item[\samp{H} (integer) {[unsigned short int]}] + Convert a Python integer to a C \ctype{unsigned short int}, without + overflow checking. \versionadded{2.3} + \item[\samp{i} (integer) {[int]}] Convert a Python integer to a plain C \ctype{int}. + \item[\samp{I} (integer) {[unsigned int]}] + Convert a Python integer to a C \ctype{unsigned int}, without + overflow checking. \versionadded{2.3} + \item[\samp{l} (integer) {[long int]}] Convert a Python integer to a C \ctype{long int}. ! \item[\samp{k} (integer) {[unsigned long]}] ! Convert a Python integer to a C \ctype{unsigned long} without ! overflow checking. \versionadded{2.3} ! ! \item[\samp{L} (integer) {[PY_LONG_LONG]}] Convert a Python integer to a C \ctype{long long}. This format is only available on platforms that support \ctype{long long} (or \ctype{_int64} on Windows). + + \item[\samp{K} (integer) {[unsigned PY_LONG_LONG]}] + Convert a Python integer to a C \ctype{unsigned long long} + without overflow checking. This format is only available on + platforms that support \ctype{unsigned long long} (or + \ctype{unsigned _int64} on Windows). \versionadded{2.3} \item[\samp{c} (string of length 1) {[char]}] Index: refcounts.dat =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/refcounts.dat,v retrieving revision 1.43 retrieving revision 1.43.2.1 diff -C2 -d -r1.43 -r1.43.2.1 *** refcounts.dat 2 Jul 2002 16:16:18 -0000 1.43 --- refcounts.dat 28 Apr 2003 17:38:11 -0000 1.43.2.1 *************** *** 812,815 **** --- 812,818 ---- PyObject_GetItem:PyObject*:key:0: + PyObject_GetIter:PyObject*::+1: + PyObject_GetIter:PyObject*:o:0: + PyObject_HasAttr:int::: PyObject_HasAttr:PyObject*:o:0: Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** newtypes.tex 31 May 2002 21:00:18 -0000 1.13 --- newtypes.tex 28 Apr 2003 17:38:11 -0000 1.13.2.1 *************** *** 84,87 **** --- 84,90 ---- Create a new module object based on a name and table of functions, returning the new module object. + + \versionchanged[Older versions of Python did not support \NULL{} as + the value for the \var{methods} argument]{2.3} \end{cfuncdesc} *************** *** 92,95 **** --- 95,101 ---- returning the new module object. If \var{doc} is non-\NULL, it will be used to define the docstring for the module. + + \versionchanged[Older versions of Python did not support \NULL{} as + the value for the \var{methods} argument]{2.3} \end{cfuncdesc} *************** *** 110,113 **** --- 116,122 ---- the \cfunction{Py_InitModule3()} instead; only use this if you are sure you need it.} + + \versionchanged[Older versions of Python did not support \NULL{} as + the value for the \var{methods} argument]{2.3} \end{cfuncdesc} *************** *** 222,226 **** convention or a binding convention. Of the calling convention flags, only \constant{METH_VARARGS} and \constant{METH_KEYWORDS} can be ! combined. Any of the calling convention flags can be combined with a binding flag. --- 231,237 ---- convention or a binding convention. Of the calling convention flags, only \constant{METH_VARARGS} and \constant{METH_KEYWORDS} can be ! combined (but note that \constant{METH_KEYWORDS} alone is equivalent ! to \code{\constant{METH_VARARGS} | \constant{METH_KEYWORDS}}). ! Any of the calling convention flags can be combined with a binding flag. *************** *** 234,238 **** (often called \var{args}) is a tuple object representing all arguments. This parameter is typically processed using ! \cfunction{PyArg_ParseTuple()}. \end{datadesc} --- 245,249 ---- (often called \var{args}) is a tuple object representing all arguments. This parameter is typically processed using ! \cfunction{PyArg_ParseTuple()} or \cfunction{PyArg_UnpackTuple}. \end{datadesc} *************** *** 249,256 **** Methods without parameters don't need to check whether arguments are given if they are listed with the \constant{METH_NOARGS} flag. They ! need to be of type \ctype{PyNoArgsFunction}: they expect a single ! single \ctype{PyObject*} as a parameter. When used with object ! methods, this parameter is typically named \code{self} and will hold ! a reference to the object instance. \end{datadesc} --- 260,267 ---- Methods without parameters don't need to check whether arguments are given if they are listed with the \constant{METH_NOARGS} flag. They ! need to be of type \ctype{PyCFunction}. When used with object ! methods, the first parameter is typically named \code{self} and will ! hold a reference to the object instance. In all cases the second ! parameter will be \NULL. \end{datadesc} *************** *** 336,344 **** \verbatiminput{typestruct.h} ! The type object structure extends the \ctype{PyVarObject} structure, ! though it does not actually need the the \member{ob_size} field. The ! inclusion of this field is a historical accident that must be ! maintained to ensure binary compatibility between new versions of ! Python and older compiled extensions. \begin{cmemberdesc}{PyObject}{PyObject*}{_ob_next} --- 347,356 ---- \verbatiminput{typestruct.h} ! The type object structure extends the \ctype{PyVarObject} structure. ! The \member{ob_size} field is used for dynamic types (created ! by \function{type_new()}, usually called from a class statement). ! Note that \cdata{PyType_Type} (the metatype) initializes ! \member{tp_itemsize}, which means that its instances (i.e. type ! objects) \emph{must} have the \member{ob_size} field. \begin{cmemberdesc}{PyObject}{PyObject*}{_ob_next} *************** *** 413,427 **** should have the \member{tp_name} initializer \code{"P.Q.M.T"}. ! For dynamically allocated type objects, this may be just the type ! name, if the module name is explicitly stored in the type dict as ! the value for key \code{'__module__'}. ! If the tp_name field contains a dot, everything before the last dot ! is made accessible as the \member{__module__} attribute, and ! everything after the last dot is made accessible as the ! \member{__name__} attribute. If no dot is present, the entire ! \member{tp_name} field is made accessible as the \member{__name__} ! attribute, and the \member{__module__} attribute is undefined ! (unless explicitly set in the dictionary, as explained above). This field is not inherited by subtypes. --- 425,442 ---- should have the \member{tp_name} initializer \code{"P.Q.M.T"}. ! For dynamically allocated type objects, this should just be the type ! name, and the module name explicitly stored in the type dict as the ! value for key \code{'__module__'}. ! For statically allocated type objects, the tp_name field should ! contain a dot. Everything before the last dot is made accessible as ! the \member{__module__} attribute, and everything after the last dot ! is made accessible as the \member{__name__} attribute. ! ! If no dot is present, the entire \member{tp_name} field is made ! accessible as the \member{__name__} attribute, and the ! \member{__module__} attribute is undefined (unless explicitly set in ! the dictionary, as explained above). This means your type will be ! impossible to pickle. This field is not inherited by subtypes. *************** *** 430,434 **** \begin{cmemberdesc}{PyTypeObject}{int}{tp_basicsize} \cmemberline{PyTypeObject}{int}{tp_itemsize} ! These fields allow calculating the size in byte of instances of the type. --- 445,449 ---- \begin{cmemberdesc}{PyTypeObject}{int}{tp_basicsize} \cmemberline{PyTypeObject}{int}{tp_itemsize} ! These fields allow calculating the size in bytes of instances of the type. *************** *** 447,453 **** negative number, and N is \code{abs(\member{ob_size})} there. Also, the presence of an \member{ob_size} field in the instance layout ! doesn't mean that the type is variable-length (for example, the list ! type has fixed-length instances, yet those instances have a ! meaningful \member{ob_size} field). The basic size includes the fields in the instance declared by the --- 462,468 ---- negative number, and N is \code{abs(\member{ob_size})} there. Also, the presence of an \member{ob_size} field in the instance layout ! doesn't mean that the instance structure is variable-length (for ! example, the structure for the list type has fixed-length instances, ! yet those instances have a meaningful \member{ob_size} field). The basic size includes the fields in the instance declared by the *************** *** 515,519 **** The print function is called with the same signature as ! \cfunction{PyObject_Print()}: \code{tp_print(PyObject *self, FILE *file, int flags)}. The \var{self} argument is the instance to be printed. The \var{file} argument is the stdio file to which it is --- 530,534 ---- The print function is called with the same signature as ! \cfunction{PyObject_Print()}: \code{int tp_print(PyObject *self, FILE *file, int flags)}. The \var{self} argument is the instance to be printed. The \var{file} argument is the stdio file to which it is *************** *** 524,527 **** --- 539,544 ---- when the \constant{Py_PRINT_RAW} flag bit is clear, the instance should be printed the same was as \member{tp_repr} would format it. + It should return \code{-1} and set an exception condition when an + error occurred during the comparison. It is possible that the \member{tp_print} field will be deprecated. *************** *** 869,874 **** An optional pointer to a traversal function for the garbage collector. This is only used if the \constant{Py_TPFLAGS_HAVE_GC} ! flag bit is set. More information in section XXX about garbage ! collection. This field is inherited by subtypes together with \member{tp_clear} --- 886,891 ---- An optional pointer to a traversal function for the garbage collector. This is only used if the \constant{Py_TPFLAGS_HAVE_GC} ! flag bit is set. More information in section ! \ref{supporting-cycle-detection} about garbage collection. This field is inherited by subtypes together with \member{tp_clear} *************** *** 882,886 **** An optional pointer to a clear function for the garbage collector. This is only used if the \constant{Py_TPFLAGS_HAVE_GC} flag bit is ! set. More information in section XXX about garbage collection. This field is inherited by subtypes together with \member{tp_clear} --- 899,904 ---- An optional pointer to a clear function for the garbage collector. This is only used if the \constant{Py_TPFLAGS_HAVE_GC} flag bit is ! set. More information in section ! \ref{supporting-cycle-detection} about garbage collection. This field is inherited by subtypes together with \member{tp_clear} *************** *** 1489,1492 **** --- 1507,1512 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} + Return the size of the memory buffer in \var{ptrptr} for segment + \var{segment}. \code{*\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** init.tex 9 Apr 2002 21:09:42 -0000 1.3 --- init.tex 28 Apr 2003 17:38:11 -0000 1.3.2.1 *************** *** 59,65 **** leak, please report it). Memory tied up in circular references between objects is not freed. Some memory allocated by extension ! modules may not be freed. Some extension may not work properly if their initialization routine is called more than once; this can ! happen if an applcation calls \cfunction{Py_Initialize()} and \cfunction{Py_Finalize()} more than once. \end{cfuncdesc} --- 59,65 ---- leak, please report it). Memory tied up in circular references between objects is not freed. Some memory allocated by extension ! modules may not be freed. Some extensions may not work properly if their initialization routine is called more than once; this can ! happen if an application calls \cfunction{Py_Initialize()} and \cfunction{Py_Finalize()} more than once. \end{cfuncdesc} *************** *** 234,238 **** directory names separated by a platform dependent delimiter character. The delimiter character is \character{:} on \UNIX, ! \character{;} on DOS/Windows, and \character{\e n} (the \ASCII{} newline character) on Macintosh. The returned string points into static storage; the caller should not modify its value. The value --- 234,238 ---- directory names separated by a platform dependent delimiter character. The delimiter character is \character{:} on \UNIX, ! \character{;} on Windows, and \character{\e n} (the \ASCII{} newline character) on Macintosh. The returned string points into static storage; the caller should not modify its value. The value *************** *** 257,261 **** version separated by a period. The returned string points into static storage; the caller should not modify its value. The value ! is available to Python code as the list \code{sys.version}. \withsubitem{(in module sys)}{\ttindex{version}} \end{cfuncdesc} --- 257,261 ---- version separated by a period. The returned string points into static storage; the caller should not modify its value. The value ! is available to Python code as \code{sys.version}. \withsubitem{(in module sys)}{\ttindex{version}} \end{cfuncdesc} *************** *** 280,285 **** The returned string points into static storage; the caller should ! not modify its value. The value is available to Python code as the ! list \code{sys.copyright}. \withsubitem{(in module sys)}{\ttindex{copyright}} \end{cfuncdesc} --- 280,285 ---- The returned string points into static storage; the caller should ! not modify its value. The value is available to Python code as ! \code{sys.copyright}. \withsubitem{(in module sys)}{\ttindex{copyright}} \end{cfuncdesc} *************** *** 467,470 **** --- 467,492 ---- thread after Python is initialized). + Assuming you have access to an interpreter object, the typical idiom + for calling into Python from a C thread is + + \begin{verbatim} + PyThreadState *tstate; + PyObject *result; + + /* interp is your reference to an interpreter object. */ + tstate = PyThreadState_New(interp); + PyEval_AcquireThread(tstate); + + /* Perform Python actions here. */ + result = CallSomeFunction(); + /* evaluate result */ + + /* Release the thread. No Python API allowed beyond this point. */ + PyEval_ReleaseThread(tstate); + + /* You can either delete the thread state, or save it + until you need it the next time. */ + PyThreadState_Delete(tstate); + \end{verbatim} \begin{ctypedesc}{PyInterpreterState} *************** *** 656,662 **** Return a dictionary in which extensions can store thread-specific state information. Each extension should use a unique key to use to ! store state in the dictionary. If this function returns \NULL, an ! exception has been raised and the caller should allow it to ! propogate. \end{cfuncdesc} --- 678,687 ---- Return a dictionary in which extensions can store thread-specific state information. Each extension should use a unique key to use to ! store state in the dictionary. It is okay to call this function ! when no current thread state is available. ! If this function returns \NULL, no exception has been raised and the ! caller should assume no current thread state is available. ! \versionchanged[Previously this could only be called when a current ! thread is active, and \NULL meant that an exception was raised]{2.3} \end{cfuncdesc} *************** *** 716,720 **** being executed. The effect of this is that as exception propogation causes the Python stack to unwind, the callback is called upon ! return to each frame as the exception propogates. Only trace functions receives these events; they are not needed by the profiler. --- 741,745 ---- being executed. The effect of this is that as exception propogation causes the Python stack to unwind, the callback is called upon ! return to each frame as the exception propagates. Only trace functions receives these events; they are not needed by the profiler. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** exceptions.tex 2 Jul 2002 16:17:58 -0000 1.7 --- exceptions.tex 28 Apr 2003 17:38:12 -0000 1.7.2.1 *************** *** 20,24 **** error. If returning due to an error, it is important to indicate to the caller that an error has been set. If the error is not handled or ! carefully propogated, additional calls into the Python/C API may not behave as intended and may fail in mysterious ways. --- 20,24 ---- error. If returning due to an error, it is important to indicate to the caller that an error has been set. If the error is not handled or ! carefully propagated, additional calls into the Python/C API may not behave as intended and may fail in mysterious ways. *************** *** 103,108 **** \NULL, the error indicator is cleared. Do not pass a \NULL{} type and non-\NULL{} value or traceback. The exception type should be a ! string or class; if it is a class, the value should be an instance ! of that class. Do not pass an invalid exception type or value. (Violating these rules will cause subtle problems later.) This call takes away a reference to each object: you must own a reference to --- 103,107 ---- \NULL, the error indicator is cleared. Do not pass a \NULL{} type and non-\NULL{} value or traceback. The exception type should be a ! string or class. Do not pass an invalid exception type or value. (Violating these rules will cause subtle problems later.) This call takes away a reference to each object: you must own a reference to *************** *** 111,115 **** function. I warned you.) \note{This function is normally only used by code that needs to save and restore the error indicator ! temporarily.} \end{cfuncdesc} --- 110,115 ---- function. I warned you.) \note{This function is normally only used by code that needs to save and restore the error indicator ! temporarily; use \cfunction{PyErr_Fetch()} to save the current ! exception state.} \end{cfuncdesc} *************** *** 125,129 **** This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. You need not increment its reference count. \end{cfuncdesc} --- 125,129 ---- This function is similar to \cfunction{PyErr_SetString()} but lets you specify an arbitrary Python object for the ``value'' of the ! exception. \end{cfuncdesc} *************** *** 209,212 **** --- 209,220 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyErr_SetExcFromWindowsErr}{PyObject *type, + int ierr} + Similar to \cfunction{PyErr_SetFromWindowsErr()}, with an additional + parameter specifying the exception type to be raised. + Availability: Windows. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErrWithFilename}{int ierr, char *filename} *************** *** 218,221 **** --- 226,237 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyErr_SetExcFromWindowsErrWithFilename} + {PyObject *type, int ierr, char *filename} + Similar to \cfunction{PyErr_SetFromWindowsErrWithFilename()}, with + an additional parameter specifying the exception type to be raised. + Availability: Windows. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{void}{PyErr_BadInternalCall}{} This is a shorthand for \samp{PyErr_SetString(PyExc_TypeError, *************** *** 250,257 **** These have the type \ctype{PyObject*}; they are all class objects. Their names are \cdata{PyExc_Warning}, \cdata{PyExc_UserWarning}, ! \cdata{PyExc_DeprecationWarning}, \cdata{PyExc_SyntaxWarning}, and ! \cdata{PyExc_RuntimeWarning}. \cdata{PyExc_Warning} is a subclass ! of \cdata{PyExc_Exception}; the other warning categories are ! subclasses of \cdata{PyExc_Warning}. For information about warning control, see the documentation for the --- 266,273 ---- These have the type \ctype{PyObject*}; they are all class objects. Their names are \cdata{PyExc_Warning}, \cdata{PyExc_UserWarning}, ! \cdata{PyExc_DeprecationWarning}, \cdata{PyExc_SyntaxWarning}, ! \cdata{PyExc_RuntimeWarning}, and \cdata{PyExc_FutureWarning}. ! \cdata{PyExc_Warning} is a subclass of \cdata{PyExc_Exception}; the ! other warning categories are subclasses of \cdata{PyExc_Warning}. For information about warning control, see the documentation for the Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** concrete.tex 20 Jun 2002 22:07:04 -0000 1.17 --- concrete.tex 28 Apr 2003 17:38:12 -0000 1.17.2.1 *************** *** 130,133 **** --- 130,152 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyInt_FromString}{char *str, char **pend, + int base} + Return a new \ctype{PyIntObject} or \ctype{PyLongObject} based on the + string value in \var{str}, which is interpreted according to the radix in + \var{base}. If \var{pend} is non-\NULL, \code{*\var{pend}} will point to + the first character in \var{str} which follows the representation of the + number. If \var{base} is \code{0}, the radix will be determined based on + the leading characters of \var{str}: if \var{str} starts with \code{'0x'} + or \code{'0X'}, radix 16 will be used; if \var{str} starts with + \code{'0'}, radix 8 will be used; otherwise radix 10 will be used. If + \var{base} is not \code{0}, it must be between \code{2} and \code{36}, + inclusive. Leading spaces are ignored. If there are no digits, + \exception{ValueError} will be raised. If the string represents a number + too large to be contained within the machine's \ctype{long int} type and + overflow warnings are being suppressed, a \ctype{PyLongObject} will be + returned. If overflow warnings are not being suppressed, \NULL{} will be + returned in this case. + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyInt_FromLong}{long ival} Creates a new integer object with a value of \var{ival}. *************** *** 150,153 **** --- 169,186 ---- \end{cfuncdesc} + \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongMask}{PyObject *io} + Will first attempt to cast the object to a \ctype{PyIntObject} or + \ctype{PyLongObject}, if it is not already one, and then return its + value as unsigned long. This function does not check for overflow. + \versionadded{2.3} + \end{cfuncdesc} + + \begin{cfuncdesc}{unsigned long}{PyInt_AsUnsignedLongLongMask}{PyObject *io} + Will first attempt to cast the object to a \ctype{PyIntObject} or + \ctype{PyLongObject}, if it is not already one, and then return its + value as unsigned long long, without checking for overflow. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{long}{PyInt_GetMax}{} Returns the system's idea of the largest integer it can handle *************** *** 215,219 **** point to the first character in \var{str} which follows the representation of the number. If \var{base} is \code{0}, the radix ! will be determined base on the leading characters of \var{str}: if \var{str} starts with \code{'0x'} or \code{'0X'}, radix 16 will be used; if \var{str} starts with \code{'0'}, radix 8 will be used; --- 248,252 ---- point to the first character in \var{str} which follows the representation of the number. If \var{base} is \code{0}, the radix ! will be determined based on the leading characters of \var{str}: if \var{str} starts with \code{'0x'} or \code{'0X'}, radix 16 will be used; if \var{str} starts with \code{'0'}, radix 8 will be used; *************** *** 275,278 **** --- 308,323 ---- \end{cfuncdesc} + \begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLongMask}{PyObject *io} + Return a C \ctype{unsigned long} from a Python long integer, without + checking for overflow. + \versionadded{2.3} + \end{cfuncdesc} + + \begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLongLongMask}{PyObject *io} + Return a C \ctype{unsigned long long} from a Python long integer, without + checking for overflow. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{double}{PyLong_AsDouble}{PyObject *pylong} Returns a C \ctype{double} representation of the contents of *************** *** 318,321 **** --- 363,372 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyFloat_FromString}{PyObject *str, char **pend} + Creates a \ctype{PyFloatObject} object based on the string value in + \var{str}, or \NULL{} on failure. The \var{pend} argument is ignored. It + remains only for backward compatibility. + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyFloat_FromDouble}{double v} Creates a \ctype{PyFloatObject} object from \var{v}, or \NULL{} on *************** *** 534,548 **** \begin{cfuncdesc}{char*}{PyString_AsString}{PyObject *string} ! Returns a null-terminated representation of the contents of \var{string}. The pointer refers to the internal buffer of \var{string}, not a copy. The data must not be modified in any way, unless the string was just created using \code{PyString_FromStringAndSize(NULL, \var{size})}. ! It must not be deallocated. \end{cfuncdesc} \begin{cfuncdesc}{char*}{PyString_AS_STRING}{PyObject *string} Macro form of \cfunction{PyString_AsString()} but without error ! checking. \end{cfuncdesc} --- 585,604 ---- \begin{cfuncdesc}{char*}{PyString_AsString}{PyObject *string} ! Returns a NUL-terminated representation of the contents of \var{string}. The pointer refers to the internal buffer of \var{string}, not a copy. The data must not be modified in any way, unless the string was just created using \code{PyString_FromStringAndSize(NULL, \var{size})}. ! It must not be deallocated. If \var{string} is a Unicode object, ! this function computes the default encoding of \var{string} and ! operates on that. If \var{string} is not a string object at all, ! \cfunction{PyString_AsString()} returns \NULL{} and raises ! \exception{TypeError}. \end{cfuncdesc} \begin{cfuncdesc}{char*}{PyString_AS_STRING}{PyObject *string} Macro form of \cfunction{PyString_AsString()} but without error ! checking. Only string objects are supported; no Unicode objects ! should be passed. \end{cfuncdesc} *************** *** 550,554 **** char **buffer, int *length} ! Returns a null-terminated representation of the contents of the object \var{obj} through the output variables \var{buffer} and \var{length}. --- 606,610 ---- char **buffer, int *length} ! Returns a NUL-terminated representation of the contents of the object \var{obj} through the output variables \var{buffer} and \var{length}. *************** *** 556,567 **** The function accepts both string and Unicode objects as input. For Unicode objects it returns the default encoded version of the ! object. If \var{length} is set to \NULL, the resulting buffer may ! not contain null characters; if it does, the function returns -1 and ! a \exception{TypeError} is raised. The buffer refers to an internal string buffer of \var{obj}, not a copy. The data must not be modified in any way, unless the string was just created using \code{PyString_FromStringAndSize(NULL, ! \var{size})}. It must not be deallocated. \end{cfuncdesc} --- 612,627 ---- The function accepts both string and Unicode objects as input. For Unicode objects it returns the default encoded version of the ! object. If \var{length} is \NULL, the resulting buffer may not ! contain NUL characters; if it does, the function returns \code{-1} ! and a \exception{TypeError} is raised. The buffer refers to an internal string buffer of \var{obj}, not a copy. The data must not be modified in any way, unless the string was just created using \code{PyString_FromStringAndSize(NULL, ! \var{size})}. It must not be deallocated. If \var{string} is a ! Unicode object, this function computes the default encoding of ! \var{string} and operates on that. If \var{string} is not a string ! object at all, \cfunction{PyString_AsString()} returns \NULL{} and ! raises \exception{TypeError}. \end{cfuncdesc} *************** *** 1286,1293 **** \begin{cfuncdesc}{PyObject*}{PyUnicode_Splitlines}{PyObject *s, ! int maxsplit} Split a Unicode string at line breaks, returning a list of Unicode ! strings. CRLF is considered to be one line break. The Line break ! characters are not included in the resulting strings. \end{cfuncdesc} --- 1346,1354 ---- \begin{cfuncdesc}{PyObject*}{PyUnicode_Splitlines}{PyObject *s, ! int keepend} Split a Unicode string at line breaks, returning a list of Unicode ! strings. CRLF is considered to be one line break. If \var{keepend} ! is 0, the Line break characters are not included in the resulting ! strings. \end{cfuncdesc} *************** *** 2376,2380 **** \begin{cfuncdesc}{PyObject*}{PyWeakref_GetObject}{PyObject *ref} Returns the referenced object from a weak reference, \var{ref}. If ! the referent is no longer live, returns \NULL. \versionadded{2.2} \end{cfuncdesc} --- 2437,2441 ---- \begin{cfuncdesc}{PyObject*}{PyWeakref_GetObject}{PyObject *ref} Returns the referenced object from a weak reference, \var{ref}. If ! the referent is no longer live, returns \code{None}. \versionadded{2.2} \end{cfuncdesc} Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** abstract.tex 14 Jun 2002 14:35:56 -0000 1.17 --- abstract.tex 28 Apr 2003 17:38:12 -0000 1.17.2.1 *************** *** 167,172 **** the Unicode string representation on success, \NULL{} on failure. This is the equivalent of the Python expression ! \samp{unistr(\var{o})}. Called by the ! \function{unistr()}\bifuncindex{unistr} built-in function. \end{cfuncdesc} --- 167,172 ---- the Unicode string representation on success, \NULL{} on failure. This is the equivalent of the Python expression ! \samp{unicode(\var{o})}. Called by the ! \function{unicode()}\bifuncindex{unicode} built-in function. \end{cfuncdesc} *************** *** 176,185 **** \code{-1} and sets an exception. If \var{cls} is a type object rather than a class object, \cfunction{PyObject_IsInstance()} ! returns \code{1} if \var{inst} is of type \var{cls}. If \var{inst} ! is not a class instance and \var{cls} is neither a type object or ! class object, \var{inst} must have a \member{__class__} attribute --- the class relationship of the value of that attribute with \var{cls} will be used to determine the result of this function. \versionadded{2.1} \end{cfuncdesc} --- 176,189 ---- \code{-1} and sets an exception. If \var{cls} is a type object rather than a class object, \cfunction{PyObject_IsInstance()} ! returns \code{1} if \var{inst} is of type \var{cls}. If \var{cls} ! is a tuple, the check will be done against every entry in \var{cls}. ! The result will be \code{1} when at least one of the checks returns ! \code{1}, otherwise it will be \code{0}. If \var{inst} is not a class ! instance and \var{cls} is neither a type object, nor a class object, ! nor a tuple, \var{inst} must have a \member{__class__} attribute --- the class relationship of the value of that attribute with \var{cls} will be used to determine the result of this function. \versionadded{2.1} + \versionchanged[Support for a tuple as the second argument added]{2.2} \end{cfuncdesc} *************** *** 202,209 **** Returns \code{1} if the class \var{derived} is identical to or derived from the class \var{cls}, otherwise returns \code{0}. In ! case of an error, returns \code{-1}. If either \var{derived} or ! \var{cls} is not an actual class object, this function uses the ! generic algorithm described above. \versionadded{2.1} \end{cfuncdesc} --- 206,218 ---- Returns \code{1} if the class \var{derived} is identical to or derived from the class \var{cls}, otherwise returns \code{0}. In ! case of an error, returns \code{-1}. If \var{cls} ! is a tuple, the check will be done against every entry in \var{cls}. ! The result will be \code{1} when at least one of the checks returns ! \code{1}, otherwise it will be \code{0}. If either \var{derived} or ! \var{cls} is not an actual class object (or tuple), this function ! uses the generic algorithm described above. \versionadded{2.1} + \versionchanged[Older versions of Python did not support a tuple + as the second argument]{2.3} \end{cfuncdesc} *************** *** 228,231 **** --- 237,241 ---- or \samp{\var{callable_object}(*\var{args}, **\var{kw})}. \bifuncindex{apply} + \versionadded{2.2} \end{cfuncdesc} *************** *** 301,305 **** Returns \code{1} if the object \var{o} is considered to be true, and \code{0} otherwise. This is equivalent to the Python expression ! \samp{not not \var{o}}. This function always succeeds. \end{cfuncdesc} --- 311,322 ---- Returns \code{1} if the object \var{o} is considered to be true, and \code{0} otherwise. This is equivalent to the Python expression ! \samp{not not \var{o}}. On failure, return \code{-1}. ! \end{cfuncdesc} ! ! ! \begin{cfuncdesc}{int}{PyObject_Not}{PyObject *o} ! Returns \code{0} if the object \var{o} is considered to be true, and ! \code{1} otherwise. This is equivalent to the Python expression ! \samp{not \var{o}}. On failure, return \code{-1}. \end{cfuncdesc} *************** *** 309,314 **** the object type of object \var{o}. On failure, raises \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}. ! \bifuncindex{type} \end{cfuncdesc} --- 326,335 ---- the object type of object \var{o}. On failure, raises \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}.\bifuncindex{type} ! This function increments the reference count of the return value. ! There's really no reason to use this function instead of the ! common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \ctype{PyTypeObject*}, except when the incremented reference ! count is needed. \end{cfuncdesc} *************** *** 651,656 **** \begin{cfuncdesc}{PyObject*}{PyNumber_Int}{PyObject *o} Returns the \var{o} converted to an integer object on success, or ! \NULL{} on failure. This is the equivalent of the Python expression ! \samp{int(\var{o})}.\bifuncindex{int} \end{cfuncdesc} --- 672,678 ---- \begin{cfuncdesc}{PyObject*}{PyNumber_Int}{PyObject *o} Returns the \var{o} converted to an integer object on success, or ! \NULL{} on failure. If the argument is outside the integer range ! a long object will be returned instead. This is the equivalent ! of the Python expression \samp{int(\var{o})}.\bifuncindex{int} \end{cfuncdesc} *************** *** 988,992 **** \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, ! const char **buffer, int *buffer_len} Returns a pointer to a writeable memory location. The \var{obj} --- 1010,1014 ---- \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, ! char **buffer, int *buffer_len} Returns a pointer to a writeable memory location. The \var{obj} From jhylton@users.sourceforge.net Mon Apr 28 18:40:04 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:40:04 -0700 Subject: [Python-checkins] python/dist/src/Demo/pdist rrcs.py,1.6,1.6.30.1 rcvs.py,1.21,1.21.30.1 rcslib.py,1.8,1.8.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/pdist In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/pdist Modified Files: Tag: ast-branch rrcs.py rcvs.py rcslib.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: rrcs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rrcs.py,v retrieving revision 1.6 retrieving revision 1.6.30.1 diff -C2 -d -r1.6 -r1.6.30.1 *** rrcs.py 27 Nov 1996 19:49:26 -0000 1.6 --- rrcs.py 28 Apr 2003 17:38:41 -0000 1.6.30.1 *************** *** 103,117 **** flags = flags[1:] data = x.get(fn) ! tfn = tempfile.mktemp() ! try: ! tf = open(tfn, 'w') ! tf.write(data) ! tf.close() ! print 'diff %s -r%s %s' % (flags, x.head(fn), fn) ! sts = os.system('diff %s %s %s' % (flags, tfn, fn)) ! if sts: ! print '='*70 ! finally: ! remove(tfn) def same(x, copts, fn, data = None): --- 103,113 ---- flags = flags[1:] data = x.get(fn) ! tf = tempfile.NamedTemporaryFile() ! tf.write(data) ! tf.flush() ! print 'diff %s -r%s %s' % (flags, x.head(fn), fn) ! sts = os.system('diff %s %s %s' % (flags, tf.name, fn)) ! if sts: ! print '='*70 def same(x, copts, fn, data = None): Index: rcvs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rcvs.py,v retrieving revision 1.21 retrieving revision 1.21.30.1 diff -C2 -d -r1.21 -r1.21.30.1 *** rcvs.py 27 Nov 1996 19:49:24 -0000 1.21 --- rcvs.py 28 Apr 2003 17:38:42 -0000 1.21.30.1 *************** *** 173,187 **** return import tempfile ! tfn = tempfile.mktemp() ! try: ! tf = open(tfn, 'w') ! tf.write(data) ! tf.close() ! print 'diff %s -r%s %s' % (flags, rev, fn) ! sts = os.system('diff %s %s %s' % (flags, tfn, fn)) ! if sts: ! print '='*70 ! finally: ! remove(tfn) def commitcheck(self): --- 173,183 ---- return import tempfile ! tf = tempfile.NamedTemporaryFile() ! tf.write(data) ! tf.flush() ! print 'diff %s -r%s %s' % (flags, rev, fn) ! sts = os.system('diff %s %s %s' % (flags, tf.name, fn)) ! if sts: ! print '='*70 def commitcheck(self): Index: rcslib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rcslib.py,v retrieving revision 1.8 retrieving revision 1.8.18.1 diff -C2 -d -r1.8 -r1.8.18.1 *** rcslib.py 20 Jul 2001 19:00:52 -0000 1.8 --- rcslib.py 28 Apr 2003 17:38:43 -0000 1.8.18.1 *************** *** 144,163 **** message = message + '\n' lockflag = "-u" ! textfile = None ! try: ! if new: ! textfile = tempfile.mktemp() ! f = open(textfile, 'w') ! f.write(message) ! f.close() ! cmd = 'ci %s%s -t%s %s %s' % \ ! (lockflag, rev, textfile, otherflags, name) ! else: ! message = regsub.gsub('\([\\"$`]\)', '\\\\\\1', message) ! cmd = 'ci %s%s -m"%s" %s %s' % \ ! (lockflag, rev, message, otherflags, name) ! return self._system(cmd) ! finally: ! if textfile: self._remove(textfile) # --- Exported support methods --- --- 144,158 ---- message = message + '\n' lockflag = "-u" ! if new: ! f = tempfile.NamedTemporaryFile() ! f.write(message) ! f.flush() ! cmd = 'ci %s%s -t%s %s %s' % \ ! (lockflag, rev, f.name, otherflags, name) ! else: ! message = regsub.gsub('\([\\"$`]\)', '\\\\\\1', message) ! cmd = 'ci %s%s -m"%s" %s %s' % \ ! (lockflag, rev, message, otherflags, name) ! return self._system(cmd) # --- Exported support methods --- From jhylton@users.sourceforge.net Mon Apr 28 18:40:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:40:05 -0700 Subject: [Python-checkins] python/dist/src/Demo/metaclasses Eiffel.py,1.3,1.3.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/metaclasses In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/metaclasses Modified Files: Tag: ast-branch Eiffel.py Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: Eiffel.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/metaclasses/Eiffel.py,v retrieving revision 1.3 retrieving revision 1.3.30.1 diff -C2 -d -r1.3 -r1.3.30.1 *** Eiffel.py 14 Sep 1998 16:44:13 -0000 1.3 --- Eiffel.py 28 Apr 2003 17:39:02 -0000 1.3.30.1 *************** *** 29,33 **** class D(C): def m1(self, arg): ! return whatever**2 def m1_post(self, Result, arg): C.m1_post(self, Result, arg) --- 29,33 ---- class D(C): def m1(self, arg): ! return arg**2 def m1_post(self, Result, arg): C.m1_post(self, Result, arg) From jhylton@users.sourceforge.net Mon Apr 28 18:40:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:40:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/info Makefile,1.8,1.8.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/info In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc/info Modified Files: Tag: ast-branch Makefile Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/info/Makefile,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** Makefile 3 May 2002 04:50:51 -0000 1.8 --- Makefile 28 Apr 2003 17:38:01 -0000 1.8.2.1 *************** *** 35,66 **** python$(VERSION)-api.info: ../api/api.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-ext.info: ../ext/ext.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-lib.info: ../lib/lib.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ # Not built by default; the conversion doesn't really handle it well. python$(VERSION)-mac.info: ../mac/mac.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-ref.info: ../ref/ref.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-tut.info: ../tut/tut.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ # Not built by default; the conversion doesn't handle it at all. python$(VERSION)-doc.info: ../doc/doc.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-dist.info: ../dist/dist.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ # Not built by default; the conversion chokes on two @end multitable's python$(VERSION)-inst.info: ../inst/inst.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ clean: --- 35,66 ---- python$(VERSION)-api.info: ../api/api.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-ext.info: ../ext/ext.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-lib.info: ../lib/lib.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ # Not built by default; the conversion doesn't really handle it well. python$(VERSION)-mac.info: ../mac/mac.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-ref.info: ../ref/ref.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-tut.info: ../tut/tut.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ # Not built by default; the conversion doesn't handle it at all. python$(VERSION)-doc.info: ../doc/doc.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-dist.info: ../dist/dist.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ # Not built by default; the conversion chokes on two @end multitable's python$(VERSION)-inst.info: ../inst/inst.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ clean: From jhylton@users.sourceforge.net Mon Apr 28 18:40:04 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:40:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.40,1.40.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc/inst Modified Files: Tag: ast-branch inst.tex Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.40 retrieving revision 1.40.2.1 diff -C2 -d -r1.40 -r1.40.2.1 *** inst.tex 24 May 2002 17:06:17 -0000 1.40 --- inst.tex 28 Apr 2003 17:37:59 -0000 1.40.2.1 *************** *** 18,22 **** \author{Greg Ward} ! \authoraddress{Email: \email{gward@python.net}} \makeindex --- 18,22 ---- \author{Greg Ward} ! \authoraddress{Email: \email{distutils-sig@python.org}} \makeindex *************** *** 120,124 **** If all these things are true, then you already know how to build and ! install the modules you've just downloaded: run the command above. Unless you need to install things in a non-standard way or customize the build process, you don't really need this manual. Or rather, the above --- 120,124 ---- If all these things are true, then you already know how to build and ! install the modules you've just downloaded: Run the command above. Unless you need to install things in a non-standard way or customize the build process, you don't really need this manual. Or rather, the above *************** *** 169,188 **** \end{verbatim} ! On Mac OS, you have to go through a bit more effort to supply ! command-line arguments to the setup script: ! \begin{itemize} ! \item hit option-double-click on the script's icon (or option-drop it ! onto the Python interpreter's icon) ! \item press the ``Set unix-style command line'' button ! \item set the ``Keep stdio window open on termination'' if you're ! interested in seeing the output of the setup script (which is usually ! voluminous and often useful) ! \item when the command-line dialog pops up, enter ``install'' (you ! can, of course, enter any Distutils command-line as described in this ! document or in \citetitle[../dist/dist.html]{Distributing Python ! Modules}: just leave off the initial \code{python setup.py} and ! you'll be fine) ! \end{itemize} ! \subsection{Splitting the job up} --- 169,177 ---- \end{verbatim} ! On Mac OS 9, you double-click the \file{setup.py} script. It will bring ! up a dialog where you can select the \command{install} command. Then ! selecting the \command{run} button will install your distribution. ! The dialog is built dynamically, so all commands and options for this ! specific distribution are listed. \subsection{Splitting the job up} *************** *** 194,198 **** can use the setup script to do one thing at a time. This is particularly helpful when the build and install will be done by ! different users---e.g., you might want to build a module distribution and hand it off to a system administrator for installation (or do it yourself, with super-user privileges). --- 183,187 ---- can use the setup script to do one thing at a time. This is particularly helpful when the build and install will be done by ! different users---for example, you might want to build a module distribution and hand it off to a system administrator for installation (or do it yourself, with super-user privileges). *************** *** 321,325 **** Under \UNIX, just type \code{python} at the shell prompt. Under Windows, choose \menuselection{Start \sub Programs \sub Python ! 2.1 \sub Python (command line)}. Under Mac OS, \XXX{???}. Once the interpreter is started, you type Python code at the prompt. For example, on my Linux system, I type the three Python --- 310,314 ---- Under \UNIX, just type \code{python} at the shell prompt. Under Windows, choose \menuselection{Start \sub Programs \sub Python ! 2.1 \sub Python (command line)}. Under Mac OS 9, start \file{PythonInterpreter}. Once the interpreter is started, you type Python code at the prompt. For example, on my Linux system, I type the three Python *************** *** 599,609 **** \end{verbatim} ! The specified installation directories are relative to \filevar{prefix}. ! Of course, you also have to ensure that these directories are in ! Python's module search path, e.g. by putting a \file{.pth} file in ! \filevar{prefix}. ! ! % \XXX should have a section describing \file{.pth} files and ! % cross-ref it here If you want to define an entire installation scheme, you just have to --- 588,596 ---- \end{verbatim} ! The specified installation directories are relative to ! \filevar{prefix}. Of course, you also have to ensure that these ! directories are in Python's module search path, such as by putting a ! \file{.pth} file in \filevar{prefix}. See section~\ref{search-path} ! to find out how to modify Python's search path. If you want to define an entire installation scheme, you just have to *************** *** 683,687 **** define a few extra variables that may not be in your environment, such as \code{\$PLAT}. (And of course, on systems that don't have ! environment variables, such as Mac OS (\XXX{true?}), the configuration variables supplied by the Distutils are the only ones you can use.) See section~\ref{config-files} for details. --- 670,674 ---- define a few extra variables that may not be in your environment, such as \code{\$PLAT}. (And of course, on systems that don't have ! environment variables, such as Mac OS 9, the configuration variables supplied by the Distutils are the only ones you can use.) See section~\ref{config-files} for details. *************** *** 691,694 **** --- 678,766 ---- + % XXX I'm not sure where this section should go. + \subsection{Modifying Python's Search Path} + \label{search-path} + + When the Python interpreter executes an \keyword{import} statement, it + searches for both Python code and extension modules along a search + path. A default value for the path is configured into the Python + binary when the interpreter is built. You can determine the path by + importing the \module{sys} module and printing the value of + \code{sys.path}. + + \begin{verbatim} + $ python + Python 2.2 (#11, Oct 3 2002, 13:31:27) + [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 + Type ``help'', ``copyright'', ``credits'' or ``license'' for more information. + >>> import sys + >>> sys.path + ['', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-linux2', + '/usr/local/lib/python2.3/lib-tk', '/usr/local/lib/python2.3/lib-dynload', + '/usr/local/lib/python2.3/site-packages'] + >>> + \end{verbatim} + + The null string in \code{sys.path} represents the current working + directory. + + The expected convention for locally installed packages is to put them + in the \file{.../site-packages/} directory, but you may want to + install Python modules into some arbitrary directory. For example, + your site may have a convention of keeping all software related to the + web server under \file{/www}. Add-on Python modules might then belong + in \file{/www/python}, and in order to import them, this directory + must be added to \code{sys.path}. There are several different ways to + add the directory. + + The most convenient way is to add a path configuration file to a + directory that's already on Python's path, usually to the + \file{.../site-packages/} directory. Path configuration files have an + extension of \file{.pth}, and each line must contain a single path + that will be appended to \code{sys.path}. (Because the new paths are + appended to \code{sys.path}, modules in the added directories will not + override standard modules. This means you can't use this mechanism + for installing fixed versions of standard modules.) + + Paths can be absolute or relative, in which case they're relative to + the directory containing the \file{.pth} file. Any directories added + to the search path will be scanned in turn for \file{.pth} files. See + \citetitle[http://www.python.org/dev/doc/devel/lib/module-site.html]{the + documentation for the \module{site} module} for more information. + + A slightly less convenient way is to edit the \file{site.py} file in + Python's standard library, and modify \code{sys.path}. \file{site.py} + is automatically imported when the Python interpreter is executed, + unless the \programopt{-S} switch is supplied to suppress this + behaviour. So you could simply edit \file{site.py} and add two lines to it: + + \begin{verbatim} + import sys + sys.path.append('/www/python/') + \end{verbatim} + + However, if you reinstall the same major version of Python (perhaps + when upgrading from 2.2 to 2.2.2, for example) \file{site.py} will be + overwritten by the stock version. You'd have to remember that it was + modified and save a copy before doing the installation. + + There are two environment variables that can modify \code{sys.path}. + \envvar{PYTHONHOME} sets an alternate value for the prefix of the + Python installation. For example, if \envvar{PYTHONHOME} is set to + \samp{/www/python}, the search path will be set to \code{['', + '/www/python/lib/python2.2/', '/www/python/lib/python2.3/plat-linux2', + ...]}. + + The \envvar{PYTHONPATH} variable can be set to a list of paths that + will be added to the beginning of \code{sys.path}. For example, if + \envvar{PYTHONPATH} is set to \samp{/www/python:/opt/py}, the search + path will begin with \code{['/www/python', '/opt/py']}. (Note that + directories must exist in order to be added to \code{sys.path}; the + \module{site} module removes paths that don't exist.) + + Finally, \code{sys.path} is just a regular Python list, so any Python + application can modify it by adding or removing entries. + + \section{Distutils Configuration Files} \label{config-files} *************** *** 721,725 **** {Type of file}{Location and filename}{Notes} \lineiii{system}{\filenq{\filevar{prefix}\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}distutils.cfg}}{(4)} ! \lineiii{personal}{\filenq{\%HOME\textbackslash{}pydistutils.cfg}}{(5)} \lineiii{local}{\filenq{setup.cfg}}{(3)} \end{tableiii} --- 793,797 ---- {Type of file}{Location and filename}{Notes} \lineiii{system}{\filenq{\filevar{prefix}\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}distutils.cfg}}{(4)} ! \lineiii{personal}{\filenq{\%HOME\%\textbackslash{}pydistutils.cfg}}{(5)} \lineiii{local}{\filenq{setup.cfg}}{(3)} \end{tableiii} *************** *** 744,748 **** \item[(2)] On \UNIX, if the \envvar{HOME} environment variable is not defined, the user's home directory will be determined with the ! \function{getpwuid()} function from the standard \module{pwd} module. \item[(3)] I.e., in the current directory (usually the location of the setup script). --- 816,821 ---- \item[(2)] On \UNIX, if the \envvar{HOME} environment variable is not defined, the user's home directory will be determined with the ! \function{getpwuid()} function from the standard ! \ulink{\module{pwd}}{../lib/module-pwd.html} module. \item[(3)] I.e., in the current directory (usually the location of the setup script). *************** *** 861,867 **** module. Lines have the following structure: ! \begin{verbatim} ! ... [ ...] [ ...] [ ...] ! \end{verbatim} Let's examine each of the fields in turn. --- 934,940 ---- module. Lines have the following structure: ! \begin{alltt} ! \var{module} ... [\var{sourcefile} ...] [\var{cpparg} ...] [\var{library} ...] ! \end{alltt} Let's examine each of the fields in turn. *************** *** 870,887 **** \item \var{module} is the name of the extension module to be built, ! and should be a valid Python identifier. You can't just change this ! in order to rename a module (edits to the source code would also be ! needed), so this should be left alone. \item \var{sourcefile} is anything that's likely to be a source code ! file, at least judging by the filename. Filenames ending in .c are ! assumed to be written in C, filenames ending in .C, .cc, .c++ are ! assumed to be \Cpp, and filenames ending in .m or .mm are assumed to ! be in Objective C. \item \var{cpparg} is an argument for the C preprocessor, ! and is anything starting with -I, -D, -U or -C . ! \item is anything ending in .a or beginning with -l or -L. \end{itemize} --- 943,963 ---- \item \var{module} is the name of the extension module to be built, ! and should be a valid Python identifier. You can't just change ! this in order to rename a module (edits to the source code would ! also be needed), so this should be left alone. \item \var{sourcefile} is anything that's likely to be a source code ! file, at least judging by the filename. Filenames ending in ! \file{.c} are assumed to be written in C, filenames ending in ! \file{.C}, \file{.cc}, and \file{.c++} are assumed to be ! \Cpp, and filenames ending in \file{.m} or \file{.mm} are ! assumed to be in Objective C. \item \var{cpparg} is an argument for the C preprocessor, ! and is anything starting with \programopt{-I}, \programopt{-D}, ! \programopt{-U} or \programopt{-C}. ! \item \var{library} is anything ending in \file{.a} or beginning with ! \programopt{-l} or \programopt{-L}. \end{itemize} *************** *** 895,899 **** must be linked with the math library \file{libm.a} on your platform, ! simply add \samp{-lm} to the line: \begin{verbatim} --- 971,975 ---- must be linked with the math library \file{libm.a} on your platform, ! simply add \programopt{-lm} to the line: \begin{verbatim} *************** *** 902,907 **** Arbitrary switches intended for the compiler or the linker can be ! supplied with the \code{-Xcompiler \var{arg}} and \code{-Xlinker ! \var{arg}} options: \begin{verbatim} --- 978,983 ---- Arbitrary switches intended for the compiler or the linker can be ! supplied with the \programopt{-Xcompiler} \var{arg} and ! \programopt{-Xlinker} \var{arg} options: \begin{verbatim} *************** *** 909,919 **** \end{verbatim} ! The next option after \code{-Xcompiler} and \code{-Xlinker} will be ! appended to the proper command line, so in the above example the ! compiler will be passed the \samp{-o32} option, and the linker will be ! passed \samp{-shared}. If a compiler option requires an argument, ! you'll have to supply multiple \code{-Xcompiler} options; for example, ! to pass \code{-x c++} the \file{Setup} file would have to contain ! \code{-Xcompiler -x -Xcompiler c++}. Compiler flags can also be supplied through setting the --- 985,996 ---- \end{verbatim} ! The next option after \programopt{-Xcompiler} and ! \programopt{-Xlinker} will be appended to the proper command line, so ! in the above example the compiler will be passed the \programopt{-o32} ! option, and the linker will be passed \programopt{-shared}. If a ! compiler option requires an argument, you'll have to supply multiple ! \programopt{-Xcompiler} options; for example, to pass \code{-x c++} the ! \file{Setup} file would have to contain ! \code{-Xcompiler -x -Xcompiler c++}. Compiler flags can also be supplied through setting the *************** *** 978,982 **** including links to the download pages.} ! \seetitle[http://www.cyberus.ca/~g_will/pyExtenDL.shtml] {Creating Python Extensions Using Borland's Free Compiler} {Document describing how to use Borland's free command-line C++ --- 1055,1059 ---- including links to the download pages.} ! \seetitle[http://www.cyberus.ca/\~{}g_will/pyExtenDL.shtml] {Creating Python Extensions Using Borland's Free Compiler} {Document describing how to use Borland's free command-line C++ *************** *** 985,1000 **** ! \subsubsection{GNU C / Cygwin / MinGW32} This section describes the necessary steps to use Distutils with the ! GNU C/\Cpp{} compilers in their Cygwin and MinGW32 distributions.\footnote{Check \url{http://sources.redhat.com/cygwin/} and \url{http://www.mingw.org/} for more information} ! \XXX{For a Python which was built with Cygwin, all should work without ! any of these following steps.} ! ! These compilers also require some special libraries. This task is more complex than for Borland's \Cpp, because there is no program to convert the library. --- 1062,1076 ---- ! \subsubsection{GNU C / Cygwin / MinGW} This section describes the necessary steps to use Distutils with the ! GNU C/\Cpp{} compilers in their Cygwin and MinGW distributions.\footnote{Check \url{http://sources.redhat.com/cygwin/} and \url{http://www.mingw.org/} for more information} + For a Python interpreter that was built with Cygwin, everything should + work without any of these following steps. ! These compilers require some special libraries. This task is more complex than for Borland's \Cpp, because there is no program to convert the library. *************** *** 1034,1038 **** and for Cygwin in no-cygwin mode\footnote{Then you have no \POSIX{} emulation available, but you also don't need ! \file{cygwin1.dll}.} or for MinGW32 type: \begin{verbatim} --- 1110,1114 ---- and for Cygwin in no-cygwin mode\footnote{Then you have no \POSIX{} emulation available, but you also don't need ! \file{cygwin1.dll}.} or for MinGW type: \begin{verbatim} *************** *** 1046,1055 **** \begin{seealso} \seetitle[http://www.zope.org/Members/als/tips/win32_mingw_modules] ! {Building Python modules on MS Windows platform with MinGW32} ! {Information about building the required libraries for the MinGW32 environment.} \seeurl{http://pyopengl.sourceforge.net/ftp/win32-stuff/} ! {Converted import libraries in Cygwin/MinGW32 and Borland format, and a script to create the registry entries needed for Distutils to locate the built Python.} --- 1122,1131 ---- \begin{seealso} \seetitle[http://www.zope.org/Members/als/tips/win32_mingw_modules] ! {Building Python modules on MS Windows platform with MinGW} ! {Information about building the required libraries for the MinGW environment.} \seeurl{http://pyopengl.sourceforge.net/ftp/win32-stuff/} ! {Converted import libraries in Cygwin/MinGW and Borland format, and a script to create the registry entries needed for Distutils to locate the built Python.} From jhylton@users.sourceforge.net Mon Apr 28 18:40:08 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 28 Apr 2003 10:40:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/html style.css,1.23,1.23.2.1 index.html.in,1.16,1.16.2.1 about.html,1.5,1.5.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Doc/html Modified Files: Tag: ast-branch style.css index.html.in about.html Log Message: Merge head to this branch. Merge all sorts of changes from just before 2.3b1 into the ast branch. This should make the eventual merge back to the trunk easier. The merge is almost entirely porting changes into the ast-branch. There was no attempt to get changes to compile.c into newcompile.c. That work should be done when newcompile.c is closer to completion. The only significant conflicts appeared to be in pythonrun.c. Index: style.css =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/style.css,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -d -r1.23 -r1.23.2.1 *** style.css 14 Jun 2002 13:47:58 -0000 1.23 --- style.css 28 Apr 2003 17:38:03 -0000 1.23.2.1 *************** *** 68,74 **** margin-right: 2em; } ! div.warning .label { font-size: 110%; margin-right: 0.5em; } .release-info { font-style: italic; } --- 68,84 ---- margin-right: 2em; } ! div.warning .label { font-family: sans-serif; ! font-size: 110%; margin-right: 0.5em; } + div.note { background-color: #fffaf0; + border: thin solid black; + padding: 0.5em; + margin-left: 2em; + margin-right: 2em; } + + div.note .label { margin-right: 0.5em; + font-family: sans-serif; } + .release-info { font-style: italic; } *************** *** 80,83 **** --- 90,97 ---- font-size: 90%; } .verbatim { margin-left: 2em; } + .verbatim .footer { padding: 0.05in; + font-size: 85%; + background-color: #99ccff; + margin-right: 0.5in; } .grammar { background-color: #99ccff; Index: index.html.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/index.html.in,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -C2 -d -r1.16 -r1.16.2.1 *** index.html.in 1 Apr 2002 18:49:45 -0000 1.16 --- index.html.in 28 Apr 2003 17:38:04 -0000 1.16.2.1 *************** *** 6,10 **** --- 6,14 ---- content="Top-level index to the standard documentation for Python @RELEASE@."> + + + +