Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 preparation: Handle removed execfile() function #16066

Closed
wluebbe mannequin opened this issue Apr 7, 2014 · 7 comments
Closed

Python 3 preparation: Handle removed execfile() function #16066

wluebbe mannequin opened this issue Apr 7, 2014 · 7 comments

Comments

@wluebbe
Copy link
Mannequin

wluebbe mannequin commented Apr 7, 2014

In Py2 there is the execfile() function, while in Py3 there is none.

The tool 2to3 changes the calls to execfile() to wrapped calls of the builtin open(), compile and exec() functions.
An example of a change lib2to3/fixes/fix_execfile.py is

-        execfile(fpath, globals)
+        exec(compile(open(fpath).read(), fpath, 'exec'), globals)

There are 2 occurences of execfile() in sage/misc/preparser.py.

The code has to depend on the Python version!

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

Component: distribution

Author: André Apitzsch

Branch/Commit: 4d24882

Reviewer: Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/16066

@wluebbe wluebbe mannequin added this to the sage-6.2 milestone Apr 7, 2014
@wluebbe wluebbe mannequin added c: distribution labels Apr 7, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@a-andre
Copy link

a-andre commented Jul 19, 2014

Commit: 4d24882

@a-andre
Copy link

a-andre commented Jul 19, 2014

Branch: u/aapitzsch/ticket/16066

@a-andre
Copy link

a-andre commented Jul 19, 2014

New commits:

4d24882replace execfile by python3 compatible functions

@a-andre
Copy link

a-andre commented Jul 19, 2014

Author: André Apitzsch

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:4

ok, looks good to me.

@vbraun
Copy link
Member

vbraun commented Sep 6, 2014

Changed branch from u/aapitzsch/ticket/16066 to 4d24882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants