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

ubuntu-bionic-standard (python 3.6): make ptest fails with UnicodeDecodeError #31191

Closed
mkoeppe opened this issue Jan 6, 2021 · 15 comments
Closed

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jan 6, 2021

(from #29913)

https://github.com/mkoeppe/sage/runs/1583194874?check_suite_focus=true

We apply a simple fix similar to the one in #30576.

To test: tox -e docker-ubuntu-bionic-standard

CC: @kliem @dimpase @jhpalmieri

Component: doctest framework

Author: Matthias Koeppe

Branch/Commit: c674c57

Reviewer: Jonathan Kliem

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

@mkoeppe mkoeppe added this to the sage-9.3 milestone Jan 6, 2021
@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 6, 2021

comment:1

Unclear where this is coming from - perhaps a source file without coding header?

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

comment:2

Something has changed on ubuntu-bionic since the fixes we made for Sage 9.2 (#30576). Now system python3.6 misbehaves although all LC_*/LANG variables are unset.

The specific failure can be fixed like this:

diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
index 7d2b84b9c3..ef5ec5c2e5 100644
--- a/src/sage/doctest/control.py
+++ b/src/sage/doctest/control.py
@@ -223,7 +223,7 @@ def skipfile(filename):
     base, ext = os.path.splitext(filename)
     if ext not in ('.py', '.pyx', '.pxd', '.pxi', '.sage', '.spyx', '.rst', '.tex'):
         return True
-    with open(filename) as F:
+    with open(filename, encoding="utf-8", errors="ignore") as F:
         line_count = 0
         for line in F:
             if nodoctest_regex.match(line):

but after that some individual doctest have similar unicode errors.
Setting the locale (for example LANG=C.UTF-8 make ptest) fixes all of these errors.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

comment:3

Likely this patch has made its way into ubuntu-bionic security updates. https://github.com/python/cpython/pull/8975/files

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

comment:4

That patch makes it sound as if the change is specific to FreeBSD, but I don't see that in the actual changes.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

Commit: c674c57

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

Author: Matthias Koeppe

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

New commits:

b3ff185src/bin/sage: Refactor all -t commands through a new function exec-runtests
c674c57src/bin/sage (-t): Set locale to an UTF-8 locale if LC_CTYPE is C or POSIX, for Python 3.6

@kliem
Copy link
Contributor

kliem commented Feb 14, 2021

Reviewer: Jonathan Kliem

@kliem
Copy link
Contributor

kliem commented Feb 14, 2021

comment:8

I think it is fine.

https://github.com/kliem/sage/pull/39/checks

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 14, 2021

comment:9

Thanks for testing! I didn't expect difficulties

@kliem
Copy link
Contributor

kliem commented Feb 15, 2021

comment:10

LGTM.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 15, 2021

comment:11

Thank you!

@vbraun
Copy link
Member

vbraun commented Mar 1, 2021

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