homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_builtin failure when run after test_tk
Type: crash Stage: resolved
Components: Tests, Tkinter Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, gpolo, iritkatriel, nadeem.vawda, serhiy.storchaka, terry.reedy, vstinner
Priority: normal Keywords:

Created on 2012年01月27日 10:54 by nadeem.vawda, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (8)
msg152084 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2012年01月27日 10:54
While investigating issue 13886, I found that test_builtin will fail when run
after test_tk:
 $ ./python -Wd -E -bb -m test -vuall test_tk test_builtin
 == CPython 3.3.0a0 (default:52f68c95e025, Jan 26 2012, 19:05:09) [GCC 4.6.1]
 == Linux-3.0.0-15-generic-x86_64-with-debian-wheezy-sid little-endian
 == /home/nadeem/src/cpython/def/build/test_python_4559
 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=1, verbose=0, bytes_warning=2, quiet=0)
 [... snip ...]
 ======================================================================
 FAIL: test_input_tty (test.test_builtin.BuiltinTest)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1075, in test_input_tty
 self.check_input_tty("prompt", b"quux")
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1059, in check_input_tty
 % (len(lines), child_output.read()))
 AssertionError: got 0 lines in pipe but expected 2, child output was:
 quux
 promptCurrent thread 0x00007fb3bbed5720:
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1036 in check_input_tty
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1075 in test_input_tty
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 385 in _executeTestPart
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 440 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 492 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 105 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 67 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 105 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 67 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/runner.py", line 168 in run
 File "/home/nadeem/src/cpython/def/Lib/test/support.py", line 1369 in _run_suite
 File "/home/nadeem/src/cpython/def/Lib/test/support.py", line 1403 in run_unittest
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1469 in test_main
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 1221 in runtest_inner
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 918 in runtest
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 710 in main
 File "/home/nadeem/src/cpython/def/Lib/test/__main__.py", line 13 in <module>
 File "/home/nadeem/src/cpython/def/Lib/runpy.py", line 73 in _run_code
 File "/home/nadeem/src/cpython/def/Lib/runpy.py", line 160 in _run_module_as_main
 ======================================================================
 FAIL: test_input_tty_non_ascii (test.test_builtin.BuiltinTest)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1079, in test_input_tty_non_ascii
 self.check_input_tty("prompté", b"quux\xe9", "utf-8")
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1059, in check_input_tty
 % (len(lines), child_output.read()))
 AssertionError: got 0 lines in pipe but expected 2, child output was:
 quux
 promptCurrent thread 0x00007fb3bbed5720:
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1036 in check_input_tty
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1079 in test_input_tty_non_ascii
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 385 in _executeTestPart
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 440 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 492 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 105 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 67 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 105 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 67 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/runner.py", line 168 in run
 File "/home/nadeem/src/cpython/def/Lib/test/support.py", line 1369 in _run_suite
 File "/home/nadeem/src/cpython/def/Lib/test/support.py", line 1403 in run_unittest
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1469 in test_main
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 1221 in runtest_inner
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 918 in runtest
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 710 in main
 File "/home/nadeem/src/cpython/def/Lib/test/__main__.py", line 13 in <module>
 File "/home/nadeem/src/cpython/def/Lib/runpy.py", line 73 in _run_code
 File "/home/nadeem/src/cpython/def/Lib/runpy.py", line 160 in _run_module_as_main
 ======================================================================
 FAIL: test_input_tty_non_ascii_unicode_errors (test.test_builtin.BuiltinTest)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1083, in test_input_tty_non_ascii_unicode_errors
 self.check_input_tty("prompté", b"quux\xe9", "ascii")
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1059, in check_input_tty
 % (len(lines), child_output.read()))
 AssertionError: got 0 lines in pipe but expected 2, child output was:
 quux
 prompt?[xcb] Unknown sequence number while processing queue
 [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
 [xcb] Aborting, sorry about that.
 python: ../../src/xcb_io.c:273: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
 Fatal Python error: Aborted
 Current thread 0x00007fb3bbed5720:
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1036 in check_input_tty
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1083 in test_input_tty_non_ascii_unicode_errors
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 385 in _executeTestPart
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 440 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/case.py", line 492 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 105 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 67 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 105 in run
 File "/home/nadeem/src/cpython/def/Lib/unittest/suite.py", line 67 in __call__
 File "/home/nadeem/src/cpython/def/Lib/unittest/runner.py", line 168 in run
 File "/home/nadeem/src/cpython/def/Lib/test/support.py", line 1369 in _run_suite
 File "/home/nadeem/src/cpython/def/Lib/test/support.py", line 1403 in run_unittest
 File "/home/nadeem/src/cpython/def/Lib/test/test_builtin.py", line 1469 in test_main
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 1221 in runtest_inner
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 918 in runtest
 File "/home/nadeem/src/cpython/def/Lib/test/regrtest.py", line 710 in main
 File "/home/nadeem/src/cpython/def/Lib/test/__main__.py", line 13 in <module>
 File "/home/nadeem/src/cpython/def/Lib/runpy.py", line 73 in _run_code
 File "/home/nadeem/src/cpython/def/Lib/runpy.py", line 160 in _run_module_as_main
The failures will not occur if the test suite is run with the -j or -W flags,
as the failing tests are skipped if stdout is not a tty.
I've encountered the failures on both machines I've tested - one Ubuntu 11.10
64-bit (running Unity), and the other Xubuntu 11.10 32-bit (running XFCE).
msg165869 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012年07月19日 19:38
This is not a problem on Windows because the failing tests are skipped.
test_input_tty (test.test_builtin.BuiltinTest) ... skipped
'the pty and signal modules must be available'
test_input_tty_non_ascii (test.test_builtin.BuiltinTest) ... skipped 'the pty and signal modules must be available'
test_input_tty_non_ascii_unicode_errors (test.test_builtin.BuiltinTest) ... skipped
'the pty and signal modules must be available'
msg170683 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012年09月18日 22:23
"python: ../../src/xcb_io.c:273: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed."
I get a similar XCB assertion error:
"xcb_io.c:221: poll_for_event: Assertion `(((long) (event_sequence) - (long) (dpy->request)) <= 0)' failed."
The problem is that a Tk thread is still alive while test_builtins is running. XInitThreads() must be the first call to the Xlib for multithreaded applications.
Extract of:
https://groups.google.com/forum/#!msg/comp.lang.tcl/gFcxwy9TxLc/drmHzhvM9YQJ
"3. Tk's thread support for unix/X11 is iffy. There has been work done 
on making Tk thread safe, but Tk still doesn't call XInitThreads(), and 
probably won't anytime soon. It seems that the XCB library has a 
superior implementation for threaded X11 interfaces anyway, so a 
complete rewrite would make more sense (to me). Tk however can be used 
with threaded builds, and multiple threads, but only with a single 
thread using [package require Tk] as I understand it."
The correct fix is maybe to stop properly the Tk thread. (Example: Run test_tk in a subprocess? Call tk.quit()?)
msg197820 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013年09月15日 19:33
This is due PyOS_InputHook. After commenting out EnableEventHook() tests are passed.
msg381027 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020年11月15日 19:24
I couldn't reproduce this on a macOS (3.10). Is it still an issue?
msg381038 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020年11月15日 22:32
tcl/tk 8.5, likely used in 2012 test, was by default compiled without thread support. 8.6, used now for sure on psf Windows and Macs installs and I believe on most *nixes, the default is *with* thread support. Given the comments, this might affect results.
msg381079 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020年11月16日 08:28
It is still reproducible on Linux. I do not get a crash, just test failure and some strange output.
======================================================================
FAIL: test_input_tty_non_ascii (test.test_builtin.PtyTests)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2122, in test_input_tty_non_ascii
 self.check_input_tty("prompté", b"quux\xe9", "utf-8")
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2103, in check_input_tty
 lines = self.run_child(child, terminal_input + b"\r\n")
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2021, in run_child
 return self._run_child(child, terminal_input)
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2078, in _run_child
 self.fail("got %d lines in pipe but expected 2, child output was:\n%s"
AssertionError: got 0 lines in pipe but expected 2, child output was:
quux
promptXIO: fatal IO error 25 (Inappropriate ioctl for device) on X server ":0"
 after 35926 requests (35926 known processed) with 40 events remaining.
======================================================================
FAIL: test_input_tty_non_ascii_unicode_errors (test.test_builtin.PtyTests)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2126, in test_input_tty_non_ascii_unicode_errors
 self.check_input_tty("prompté", b"quux\xe9", "ascii")
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2103, in check_input_tty
 lines = self.run_child(child, terminal_input + b"\r\n")
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2021, in run_child
 return self._run_child(child, terminal_input)
 File "/home/serhiy/py/cpython/Lib/test/test_builtin.py", line 2078, in _run_child
 self.fail("got %d lines in pipe but expected 2, child output was:\n%s"
AssertionError: got 0 lines in pipe but expected 2, child output was:
quux
prompt?XIO: fatal IO error 25 (Inappropriate ioctl for device) on X server ":0"
 after 35926 requests (35926 known processed) with 40 events remaining.
----------------------------------------------------------------------
msg410769 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022年01月17日 12:30
I cannot reproduce this issue on the Python main branch on Fedora 35 with Tk 8.6.10 and libX11 1.7.3.1. I close the issue, please reopen it if you can still reproduce it.
One year ago, Serhiy wrote that the issue was still reproducible on Linux but he didn't mention the Tk and libX11 versions.
I used the command:
 ./python -Wd -E -bb -m test -vuall test_tk test_builtin
Versions:
$ make pythoninfo|grep ^tk
tkinter.TCL_VERSION: 8.6
tkinter.TK_VERSION: 8.6
tkinter.info_patchlevel: 8.6.10
$ rpm -q tk tcl libX11
tk-8.6.10-7.fc35.x86_64
tcl-8.6.10-6.fc35.x86_64
libX11-1.7.3.1-1.fc35.x86_64
History
Date User Action Args
2022年04月11日 14:57:26adminsetgithub: 58096
2022年01月17日 12:30:42vstinnersetstatus: open -> closed
resolution: third party
messages: + msg410769

stage: needs patch -> resolved
2020年11月16日 08:28:33serhiy.storchakasetmessages: + msg381079
versions: + Python 3.8, Python 3.9, Python 3.10, - Python 3.2, Python 3.3
2020年11月15日 22:32:20terry.reedysetstatus: pending -> open

messages: + msg381038
2020年11月15日 19:24:42iritkatrielsetstatus: open -> pending
nosy: + iritkatriel
messages: + msg381027

2013年09月15日 19:33:57serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg197820
2012年09月18日 22:30:13vstinnersetcomponents: + Tests, Tkinter, - XML
2012年09月18日 22:23:19vstinnersetnosy: + vstinner
messages: + msg170683
components: + XML, - Tests
2012年09月16日 08:30:19Arfreversetnosy: + Arfrever
2012年07月19日 19:38:10terry.reedysetnosy: + terry.reedy
messages: + msg165869
2012年01月27日 10:54:16nadeem.vawdacreate

AltStyle によって変換されたページ (->オリジナル) /