MCPcopy Index your code
hub / github.com/python/cpython / make_bad_fd

Function make_bad_fd

Lib/test/support/os_helper.py:159–169  ·  view source on GitHub ↗

Create an invalid file descriptor by opening and closing a file and return its fd.

()

Source from the content-addressed store, hash-verified

157
158
159def make_bad_fd():
160 """
161 Create an invalid file descriptor by opening and closing a file and return
162 its fd.
163 """
164 file = open(TESTFN, "wb")
165 try:
166 return file.fileno()
167 finally:
168 file.close()
169 unlink(TESTFN)
170
171
172_can_symlink = None

Callers 2

test_bad_fdMethod · 0.90
testInvalidFdMethod · 0.90

Calls 4

unlinkFunction · 0.85
openFunction · 0.50
filenoMethod · 0.45
closeMethod · 0.45

Tested by 2

test_bad_fdMethod · 0.72
testInvalidFdMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…