Opened 9 years ago

Closed 8 years ago

#16097 closed enhancement (fixed)

Python 3 preparation: Replace Py2 file() builtin by open() builtin

Reported by: Wilfried Luebbe Owned by:
Priority: major Milestone: sage-6.4
Component: distribution Keywords: python3
Cc: Merged in:
Authors: André Apitzsch Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: 60f5622 (Commits, GitHub, GitLab) Commit: 60f5622de6c95451e440c002327a87432e587ed4
Dependencies: Stopgaps:

Status badges

Description (last modified by Jeroen Demeyer)

The Py2 builtin function file() is gone. It should be replaced with the open() builtin function.

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

Change History (11)

comment:1 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:2 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4

comment:3 Changed 8 years ago by aapitzsch

Authors: André Apitzsch
Branch: u/aapitzsch/ticket/16097
Commit: 0765f1f2429ea60c3a389c23d9c4cd57ce0b9542
Status: newneeds_review

comment:4 Changed 8 years ago by Jeroen Demeyer

Status: needs_reviewneeds_work

In Python 2, isinstance(f, file) is not equivalent to isinstance(f, io.IOBase).

I do give positive_review to the change from file() to open().

comment:5 Changed 8 years ago by Jeroen Demeyer

Description: modified (diff)

comment:6 Changed 8 years ago by Jeroen Demeyer

In the few cases where isinstance(data, file) is used, I actually think such behaviour should be deprecated: force the user to call foo(open(f).read()) instead of foo(open(f)).

comment:7 Changed 8 years ago by Jeroen Demeyer

The code in lattice_polytope.py is already deprecated anyway by #15240...

comment:8 Changed 8 years ago by git

Commit: 0765f1f2429ea60c3a389c23d9c4cd57ce0b954260f5622de6c95451e440c002327a87432e587ed4

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

60f5622Revert "replace file by io.IOBase"

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

Reviewers: Jeroen Demeyer
Status: needs_workneeds_review

Replying to jdemeyer:

The code in lattice_polytope.py is already deprecated anyway by #15240...

Only the desc parameter is deprecated there, not data being an instance of file.

Deprecation of isinstance(data, file) will be done in another ticket.

comment:10 Changed 8 years ago by Jeroen Demeyer

Created: Apr 8, 2014, 1:05:29 PMApr 8, 2014, 1:05:29 PM
Modified: Oct 9, 2014, 7:34:06 PMOct 9, 2014, 7:34:06 PM
Status: needs_reviewpositive_review

comment:11 Changed 8 years ago by Volker Braun

Branch: u/aapitzsch/ticket/1609760f5622de6c95451e440c002327a87432e587ed4
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.