Staging
v0.5.1
https://github.com/python/cpython
Revision 5dbb48aaac0ff74648b355ebdde222856004b1ef authored by Victor Stinner on 01 June 2018, 13:51:02 UTC, committed by GitHub on 01 June 2018, 13:51:02 UTC
* bpo-31234: Add test.support.wait_threads_exit() (GH-3578)

Use _thread.count() to wait until threads exit. The new context
manager prevents the "dangling thread" warning.

(cherry picked from commit ff40ecda73178dfcad24e26240d684356ef20793)

* bpo-31234: Try to fix lock_tests warning (#3557)

Try to fix the "Warning -- threading_cleanup() failed to cleanup 1
threads" warning in test.lock_tests: wait a little bit longer to give
time to the threads to complete.

Warning seen on test_thread and test_importlib.

(cherry picked from commit 096ae3373abac2c8b3a26a3fe33cc8bd4cbccd4e)
1 parent 95681c7
Raw File
Tip revision: 5dbb48aaac0ff74648b355ebdde222856004b1ef authored by Victor Stinner on 01 June 2018, 13:51:02 UTC
[3.6] bpo-31234: Add test.support.wait_threads_exit() (GH-3578) (GH-7315)
Tip revision: 5dbb48a
typeslots.py
#!/usr/bin/python
# Usage: typeslots.py < Include/typeslots.h typeslots.inc

import sys, re

def generate_typeslots(out=sys.stdout):
    out.write("/* Generated by typeslots.py */\n")
    res = {}
    for line in sys.stdin:
        m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
        if not m:
            continue
        member = m.group(1)
        if member.startswith("tp_"):
            member = "ht_type."+member
        elif member.startswith("am_"):
            member = "as_async."+member
        elif member.startswith("nb_"):
            member = "as_number."+member
        elif member.startswith("mp_"):
            member = "as_mapping."+member
        elif member.startswith("sq_"):
            member = "as_sequence."+member
        elif member.startswith("bf_"):
            member = "as_buffer."+member
        res[int(m.group(2))] = member

    M = max(res.keys())+1
    for i in range(1,M):
        if i in res:
            out.write("offsetof(PyHeapTypeObject, %s),\n" % res[i])
        else:
            out.write("0,\n")

def main():
    if len(sys.argv) == 2:
        with open(sys.argv[1], "w") as f:
            generate_typeslots(f)
    else:
        generate_typeslots()

if __name__ == "__main__":
    main()
back to top