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
test_cleanup() of test_builtin failed #64798
Comments
http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/10150/steps/test/logs/stdio ====================================================================== Traceback (most recent call last):
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_builtin.py", line 1621, in test_cleanup
self.assertEqual(["before", "after"], out.decode().splitlines())
AssertionError: Lists differ: ['before', 'after'] != [] First list contains 2 additional elements.
|
It's probably linked to recent changes from issue bpo-19255. |
Unfortunately I can't reproduce this failure. We should look at how often this happens on buildbots. It is possible that adding flush=True in print() will solve the issue. |
New changeset 7ecee9e0dc58 by Serhiy Storchaka in branch 'default': |
I tried. It does not fix the issue. Hint: On Windows, sys.stdout.encoding is a codec implemented in pure Python (ex: cp850). You should try to reproduce the issue on Linux using PYTHONIOENCODING=cp850. Note: It looks like open() is no more available when C.__del__() is called. |
Ah, thank you for your hint Victor. This patch should fix the issue. |
Sorry, issue20599_ascii_ioencoding.patch doesn't fix the issue. (I also tested issue20599_ascii_ioencoding.patch + flush=True for print, it still fails sometimes.) |
What if use "-u" flag? "utf-8" or "utf_8" encoding? |
New changeset 10ea3125d7b8 by Victor Stinner in branch 'default': |
Sorry again, I didn't read issue20599_ascii_ioencoding.patch carefully: it doesn't make sense to use the isolated mode and to set a Python environment variable (PYTHONIOENCODING). The purpose of the isolated mode is to ignore all Python environment variables... I (hope I) fixed the test, but in fact, the test showed another bug: print() cannot be used during Python exit in destructor. It means for example that Python may not be able to display errors at exit. I don't know if this issue should be closed. Maybe a new issue should be opened to address the codec issue at exit? |
Now test fails with mystical error. http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/4074/steps/test/logs/stdio ====================================================================== Traceback (most recent call last):
File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_builtin.py", line 1628, in test_cleanup
__cleanenv=True)
File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\script_helper.py", line 69, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\script_helper.py", line 55, in _assert_python
"stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 2147483651, stderr follows:
Fatal Python error: Failed to initialize Windows random API (CryptoGen) |
May be setting PYTHONHASHSEED will silence this error. But I afraid there is a real bug in initialization on Windows. |
print() can be used during Python exit in destructor if destructor called before cleaning up the builtins and sys modules and encoding module with the encoding of sys.stdout. Cleaning up the builtins and sys modules are delayed after wiping other modules, this decreases the chance of print() failure. |
Another failure: ====================================================================== Traceback (most recent call last):
File "/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/test_builtin.py", line 1628, in test_cleanup
__cleanenv=True)
File "/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/script_helper.py", line 69, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/script_helper.py", line 55, in _assert_python
"stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 1, stderr follows:
Shared object "libpython3.4dm.so.1" not found, required by "python" |
New changeset 488ccbee6ee6 by Victor Stinner in branch 'default': |
This is probably is missing LD_LIBRARY_PATH environment variable.
Oh, it remembers me that Windows requires some environment variables to start, otherwise it fails badly. I modified the test to *not* start with an empty environment, it's not the purpose of the test. |
Ok, I filled issue bpo-20614 to track these bugs with __cleanenv=True. Serhiy>print() can be used during Python exit in destructor if destructor called before cleaning up the builtins and sys modules and encoding module with the encoding of sys.stdout. Ah ok. I tested with a codec implemented in Python, it works well. So it is very specific to test_cleanup() which hack builtins and sys modules to keep a reference their. I don't see anything else to do, I close the issue. |
New changeset 3d5154fa8413 by Serhiy Storchaka in branch '3.4': New changeset c978dffb95ac by Victor Stinner in branch '3.4': New changeset 1fb37d2d7d9d by Victor Stinner in branch '3.4': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: