Skip to content
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

[Windows] test_os fails several C-level assertions #68107

Closed
zware opened this issue Apr 12, 2015 · 11 comments
Closed

[Windows] test_os fails several C-level assertions #68107

zware opened this issue Apr 12, 2015 · 11 comments
Assignees
Labels
OS-windows type-bug An unexpected behavior, bug, or error

Comments

@zware
Copy link
Member

zware commented Apr 12, 2015

BPO 23919
Nosy @vstinner, @tjguk, @zware, @zooba
Files
  • 23919_1.patch
  • 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:

    assignee = 'https://github.com/zooba'
    closed_at = <Date 2015-10-08.16:15:11.398>
    created_at = <Date 2015-04-12.02:34:27.610>
    labels = ['type-bug', 'OS-windows']
    title = '[Windows] test_os fails several C-level assertions'
    updated_at = <Date 2015-10-08.16:15:11.397>
    user = 'https://github.com/zware'

    bugs.python.org fields:

    activity = <Date 2015-10-08.16:15:11.397>
    actor = 'steve.dower'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2015-10-08.16:15:11.398>
    closer = 'steve.dower'
    components = ['Windows']
    creation = <Date 2015-04-12.02:34:27.610>
    creator = 'zach.ware'
    dependencies = []
    files = ['40668']
    hgrepos = []
    issue_num = 23919
    keywords = ['patch']
    message_count = 11.0
    messages = ['240522', '240528', '240529', '240552', '240591', '241013', '252238', '252262', '252263', '252266', '252552']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'tim.golden', 'python-dev', 'zach.ware', 'steve.dower']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23919'
    versions = ['Python 3.5', 'Python 3.6']

    @zware
    Copy link
    Member Author

    zware commented Apr 12, 2015

    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.

    @zware zware added OS-windows type-bug An unexpected behavior, bug, or error labels Apr 12, 2015
    @zooba
    Copy link
    Member

    zooba commented Apr 12, 2015

    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.

    @zware
    Copy link
    Member Author

    zware commented Apr 12, 2015

    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>

    @zooba
    Copy link
    Member

    zooba commented Apr 12, 2015

    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.

    @vstinner
    Copy link
    Member

    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.

    @vstinner vstinner changed the title test_os fails several C-level assertions [Windows] test_os fails several C-level assertions Apr 13, 2015
    @zooba
    Copy link
    Member

    zooba commented Apr 14, 2015

    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.

    @zooba
    Copy link
    Member

    zooba commented Oct 3, 2015

    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"

    @zooba zooba self-assigned this Oct 3, 2015
    @vstinner
    Copy link
    Member

    vstinner commented Oct 4, 2015

    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.

    @vstinner
    Copy link
    Member

    vstinner commented Oct 4, 2015

    23919_1.patch looks good to me.

    @zooba
    Copy link
    Member

    zooba commented Oct 4, 2015

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 8, 2015

    New changeset 69c4fa62b608 by Steve Dower in branch '3.5':
    Issue bpo-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 bpo-23919: Prevents assert dialogs appearing in the test suite.
    https://hg.python.org/cpython/rev/62897db9ae51

    @zooba zooba closed this as completed Oct 8, 2015
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants