Opened 3 years ago

Closed 3 years ago

#24753 closed defect (fixed)

py3: fixes to sage.repl.rich_output

Reported by: embray Owned by:
Priority: major Milestone: sage-8.2
Component: python3 Keywords:
Cc: Merged in:
Authors: Erik Bray Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: b72b809 (Commits, GitHub, GitLab) Commit: b72b809e2057ce7414a688473a97f297200f3234
Dependencies: Stopgaps:

Status badges


Fixes most/all bytes/str issues in sage.repl.rich_output. In particular, this is an important counterpart to #24343, since without it most tests fail trivially due to incorrect treatment of bytes in the doctest output backend.

The most significant change in this branch is the addition of a new method: OutputBuffer.get_str(). This is plays a similar role to bytes_to_str, in that on Python 2 it is equivalent to OutputBuffer.get(), and on Python 3 it is equivalent to OutputBuffer.get_unicode(). In order for this code to work consistently across Python 2 and Python 3, most places that called OutputBuffer.get() are changed to use OutputBuffer.get_str() (except for some cases where we explicitly want bytes output, such as with binary data).

I'm happy to split this change off to a separate ticket from the other minor fixes if so demanded...

Change History (3)

comment:1 Changed 3 years ago by embray

  • Status changed from new to needs_review

comment:2 Changed 3 years ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

looks ok to me

comment:3 Changed 3 years ago by vbraun

  • Branch changed from u/embray/python3/sage-repl-rich_output to b72b809e2057ce7414a688473a97f297200f3234
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.