Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Lib/test/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

max_handles = 512
elif not mswindows:
max_handles = 1026 # too much for most UNIX systems
else:
max_handles = 2050 # too much for (at least some) Windows setups
Expand Down
Loading