Skip to content

gh-124986: Fix max_handles for NetBSD in test_no_leaking #124987

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

Closed
wants to merge 1 commit into from

Conversation

furkanonder
Copy link
Contributor

@furkanonder furkanonder commented Oct 4, 2024

@furkanonder furkanonder added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir skip news needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Oct 4, 2024
@furkanonder furkanonder requested a review from gpshead as a code owner October 4, 2024 21:56
@picnixz picnixz changed the title Fix max_handles for NetBSD in test_no_leaking gh-124986: Fix max_handles for NetBSD in test_no_leaking Oct 5, 2024
@@ -1214,7 +1214,9 @@ def test_communicate_errors(self):

def test_no_leaking(self):
# Make sure we leak no resources
if not mswindows:
if sys.platform.startswith("netbsd"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than more specialization for what is probably a kernel config... I think catching ValueError within the loop down where OSError is caught and treating it the same would make more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I don't know exactly what you mean. The error is not being raised in this context.

try:
    tmpfile = os.path.join(tmpdir, os_helper.TESTFN)
    handles.append(os.open(tmpfile, os.O_WRONLY|os.O_CREAT))
except OSError as e:
    if e.errno != errno.EMFILE:
        raise
    break

Is this what you mean?

try:
    p = subprocess.Popen([sys.executable, "-c",
                          "import sys;"
                          "sys.stdout.write(sys.stdin.read())"],
                         stdin=subprocess.PIPE,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    data = p.communicate(b"lime")[0]
    self.assertEqual(data, b"lime")
except Exception as err:
    self.skipTest("failed to reach the file descriptor limit "
         "(tried %d)" % max_handles)

@furkanonder furkanonder removed the type-bug An unexpected behavior, bug, or error label Mar 18, 2025
@tomasr8 tomasr8 removed the needs backport to 3.12 only security fixes label Apr 10, 2025
@serhiy-storchaka serhiy-storchaka self-requested a review April 13, 2025 11:09
@serhiy-storchaka
Copy link
Member

See more general solution in #132476.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review needs backport to 3.13 bugs and security fixes skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants