#16065: Python 3 preparation: Handle removed exec statement
-------------------------------------+-------------------------------------
       Reporter:  wluebbe            |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.4
      Component:  distribution       |   Resolution:
       Keywords:  python3            |    Merged in:
        Authors:  André Apitzsch     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  public/ticket/16065                |  67871a8566fc34de2fc3762a7cf1fce19e316dd9
   Dependencies:  #16712             |     Stopgaps:
-------------------------------------+-------------------------------------

Old description:

> In Py2 there is the
> [[https://docs.python.org/2/reference/simple_stmts.html#index-55|exec
> statement]], while in Py3 there is an
> [[https://docs.python.org/3.3/library/functions.html#exec|exec()
> function]].
>
> The tool 2to3 changes the {{{exec}}} statement into the {{{exec()}}}
> function.
> [[br]]
> But the function is not supported by Py2.
>
> There are 6 effected modules.
>
> This ticket is tracked as a dependency of meta-ticket ticket:16052.

New description:

 In Py2 there is the
 [[https://docs.python.org/2/reference/simple_stmts.html#index-55|exec
 statement]], while in Py3 there is an
 [[https://docs.python.org/3.3/library/functions.html#exec|exec()
 function]].

 The tool 2to3 changes the {{{exec}}} statement into the {{{exec()}}}
 function.
 [[br]]
 The tuple form of {{{exec}}} provides compatibility with Python 3, where
 {{{exec}}} is a function rather than a statement.

 There are 6 effected modules.

 This ticket is tracked as a dependency of meta-ticket ticket:16052.

--

Comment (by aapitzsch):

 See https://docs.python.org/2.7/reference/simple_stmts.html#exec

     The first expression may also be a tuple of length 2 or 3. In this
 case, the optional parts must be omitted. The form {{{exec(expr,
 globals)}}} is equivalent to {{{exec expr in globals}}}, while the form
 {{{exec(expr, globals, locals)}}} is equivalent to {{{exec expr in
 globals, locals}}}. The tuple form of {{{exec}}} provides compatibility
 with Python 3, where {{{exec}}} is a function rather than a statement.

--
Ticket URL: <http://trac.sagemath.org/ticket/16065#comment:10>
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