GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Data race in `Decimal.__hash__()` · Issue #154037 · python/cpython Closed Labels extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:
This is a sub-issue of #153852, see gist here. Reproducer: import sys, threading from decimal import Decimal assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0" NT = 4 ROUNDS = 4000 pool = [None] enter = threading.Barrier(NT + 1) leave = threading.Barrier(NT + 1) def worker(): for _ in range(ROUNDS): enter.wait() for d in pool[0]: hash(d) # dec_hash: read self->hash==-1, then write it leave.wait() ts = [threading.Thread(target=worker) for _ in range(NT)] for t in ts: t.start() for r in range(ROUNDS): pool[0] = [Decimal(f"{r}.{i}") for i in range(64)] # fresh, unhashed each round enter.wait(); leave.wait() for t in ts: t.join() print("done, no crash") CPython versions tested on:CPython main branch Operating systems tested on:No response Linked PRsActivity
MetadataMetadataAssigneesLabelsextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |