[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python3 work [was: The run up to Subversion 1.13.0]

From: Yasuhito FUTATSUKI <futatuki_at_poem.co.jp>
Date: Sat, 28 Sep 2019 17:17:11 +0900

On 2019/09/28 5:51, Johan Corveleyn wrote:

> Great! That fixes this particular problem, and the test suite now runs
> successfully ... almost. There seems to be one more problem:
>
> [[[
> Testing Release configuration on local repository.
> -- Running Swig Python tests --
> ..........................................................C:\Python37\lib\subprocess.py:858:
> ResourceWarning: subprocess
> 8548 is still running
> ResourceWarning, source=self)
> ResourceWarning: Enable tracemalloc to get the object allocation traceback
> C:\Python37\lib\unittest\case.py:628: ResourceWarning: unclosed file
> <_io.BufferedReader name=3>
> testMethod()
> ResourceWarning: Enable tracemalloc to get the object allocation traceback
> .C:\Python37\lib\unittest\case.py:628: ResourceWarning: unclosed file
> <_io.BufferedReader name='R:\\temp\\tmpryeb61g1'>
> testMethod()
> ResourceWarning: Enable tracemalloc to get the object allocation traceback
> ..............................................................................................
> ----------------------------------------------------------------------
> Ran 153 tests in 66.182s
>
> OK
> ]]]

On FreeBSD those warning are also produced.

[[[
futatuki_at_retina-alpha[15] make check-swig-py
if [ "LD_LIBRARY_PATH" = "DYLD_LIBRARY_PATH" ]; then for d in /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python/libsvn_swig_py /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python/../../../libsvn_*; do if [ -n "$DYLD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$d/.libs"; else LD_LIBRARY_PATH="$d/.libs"; fi; done; export LD_LIBRARY_PATH; fi; cd /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python; /usr/local/bin/python3.7 /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py
........................................................../usr/local/lib/python3.7/subprocess.py:858: ResourceWarning: subprocess 81136 is still running
   ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.7/unittest/case.py:615: ResourceWarning: unclosed file <_io.BufferedReader name=4>
   testMethod()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./usr/local/lib/python3.7/unittest/case.py:615: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/tmporh5038d'>
   testMethod()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
..............................................................................................
----------------------------------------------------------------------
Ran 153 tests in 10.773s

OK
]]]

I think these warnings comes from difference of warning between Python 2
and Python 3, and not affect quality of swig Python binding itself but
affect quality of its test code.

ResourceWarning itself appeared in Python 3.2

https://docs.python.org/3/whatsnew/3.2.html
(section "Other Language Changes")

If we can allow this warning and want to hide it, we can use
environment variable PYTHONWARNINGS='ignore::ResourceWarning::',
as the document above says.

[[[
futatuki_at_retina-alpha[17] env PYTHONWARNINGS='ignore::ResourceWarning::' make check-swig-py
if [ "LD_LIBRARY_PATH" = "DYLD_LIBRARY_PATH" ]; then for d in /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python/libsvn_swig_py /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python/../../../libsvn_*; do if [ -n "$DYLD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$d/.libs"; else LD_LIBRARY_PATH="$d/.libs"; fi; done; export LD_LIBRARY_PATH; fi; cd /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python; /usr/local/bin/python3.7 /home/futatuki/work/subversion/vwc/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py
.........................................................................................................................................................
----------------------------------------------------------------------
Ran 153 tests in 10.757s

OK
]]]

Of course, we can also resolve those warnings by fixing clean up code
on tests.

>
>>> (The warning about 'ruby' is not a big deal I suppose, but it's also
>>> something I saw when running gen-make.py with python 3.7 -- not when
>>> I'm running it with python 2.7)
>>
>> I think that message comes from build/generator/gen_win_dependencies.py,
>> GenDependenciesBase._find_ruby() line 967 (message from shell program
>> on Windows).
>>
>> https://svn.apache.org/viewvc/subversion/branches/swig-py3/build/generator/gen_win_dependencies.py?revision=1862754&view=markup#l967
>>
>> This may be also caused with Python 2, if 'ruby' is not in command
>> search path.
>
> Thanks. I'll try to take a closer look, but it's not a priority. It's
> still a bit strange to me that Python 2 doesn't show this warning
> while Python 3 does (environment is the same, PATH is the same, except
> for Python itself).

I suspect this may come from difference of implementation of os.popen()
and unittest library between Python 2 and Python 3, especially handling
of stderr of child process.

Cheers,

-- 
Yasuhito FUTATSUKI <futatuki_at_poem.co.jp>
Received on 2019-09-28 10:21:14 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.