#11821: When running .sage files, pass the preparsed file through a pipe
---------------------------------+--------------------------
       Reporter:  jhpalmieri     |        Owner:
           Type:  defect         |       Status:  needs_work
       Priority:  major          |    Milestone:  sage-6.4
      Component:  scripts        |   Resolution:
       Keywords:                 |    Merged in:
        Authors:  John Palmieri  |    Reviewers:
Report Upstream:  N/A            |  Work issues:
         Branch:                 |       Commit:
   Dependencies:  #71            |     Stopgaps:
---------------------------------+--------------------------
Description changed by jdemeyer:

Old description:

> If you run "sage new.sage" on a script "new.sage", it creates a preparsed
> file "new.py".  Then when a file in the twisted package tries to import
> the "new" Python module, it ends up importing this preparsed file
> instead, which leads to problems which can be hard to track down.
>
> I can think of several solutions:
>
>  1. hope that users will know not to use names like "new.sage".  This is
> the current state of affairs, and it seems overly optimistic to me.
>  2. give a warning, or fail outright with an error, if the name of the
> file is the same as that of a Python module.
>  3. name the preparsed file something which is less likely to cause a
> clash, for example, turn "file.sage" into "file_preparsed.py".
>  4. don't save the preparsed file at all: write it to stdout, then run
> "sage-python -c <PREPARSED>" on it.
>
> The attached patch implements number 4.
>
> -----
>
> Apply
>
>  - [attachment:trac_11821-root.patch] to the root repo
>  - [attachment:trac_11821-preparse.v3.patch] to the scripts repo
>  - [attachment:trac_11821-doctests.patch] to the main Sage repo

New description:

 If you run "sage new.sage" on a script "new.sage", it creates a preparsed
 file "new.py".  Then when a file in the twisted package tries to import
 the "new" Python module, it ends up importing this preparsed file instead,
 which leads to problems which can be hard to track down.

 I can think of several solutions:

  1. hope that users will know not to use names like "new.sage".  This is
 the current state of affairs, and it seems overly optimistic to me.
  2. give a warning, or fail outright with an error, if the name of the
 file is the same as that of a Python module.
  3. name the preparsed file something which is less likely to cause a
 clash, for example, turn "file.sage" into "file_preparsed.py" (see
 #16955).
  4. don't save the preparsed file at all: write it to stdout, then run
 "sage-python -c <PREPARSED>" on it.

 The attached patch implements number 4.

 -----

 Apply

  - [attachment:trac_11821-root.patch] to the root repo
  - [attachment:trac_11821-preparse.v3.patch] to the scripts repo
  - [attachment:trac_11821-doctests.patch] to the main Sage repo

--

--
Ticket URL: <http://trac.sagemath.org/ticket/11821#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to