Opened 9 years ago

Closed 8 years ago

#16065 closed enhancement (fixed)

Python 3 preparation: Handle removed exec statement

Reported by: Wilfried Luebbe 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, GitHub, GitLab) Commit: 67871a8566fc34de2fc3762a7cf1fce19e316dd9
Dependencies: #16712 Stopgaps:

Status badges

Description (last modified by aapitzsch)

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 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:2 Changed 8 years ago by aapitzsch

Authors: André Apitzsch
Branch: u/aapitzsch/ticket/16065
Commit: b38818230b8eefa31bd202c1f145125c2c9bc5a4
Status: newneeds_review

New commits:

b388182use a python3 compatible syntax for exec statement

comment:3 Changed 8 years ago by Frédéric Chapoton

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 8 years ago by aapitzsch

Dependencies: #16712

comment:5 Changed 8 years ago by git

Commit: b38818230b8eefa31bd202c1f145125c2c9bc5a461544317f67f8271ba970221e447071ec9599161

Branch pushed to git repo; I updated commit sha1. New commits:

cca73cbtrac #16712 removed bad use of exec
8287bb2trac #16712 reviewer wish
6154431Merge branch '16712' into py3_exec_statement

comment:6 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4

comment:7 Changed 8 years ago by Frédéric Chapoton

Branch: u/aapitzsch/ticket/16065public/ticket/16065
Commit: 61544317f67f8271ba970221e447071ec959916167871a8566fc34de2fc3762a7cf1fce19e316dd9

merged with 6.4.beta0


New commits:

67871a8Merge with 6.4.beta0

comment:8 in reply to:  7 Changed 8 years ago by aapitzsch

Frédéric, what's missing for a positive review?

comment:9 Changed 8 years ago by Frédéric Chapoton

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 8 years ago by aapitzsch

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 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.

comment:11 Changed 8 years ago by Frédéric Chapoton

Status: needs_reviewpositive_review

ok, then.

comment:12 Changed 8 years ago by Frédéric Chapoton

Reviewers: Frédéric Chapoton

comment:13 Changed 8 years ago by Volker Braun

Branch: public/ticket/1606567871a8566fc34de2fc3762a7cf1fce19e316dd9
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.