mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
python-3.6.zip added from Github
README.cosmo contains the necessary links.
This commit is contained in:
parent
75fc601ff5
commit
0c4c56ff39
4219 changed files with 1968626 additions and 0 deletions
34
third_party/python/Lib/test/subprocessdata/fd_status.py
vendored
Normal file
34
third_party/python/Lib/test/subprocessdata/fd_status.py
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"""When called as a script, print a comma-separated list of the open
|
||||
file descriptors on stdout.
|
||||
|
||||
Usage:
|
||||
fd_stats.py: check all file descriptors
|
||||
fd_status.py fd1 fd2 ...: check only specified file descriptors
|
||||
"""
|
||||
|
||||
import errno
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
fds = []
|
||||
if len(sys.argv) == 1:
|
||||
try:
|
||||
_MAXFD = os.sysconf("SC_OPEN_MAX")
|
||||
except:
|
||||
_MAXFD = 256
|
||||
test_fds = range(0, _MAXFD)
|
||||
else:
|
||||
test_fds = map(int, sys.argv[1:])
|
||||
for fd in test_fds:
|
||||
try:
|
||||
st = os.fstat(fd)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EBADF:
|
||||
continue
|
||||
raise
|
||||
# Ignore Solaris door files
|
||||
if not stat.S_ISDOOR(st.st_mode):
|
||||
fds.append(fd)
|
||||
print(','.join(map(str, fds)))
|
7
third_party/python/Lib/test/subprocessdata/input_reader.py
vendored
Normal file
7
third_party/python/Lib/test/subprocessdata/input_reader.py
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
"""When called as a script, consumes the input"""
|
||||
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
for line in sys.stdin:
|
||||
pass
|
7
third_party/python/Lib/test/subprocessdata/qcat.py
vendored
Normal file
7
third_party/python/Lib/test/subprocessdata/qcat.py
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
"""When ran as a script, simulates cat with no arguments."""
|
||||
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
for line in sys.stdin:
|
||||
sys.stdout.write(line)
|
10
third_party/python/Lib/test/subprocessdata/qgrep.py
vendored
Normal file
10
third_party/python/Lib/test/subprocessdata/qgrep.py
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"""When called with a single argument, simulated fgrep with a single
|
||||
argument and no options."""
|
||||
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
pattern = sys.argv[1]
|
||||
for line in sys.stdin:
|
||||
if pattern in line:
|
||||
sys.stdout.write(line)
|
15
third_party/python/Lib/test/subprocessdata/sigchild_ignore.py
vendored
Normal file
15
third_party/python/Lib/test/subprocessdata/sigchild_ignore.py
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
import signal, subprocess, sys, time
|
||||
# On Linux this causes os.waitpid to fail with OSError as the OS has already
|
||||
# reaped our child process. The wait() passing the OSError on to the caller
|
||||
# and causing us to exit with an error is what we are testing against.
|
||||
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
|
||||
subprocess.Popen([sys.executable, '-c', 'print("albatross")']).wait()
|
||||
# Also ensure poll() handles an errno.ECHILD appropriately.
|
||||
p = subprocess.Popen([sys.executable, '-c', 'print("albatross")'])
|
||||
num_polls = 0
|
||||
while p.poll() is None:
|
||||
# Waiting for the process to finish.
|
||||
time.sleep(0.01) # Avoid being a CPU busy loop.
|
||||
num_polls += 1
|
||||
if num_polls > 3000:
|
||||
raise RuntimeError('poll should have returned 0 within 30 seconds')
|
Loading…
Add table
Add a link
Reference in a new issue