Fixes https://sourceforge.net/p/docutils/bugs/348/.
Currently there's a DeprecationWarning when using Python >= 3.4:
/usr/local/lib/python3.7/site-packages/docutils/io.py:245: DeprecationWarning: 'U' mode is deprecated
The attached patch uses mode r for Python >= 3.4, otherwise rU:
mode = 'r' if sys.version_info >= (3, 4) else 'rU'
Tests pass locally for Python 2.7.15 and Python 3.7.0:
⌂71% [hugo:/tmp/docutils-code/docutils] trunk(1) ‡ python2 test/alltests.py
Testing Docutils 0.15b.dev with Python 2.7.15 on 2018-09-08 at 15:30:43
OS: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 (darwin, Darwin-17.7.0-x86_64-i386-64bit)
Working directory: /private/tmp/docutils-code/docutils/test
Docutils package: /private/tmp/docutils-code/docutils/docutils
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 1388 tests in 9.967s
OK
Elapsed time: 12.112 seconds
[hugo:/tmp/docutils-code/docutils] trunk(1) 12s ‡ python3 test3/alltests.py
Testing Docutils 0.15b.dev with Python 3.7.0 on 2018-09-08 at 15:31:06
OS: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 (darwin, Darwin-17.7.0-x86_64-i386-64bit)
Working directory: /private/tmp/docutils-code/docutils/test3
Docutils package: /private/tmp/docutils-code/docutils/build/lib/docutils
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 1391 tests in 8.363s
OK
Elapsed time: 9.726 seconds
... and a test that fails before and passes after applying ... :-)
Here's the patch with a test that fails on Python 3.7 before, and passes after.
Before:
After:
Applied by grubert in [r8228]
Related
Commit: [r8228]