Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-43468: Per instance locking for functools.cached_property #27609

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

@rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Aug 4, 2021

Draft PR. It needs a NEWS entry, perhaps more tests, and perhaps some more factoring.

https://bugs.python.org/issue43468

@sweeneyde
Copy link
Member

@sweeneyde sweeneyde commented Aug 7, 2021

It looks like threading._register_atexit could lazily import functools to avoid the circular threading <=> functools import

@@ -18,7 +18,7 @@
from collections import namedtuple
# import types, weakref # Deferred to single_dispatch()
from reprlib import recursive_repr
from _thread import RLock
from threading import RLock, Condition, get_ident

This comment has been minimized.

@ambv

ambv Aug 17, 2021
Contributor

This change introduces an import cycle which causes tests to fail.

@@ -0,0 +1,3 @@
Fixed locking for functools.cached_property() to have instance specific
locking. Formerly, it blocked all instances of the same class, making it
suitable for parallel I/O bound computations (which were a key use case).

This comment has been minimized.

@ptmcg

ptmcg Aug 27, 2021

Do you mean "unsuitable"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants