Issue2563

classification
Title: Windows: ValueError: invalid encoding: None
Type: behaviour Severity: normal
Components: Versions: Jython 2.7
Milestone: Jython 2.7.1
process
Status: pending Resolution: fixed
Dependencies: Superseder:
Assigned To: stefan.richthofer Nosy List: stefan.richthofer
Priority: normal Keywords:

Created on 2017-03-03.13:58:26 by stefan.richthofer, last changed 2017-03-04.23:10:52 by stefan.richthofer.

Messages
msg11166 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-03-03.13:58:26
On Windows 10 I observe this or rather similar output frequently in test_io, test_io_jy and test_univnewlines:

Traceback (most recent call last):
  File "Lib\test\test_io.py", line 2504, in test_read_nonbytes
    t = self.TextIOWrapper(NonbytesStream('a'))
  File "D:\workspace\linux\Jython\ssh\jython\dist\Lib\_io.py", line 1037, in __init__
    raise ValueError("invalid encoding: %r" % encoding)
ValueError: invalid encoding: None

It always names one of these locations:

_io.py line 1037
_pyio.py line 1489
msg11177 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-03-04.23:10:52
Fixed as of https://hg.python.org/jython/rev/19080570ee62

test_io, test_io_jy and test_univnewlines pass now also on Windows.

This came from locale.py completely operating in fallback mode, while additionally assuming to be on posix. For now I fixed the crucieal points in locale.py, but the better, more sustainable fix would be to port _localemodule.c properly to Java (still locale.py would need adjustment for proper platform detection or needs to be added as PyShadowString-target to sys.platform).
However porting _localemodule should maybe better go directly into Jython 3...
History
Date User Action Args
2017-03-04 23:10:52stefan.richthofersetstatus: open -> pending
assignee: stefan.richthofer
resolution: fixed
messages: + msg11177
milestone: Jython 2.7.1
2017-03-03 13:58:26stefan.richthofercreate