Opened 5 years ago

Closed 5 years ago

#16097 closed enhancement (fixed)

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

Reported by: wluebbe 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) Commit: 60f5622de6c95451e440c002327a87432e587ed4
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

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 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:2 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:3 Changed 5 years ago by aapitzsch

  • Authors set to André Apitzsch
  • Branch set to u/aapitzsch/ticket/16097
  • Commit set to 0765f1f2429ea60c3a389c23d9c4cd57ce0b9542
  • Status changed from new to needs_review

comment:4 Changed 5 years ago by jdemeyer

  • Status changed from needs_review to needs_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 5 years ago by jdemeyer

  • Description modified (diff)

comment:6 Changed 5 years ago by jdemeyer

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 follow-up: Changed 5 years ago by jdemeyer

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

comment:8 Changed 5 years ago by git

  • Commit changed from 0765f1f2429ea60c3a389c23d9c4cd57ce0b9542 to 60f5622de6c95451e440c002327a87432e587ed4

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

60f5622Revert "replace file by io.IOBase"

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

  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_work to needs_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 5 years ago by jdemeyer

  • Created changed from 04/08/14 13:05:29 to 04/08/14 13:05:29
  • Modified changed from 10/09/14 19:34:06 to 10/09/14 19:34:06
  • Status changed from needs_review to positive_review

comment:11 Changed 5 years ago by vbraun

  • Branch changed from u/aapitzsch/ticket/16097 to 60f5622de6c95451e440c002327a87432e587ed4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.