Skip to content

gh-117968: Make the test for closed file more safe in the C API tests #118230

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

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 24, 2024

The behavior of fileno() after fclose() is undefined, but it is the only practical way to check whether the file was closed. Only test this on the known platforms (Linux, Windows, macOS), where we already tested that it works.

… tests

The behavior of fileno() after fclose() is undefined, but it is the only
practical way to check whether the file was closed.
Only test this on the known platforms (Linux, Windows, macOS), where we
already tested that it works.
@serhiy-storchaka
Copy link
Member Author

!buildbot wasi

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit e30956b 🤖

The command will test the builders whose names match following regular expression: wasi

The builders matched are:

  • wasm32-wasi PR
  • wasm32 WASI 8Core PR
  • wasm32-wasi Non-Debug PR

@serhiy-storchaka serhiy-storchaka changed the title gh-117982: Make the test for closed file more safe in the C API tests gh-117968: Make the test for closed file more safe in the C API tests Apr 25, 2024
@serhiy-storchaka serhiy-storchaka merged commit 546cbcf into python:main Apr 25, 2024
41 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@serhiy-storchaka serhiy-storchaka deleted the test-capi-run branch April 25, 2024 05:00
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 25, 2024
… tests (pythonGH-118230)

The behavior of fileno() after fclose() is undefined, but it is the only
practical way to check whether the file was closed.
Only test this on the known platforms (Linux, Windows, macOS), where we
already tested that it works.
(cherry picked from commit 546cbcf)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Apr 25, 2024

GH-118266 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Apr 25, 2024
serhiy-storchaka added a commit that referenced this pull request Apr 25, 2024
…I tests (GH-118230) (GH-118266)

The behavior of fileno() after fclose() is undefined, but it is the only
practical way to check whether the file was closed.
Only test this on the known platforms (Linux, Windows, macOS), where we
already tested that it works.
(cherry picked from commit 546cbcf)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot iOS ARM64 Simulator 3.x has failed when building commit 546cbcf.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1380/builds/84) and take a look at the build logs.
  4. Check if the failure is related to this commit (546cbcf) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/1380/builds/84

Failed tests:

  • test_posix
  • test_support
  • test_zipfile

Failed subtests:

  • test_confstr - test.test_posix.PosixTester.test_confstr
  • test_fd_count - test.test_support.TestSupport.test_fd_count
  • test_many_opens - test.test_zipfile.test_core.TestsWithMultipleOpens.test_many_opens

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/4A852A8A-CCCB-441C-8D72-E2EEA20B0EDD/data/Containers/Bundle/Application/9A737A54-B46D-42BE-AACA-F5780789C07E/iOSTestbed.app/python/lib/python3.13/test/test_support.py", line 558, in test_fd_count
    start = os_helper.fd_count()
            ~~~~~~~~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/4A852A8A-CCCB-441C-8D72-E2EEA20B0EDD/data/Containers/Bundle/Application/9A737A54-B46D-42BE-AACA-F5780789C07E/iOSTestbed.app/python/lib/python3.13/test/support/os_helper.py", line 634, in fd_count
    MAXFD = os.sysconf("SC_OPEN_MAX")
            ~~~~~~~~~~^^^^^^^^^^^^^^^
ValueError: unrecognized configuration name


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/4A852A8A-CCCB-441C-8D72-E2EEA20B0EDD/data/Containers/Bundle/Application/9A737A54-B46D-42BE-AACA-F5780789C07E/iOSTestbed.app/python/lib/python3.13/test/test_zipfile/test_core.py", line 2901, in test_many_opens
    startcount = fd_count()
                 ~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/4A852A8A-CCCB-441C-8D72-E2EEA20B0EDD/data/Containers/Bundle/Application/9A737A54-B46D-42BE-AACA-F5780789C07E/iOSTestbed.app/python/lib/python3.13/test/support/os_helper.py", line 634, in fd_count
    MAXFD = os.sysconf("SC_OPEN_MAX")
            ~~~~~~~~~~^^^^^^^^^^^^^^^
ValueError: unrecognized configuration name


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/4A852A8A-CCCB-441C-8D72-E2EEA20B0EDD/data/Containers/Bundle/Application/9A737A54-B46D-42BE-AACA-F5780789C07E/iOSTestbed.app/python/lib/python3.13/test/test_posix.py", line 569, in test_confstr
    self.assertEqual(len(posix.confstr("CS_PATH")) > 0, True)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False != True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants