mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +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
5
third_party/python/Lib/test/dtracedata/assert_usable.d
vendored
Normal file
5
third_party/python/Lib/test/dtracedata/assert_usable.d
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
BEGIN
|
||||
{
|
||||
printf("probe: success\n");
|
||||
exit(0);
|
||||
}
|
5
third_party/python/Lib/test/dtracedata/assert_usable.stp
vendored
Normal file
5
third_party/python/Lib/test/dtracedata/assert_usable.stp
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
probe begin
|
||||
{
|
||||
println("probe: success")
|
||||
exit ()
|
||||
}
|
31
third_party/python/Lib/test/dtracedata/call_stack.d
vendored
Normal file
31
third_party/python/Lib/test/dtracedata/call_stack.d
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
self int indent;
|
||||
|
||||
python$target:::function-entry
|
||||
/copyinstr(arg1) == "start"/
|
||||
{
|
||||
self->trace = 1;
|
||||
}
|
||||
|
||||
python$target:::function-entry
|
||||
/self->trace/
|
||||
{
|
||||
printf("%d\t%*s:", timestamp, 15, probename);
|
||||
printf("%*s", self->indent, "");
|
||||
printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
|
||||
self->indent++;
|
||||
}
|
||||
|
||||
python$target:::function-return
|
||||
/self->trace/
|
||||
{
|
||||
self->indent--;
|
||||
printf("%d\t%*s:", timestamp, 15, probename);
|
||||
printf("%*s", self->indent, "");
|
||||
printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
|
||||
}
|
||||
|
||||
python$target:::function-return
|
||||
/copyinstr(arg1) == "start"/
|
||||
{
|
||||
self->trace = 0;
|
||||
}
|
18
third_party/python/Lib/test/dtracedata/call_stack.d.expected
vendored
Normal file
18
third_party/python/Lib/test/dtracedata/call_stack.d.expected
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
function-entry:call_stack.py:start:23
|
||||
function-entry: call_stack.py:function_1:1
|
||||
function-entry: call_stack.py:function_3:9
|
||||
function-return: call_stack.py:function_3:10
|
||||
function-return: call_stack.py:function_1:2
|
||||
function-entry: call_stack.py:function_2:5
|
||||
function-entry: call_stack.py:function_1:1
|
||||
function-entry: call_stack.py:function_3:9
|
||||
function-return: call_stack.py:function_3:10
|
||||
function-return: call_stack.py:function_1:2
|
||||
function-return: call_stack.py:function_2:6
|
||||
function-entry: call_stack.py:function_3:9
|
||||
function-return: call_stack.py:function_3:10
|
||||
function-entry: call_stack.py:function_4:13
|
||||
function-return: call_stack.py:function_4:14
|
||||
function-entry: call_stack.py:function_5:18
|
||||
function-return: call_stack.py:function_5:21
|
||||
function-return:call_stack.py:start:28
|
30
third_party/python/Lib/test/dtracedata/call_stack.py
vendored
Normal file
30
third_party/python/Lib/test/dtracedata/call_stack.py
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
def function_1():
|
||||
function_3(1, 2)
|
||||
|
||||
# Check stacktrace
|
||||
def function_2():
|
||||
function_1()
|
||||
|
||||
# CALL_FUNCTION_VAR
|
||||
def function_3(dummy, dummy2):
|
||||
pass
|
||||
|
||||
# CALL_FUNCTION_KW
|
||||
def function_4(**dummy):
|
||||
return 1
|
||||
return 2 # unreachable
|
||||
|
||||
# CALL_FUNCTION_VAR_KW
|
||||
def function_5(dummy, dummy2, **dummy3):
|
||||
if False:
|
||||
return 7
|
||||
return 8
|
||||
|
||||
def start():
|
||||
function_1()
|
||||
function_2()
|
||||
function_3(1, 2)
|
||||
function_4(test=42)
|
||||
function_5(*(1, 2), **{"test": 42})
|
||||
|
||||
start()
|
41
third_party/python/Lib/test/dtracedata/call_stack.stp
vendored
Normal file
41
third_party/python/Lib/test/dtracedata/call_stack.stp
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
global tracing
|
||||
|
||||
function basename:string(path:string)
|
||||
{
|
||||
last_token = token = tokenize(path, "/");
|
||||
while (token != "") {
|
||||
last_token = token;
|
||||
token = tokenize("", "/");
|
||||
}
|
||||
return last_token;
|
||||
}
|
||||
|
||||
probe process.mark("function__entry")
|
||||
{
|
||||
funcname = user_string($arg2);
|
||||
|
||||
if (funcname == "start") {
|
||||
tracing = 1;
|
||||
}
|
||||
}
|
||||
|
||||
probe process.mark("function__entry"), process.mark("function__return")
|
||||
{
|
||||
filename = user_string($arg1);
|
||||
funcname = user_string($arg2);
|
||||
lineno = $arg3;
|
||||
|
||||
if (tracing) {
|
||||
printf("%d\t%s:%s:%s:%d\n", gettimeofday_us(), $$name,
|
||||
basename(filename), funcname, lineno);
|
||||
}
|
||||
}
|
||||
|
||||
probe process.mark("function__return")
|
||||
{
|
||||
funcname = user_string($arg2);
|
||||
|
||||
if (funcname == "start") {
|
||||
tracing = 0;
|
||||
}
|
||||
}
|
14
third_party/python/Lib/test/dtracedata/call_stack.stp.expected
vendored
Normal file
14
third_party/python/Lib/test/dtracedata/call_stack.stp.expected
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
function__entry:call_stack.py:start:23
|
||||
function__entry:call_stack.py:function_1:1
|
||||
function__return:call_stack.py:function_1:2
|
||||
function__entry:call_stack.py:function_2:5
|
||||
function__entry:call_stack.py:function_1:1
|
||||
function__return:call_stack.py:function_1:2
|
||||
function__return:call_stack.py:function_2:6
|
||||
function__entry:call_stack.py:function_3:9
|
||||
function__return:call_stack.py:function_3:10
|
||||
function__entry:call_stack.py:function_4:13
|
||||
function__return:call_stack.py:function_4:14
|
||||
function__entry:call_stack.py:function_5:18
|
||||
function__return:call_stack.py:function_5:21
|
||||
function__return:call_stack.py:start:28
|
18
third_party/python/Lib/test/dtracedata/gc.d
vendored
Normal file
18
third_party/python/Lib/test/dtracedata/gc.d
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
python$target:::function-entry
|
||||
/copyinstr(arg1) == "start"/
|
||||
{
|
||||
self->trace = 1;
|
||||
}
|
||||
|
||||
python$target:::gc-start,
|
||||
python$target:::gc-done
|
||||
/self->trace/
|
||||
{
|
||||
printf("%d\t%s:%ld\n", timestamp, probename, arg0);
|
||||
}
|
||||
|
||||
python$target:::function-return
|
||||
/copyinstr(arg1) == "start"/
|
||||
{
|
||||
self->trace = 0;
|
||||
}
|
8
third_party/python/Lib/test/dtracedata/gc.d.expected
vendored
Normal file
8
third_party/python/Lib/test/dtracedata/gc.d.expected
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
gc-start:0
|
||||
gc-done:0
|
||||
gc-start:1
|
||||
gc-done:0
|
||||
gc-start:2
|
||||
gc-done:0
|
||||
gc-start:2
|
||||
gc-done:1
|
13
third_party/python/Lib/test/dtracedata/gc.py
vendored
Normal file
13
third_party/python/Lib/test/dtracedata/gc.py
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
import gc
|
||||
|
||||
def start():
|
||||
gc.collect(0)
|
||||
gc.collect(1)
|
||||
gc.collect(2)
|
||||
l = []
|
||||
l.append(l)
|
||||
del l
|
||||
gc.collect(2)
|
||||
|
||||
gc.collect()
|
||||
start()
|
26
third_party/python/Lib/test/dtracedata/gc.stp
vendored
Normal file
26
third_party/python/Lib/test/dtracedata/gc.stp
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
global tracing
|
||||
|
||||
probe process.mark("function__entry")
|
||||
{
|
||||
funcname = user_string($arg2);
|
||||
|
||||
if (funcname == "start") {
|
||||
tracing = 1;
|
||||
}
|
||||
}
|
||||
|
||||
probe process.mark("gc__start"), process.mark("gc__done")
|
||||
{
|
||||
if (tracing) {
|
||||
printf("%d\t%s:%ld\n", gettimeofday_us(), $$name, $arg1);
|
||||
}
|
||||
}
|
||||
|
||||
probe process.mark("function__return")
|
||||
{
|
||||
funcname = user_string($arg2);
|
||||
|
||||
if (funcname == "start") {
|
||||
tracing = 0;
|
||||
}
|
||||
}
|
8
third_party/python/Lib/test/dtracedata/gc.stp.expected
vendored
Normal file
8
third_party/python/Lib/test/dtracedata/gc.stp.expected
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
gc__start:0
|
||||
gc__done:0
|
||||
gc__start:1
|
||||
gc__done:0
|
||||
gc__start:2
|
||||
gc__done:0
|
||||
gc__start:2
|
||||
gc__done:1
|
24
third_party/python/Lib/test/dtracedata/instance.py
vendored
Normal file
24
third_party/python/Lib/test/dtracedata/instance.py
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
import gc
|
||||
|
||||
class old_style_class():
|
||||
pass
|
||||
class new_style_class(object):
|
||||
pass
|
||||
|
||||
a = old_style_class()
|
||||
del a
|
||||
gc.collect()
|
||||
b = new_style_class()
|
||||
del b
|
||||
gc.collect()
|
||||
|
||||
a = old_style_class()
|
||||
del old_style_class
|
||||
gc.collect()
|
||||
b = new_style_class()
|
||||
del new_style_class
|
||||
gc.collect()
|
||||
del a
|
||||
gc.collect()
|
||||
del b
|
||||
gc.collect()
|
7
third_party/python/Lib/test/dtracedata/line.d
vendored
Normal file
7
third_party/python/Lib/test/dtracedata/line.d
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
python$target:::line
|
||||
/(copyinstr(arg1)=="test_line")/
|
||||
{
|
||||
printf("%d\t%s:%s:%s:%d\n", timestamp,
|
||||
probename, basename(copyinstr(arg0)),
|
||||
copyinstr(arg1), arg2);
|
||||
}
|
20
third_party/python/Lib/test/dtracedata/line.d.expected
vendored
Normal file
20
third_party/python/Lib/test/dtracedata/line.d.expected
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
line:line.py:test_line:2
|
||||
line:line.py:test_line:3
|
||||
line:line.py:test_line:4
|
||||
line:line.py:test_line:5
|
||||
line:line.py:test_line:6
|
||||
line:line.py:test_line:7
|
||||
line:line.py:test_line:8
|
||||
line:line.py:test_line:9
|
||||
line:line.py:test_line:10
|
||||
line:line.py:test_line:11
|
||||
line:line.py:test_line:4
|
||||
line:line.py:test_line:5
|
||||
line:line.py:test_line:6
|
||||
line:line.py:test_line:7
|
||||
line:line.py:test_line:8
|
||||
line:line.py:test_line:10
|
||||
line:line.py:test_line:11
|
||||
line:line.py:test_line:4
|
||||
line:line.py:test_line:12
|
||||
line:line.py:test_line:13
|
17
third_party/python/Lib/test/dtracedata/line.py
vendored
Normal file
17
third_party/python/Lib/test/dtracedata/line.py
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
def test_line():
|
||||
a = 1
|
||||
print('# Preamble', a)
|
||||
for i in range(2):
|
||||
a = i
|
||||
b = i+2
|
||||
c = i+3
|
||||
if c < 4:
|
||||
a = c
|
||||
d = a + b +c
|
||||
print('#', a, b, c, d)
|
||||
a = 1
|
||||
print('# Epilogue', a)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_line()
|
Loading…
Add table
Add a link
Reference in a new issue