On Tuesday, September 20, 2011 12:55:32 PM UTC-7, John H Palmieri wrote: > > Should "sage-preparse" name the preparsed file something safer, in order to > prevent name clashes like this? For example, turn FILE.sage into > FILE_preparsed.py? > > Following up to myself: the script "sage-sage", which is what gets run when you type "sage <options>" from the command line, says this about "sage -preparse" in its help message:
-preparse <file.sage> -- preparse file.sage and produce corresponding file.sage.py So according to this, we shouldn't be producing "file.py", but "file.sage.py" instead (assuming this wasn't a typo). Actually I think it's better to produce "file_sage.py" so that it has a chance of being a valid Python module name. The patch at <http://trac.sagemath.org/sage_trac/ticket/11821> makes "sage -preparse file.sage" write to "file_sage.py". It also makes "sage file.sage" not produce a preparsed file at all: it just writes the preparsed file to stdout, and then reads it back in again and passes it to sage. I think this is more or less how the "load" and "attach" commands work within Sage; for example, the "load" function (in sage/misc/preparser.py) says in part if fpath.endswith('.sage'): exec(preparse_file(open(fpath).read()) + "\n", globals) Anyway, please take a look at #11821. -- John -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org