Opened 7 years ago
Closed 6 years ago
#16065 closed enhancement (fixed)
Python 3 preparation: Handle removed exec statement
Reported by: | wluebbe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | distribution | Keywords: | python3 |
Cc: | Merged in: | ||
Authors: | André Apitzsch | Reviewers: | Frédéric Chapoton |
Report Upstream: | N/A | Work issues: | |
Branch: | 67871a8 (Commits) | Commit: | 67871a8566fc34de2fc3762a7cf1fce19e316dd9 |
Dependencies: | #16712 | Stopgaps: |
Description (last modified by )
In Py2 there is the exec statement, while in Py3 there is an exec() function.
The tool 2to3 changes the exec
statement into the exec()
function.
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.
Change History (13)
comment:1 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:2 Changed 6 years ago by
- Branch set to u/aapitzsch/ticket/16065
- Commit set to b38818230b8eefa31bd202c1f145125c2c9bc5a4
- Status changed from new to needs_review
comment:3 Changed 6 years ago by
Hello, I have split up the first instance of exec, as this can be completely removed. Please have a look at #16712, and give it a positive review if you agree with it.
comment:4 Changed 6 years ago by
- Dependencies set to #16712
comment:5 Changed 6 years ago by
- Commit changed from b38818230b8eefa31bd202c1f145125c2c9bc5a4 to 61544317f67f8271ba970221e447071ec9599161
comment:6 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:7 follow-up: ↓ 8 Changed 6 years ago by
- Branch changed from u/aapitzsch/ticket/16065 to public/ticket/16065
- Commit changed from 61544317f67f8271ba970221e447071ec9599161 to 67871a8566fc34de2fc3762a7cf1fce19e316dd9
comment:8 in reply to: ↑ 7 Changed 6 years ago by
Frédéric, what's missing for a positive review?
comment:9 Changed 6 years ago by
I would give a positive review, but how can it be ok if exec() does not exists in python2 ?
"But the function is not supported by Py2." in the ticket description !
comment:10 Changed 6 years ago by
- Description modified (diff)
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 toexec expr in globals
, while the formexec(expr, globals, locals)
is equivalent toexec expr in globals, locals
. The tuple form ofexec
provides compatibility with Python 3, whereexec
is a function rather than a statement.
comment:12 Changed 6 years ago by
- Reviewers set to Frédéric Chapoton
comment:13 Changed 6 years ago by
- Branch changed from public/ticket/16065 to 67871a8566fc34de2fc3762a7cf1fce19e316dd9
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
use a python3 compatible syntax for exec statement