classification
Title: [Windows] test_os fails several C-level assertions
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: python-dev, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2015-04-12 02:34 by zach.ware, last changed 2015-10-08 16:15 by steve.dower. This issue is now closed.

Files
File name Uploaded Description Edit
23919_1.patch steve.dower, 2015-10-03 20:24
Messages (11)
msg240522 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-04-12 02:34
Uninteresting bits of the output elided:

C:\Data\code\CPython\hg.python.org\default>python -m test -vn test_os
Running Debug|Win32 interpreter...
== CPython 3.5.0a3+ (default:0b3027a2abbc, Apr 11 2015, 21:11:57) [MSC v.1900 32
 bit (Intel)]
==   Windows-post2012Server-6.3.9600 little-endian
==   hash algorithm: siphash24 32bit
==   C:\Data\code\CPython\hg.python.org\default\build\test_python_4312
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, don
t_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0,
bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[1/1] test_os
...
test_bad_fd (test.test_os.DeviceEncodingTests) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(257) : Assertion failed: fh >= 0 && (unsigned)fh < (unsigned)_nhandle
ok
...
test_closerange (test.test_os.FileTests) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_15261 (test.test_os.StatAttributeTests) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_stty_match (test.test_os.TermsizeTests)
Check if stty returns the same results ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(257) : Assertion failed: fh >= 0 && (unsigned)fh < (unsigned)_nhandle
skipped 'stty invocation failed'
...
test_closerange (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
test_dup (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
test_dup2 (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_fdopen (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_fstat (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_fsync (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_inheritable (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
test_isatty (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
test_lseek (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
test_read (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...
test_write (test.test_os.TestInvalidFD) ... minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp(258) : Assertion failed: _osfile(fh) & FOPEN
ok
...

----------------------------------------------------------------------
Ran 189 tests in 7.424s

OK (skipped=75)
1 test OK.
msg240528 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-04-12 03:22
The fix for these is to hide the output, which is in the test modules handling of the -n option.

The assertions should fail, as they are testing error conditions.
msg240529 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-04-12 03:24
Here's the problem with that:

C:\Data\code\CPython\hg.python.org\default>python -m test.test_os
Running Debug|Win32 interpreter...
s.ssss.<crash with error popup>
msg240552 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-04-12 10:57
I mean we just suppress the output completely. Currently it sets the mode to stderr but we can set it to silent, though I don't recall what the name of the constant we need is.
msg240591 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-04-13 07:18
> The fix for these is to hide the output, which is in the test modules handling of the -n option.

Since Python raises an exception for EBADF, I don't see the purpose of these assertion messages.
msg241013 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-04-14 20:30
So just discussed with Zach the idea of hiding all assertion outputs by default and then using -n to display the output on stderr. That would help people get started running tests locally as well, since the dialogs that appear by default look like pretty bad failures.

One of us will get a patch together and probably review it in person, since it's a fairly simple change, but if anyone not at PyCon has a strong opinion it'd be good to hear it.
msg252238 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-10-03 20:24
This patch:

* defaults to no assert dialogs and no stderr output
* enables stderr output for assertions on "-vv" (or more)
* displays a deprecation message on "-n"
msg252262 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-10-04 08:10
I would prefer to disable the popups and messages to stderr by default in Python directly. If some users want to see them, we can add a -X option to enable them. Example: -X enable_mscrt_checks. What do you think? Do you recall who complain that Python hides MSCRT warnings? And why he/she complained?

I don't want these warnings, especially popups blocking my program, on my own applications. Python already raises OSError on errors.

The problem in tests is also that some tests use subprocesses and regrtest only configures the test runner, not subprocesses. For example, I had to modify a subprocess started by the test. Otherwise, the test *hangs* :-(

Popups are annoying because it's not possible to ignore them all by a single click. I have to click N times for N errors, with N>100 it's just a nightmare...

For me, it's a regression compared to older Python versions. I don't remember to have to click on so much popups or have stderr flooded by warnings when working on Windows, when I worked on Python 3.4 or older.
msg252263 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-10-04 08:11
23919_1.patch looks good to me.
msg252266 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-10-04 12:52
I referred to the issues that had -n added in the first place many times while adding the IPH handlers, but I don't have them handy now on my phone.

The rationale was that people who cause assertions in their C extensions should see them and not have Python suppress them. All cases where an assert is raised in a debug build is a coding error - the test suite deliberately causes some but this is not normal development and should not dictate normal configuration.
msg252552 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-08 16:08
New changeset 69c4fa62b608 by Steve Dower in branch '3.5':
Issue #23919: Prevents assert dialogs appearing in the test suite.
https://hg.python.org/cpython/rev/69c4fa62b608

New changeset 62897db9ae51 by Steve Dower in branch 'default':
Issue #23919: Prevents assert dialogs appearing in the test suite.
https://hg.python.org/cpython/rev/62897db9ae51
History
Date User Action Args
2015-10-08 16:15:11steve.dowersetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2015-10-08 16:08:17python-devsetnosy: + python-dev
messages: + msg252552
2015-10-04 12:52:04steve.dowersetmessages: + msg252266
2015-10-04 08:11:13vstinnersetmessages: + msg252263
2015-10-04 08:10:15vstinnersetmessages: + msg252262
2015-10-03 20:24:10steve.dowersetfiles: + 23919_1.patch
versions: + Python 3.6
messages: + msg252238

assignee: steve.dower
keywords: + patch
2015-04-14 20:30:12steve.dowersetmessages: + msg241013
2015-04-13 07:18:44vstinnersettitle: test_os fails several C-level assertions -> [Windows] test_os fails several C-level assertions
2015-04-13 07:18:12vstinnersetmessages: + msg240591
2015-04-12 10:57:52steve.dowersetmessages: + msg240552
2015-04-12 05:20:03serhiy.storchakasetnosy: + vstinner
2015-04-12 03:24:15zach.waresetmessages: + msg240529
2015-04-12 03:22:14steve.dowersetmessages: + msg240528
2015-04-12 02:34:27zach.warecreate