| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Some fields in PyCodeObject are lazily initialized. Use atomics and critical sections to make their initializations and accesses thread-safe.
|
Hi @colesbury , Lysandros pointed me out to your PR fixing a bug in FT mode. import concurrent.futures
import threading
import inspect
def decorator(f):
# Introspect the callable for optional features.
sig = inspect.signature(f)
for param in sig.parameters.values():
pass
def emit_call_op(*call_args):
pass
wrapped = emit_call_op
return wrapped
def test_dialects_vector_repro_3():
num_workers = 6
num_runs = 10
barrier = threading.Barrier(num_workers)
def closure():
barrier.wait()
for _ in range(num_runs):
@decorator
def print_vector(arg):
return 0
barrier.wait()
with concurrent.futures.ThreadPoolExecutor(
max_workers=num_workers
) as executor:
futures = []
for _ in range(num_workers):
futures.append(executor.submit(closure))
# We should call future.result() to re-raise an exception if test has
# failed
assert len(list(f.result() for f in futures)) == num_workers
if __name__ == "__main__":
test_dialects_vector_repro_3()Outputs (cpython 3.13 built with TSAN): ==================
WARNING: ThreadSanitizer: data race (pid=30720)
Write of size 8 at 0x7fedfa39de10 by thread T6:
#0 init_co_cached /tmp/cpython-tsan/Objects/codeobject.c:309:26 (python3.13t+0x1e6441) (BuildId: f1122943b999261e166922e88bbc71af5ecf54a9)
#1 _PyCode_GetVarnames /tmp/cpython-tsan/Objects/codeobject.c:1562:9 (python3.13t+0x1e6441)
#2 code_getvarnames /tmp/cpython-tsan/Objects/codeobject.c:2107:12 (python3.13t+0x1e6441)
#3 getset_get /tmp/cpython-tsan/Objects/descrobject.c:193:16 (python3.13t+0x1eb966) (BuildId: f1122943b999261e166922e88bbc71af5ecf54a9)
or Read of size 8 at 0x7efddc0e0068 by thread T2:
#0 get_cached_locals /tmp/cpython-tsan/Objects/codeobject.c:1547:9 (python3.13t+0x1e0e8a) (BuildId: f1122943b999261e166922e88bbc71af5ecf54a9)
#1 _PyCode_GetVarnames /tmp/cpython-tsan/Objects/codeobject.c:1565:12 (python3.13t+0x1e6484) (BuildId: f1122943b999261e166922e88bbc71af5ecf54a9)
#2 code_getvarnames /tmp/cpython-tsan/Objects/codeobject.c:2107:12 (python3.13t+0x1e6484)
#3 getset_get /tmp/cpython-tsan/Objects/descrobject.c:193:16 (python3.13t+0x1eb966) (BuildId: f1122943b999261e166922e88bbc71af5ecf54a9)
Can you please check and run it in your PR and see if this is also fixed? Thanks a lot! |
Sorry, something went wrong.
|
@vfdev-5, I verified that it fixed your repro as well. |
Sorry, something went wrong.
|
Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
…pythonGH-127043) Some fields in PyCodeObject are lazily initialized. Use atomics and critical sections to make their initializations and accesses thread-safe. (cherry picked from commit 3926842) Co-authored-by: Sam Gross <colesbury@gmail.com>
|
GH-127107 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
…python#127043) Some fields in PyCodeObject are lazily initialized. Use atomics and critical sections to make their initializations and accesses thread-safe.
| Back | FazBrowse Home | New Git URL |
Some fields in PyCodeObject are lazily initialized. Use atomics and critical sections to make their initializations and accesses thread-safe.