forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
- Remove old code from the
immutablemodule, for exampleimmutable_register_freezable - Modules & Types should be unfreezable by default
- PLDI specific: Modules should have the
Proxyimmutability by default or different default should be documented - Use
PyModuleDef_Slotto allow modules to opt-in/out of immutability
- PLDI specific: Modules should have the
- Add escape hatches (§6.2):
- Sub-interpreter Local
- Cell type
- Remove not freezable type once explicit freezability is in.
- Fix (most) "freeze: type 'XYZ' has no tp_traverse and no tp_reachable" warnings
David
- How do we handle weak references??
_PyWeakref_GET_REFneeds a_Py_IsImmutablebranch which requires aTryIncrefwhich is hard for SCCs...- Freeing requires GILs of different interpreters
MatP
- Split
immutablemodule into a Python module and a C module - Add new
tp_reachable(same signature astp_traverse) toPyTypeObject(Needed for the PEP)- Add
dict_reachablesincedict_traversedoesn't visit unicode strings.
- Add
- Support immutability by construction (§5.3 in the paper)
- Add
register_shallow_freezable(𝑡𝑦𝑝𝑒) - Make these objects immutable on first observation
- Add
- Add
set_freezable()with the valuesYES,NO,EXPLICITandPROXY(For modules) to theimmutablemodule- Implement the
Explicitfreezability - Check for freezability in freezing code
- Remove special casing for
blocking_onandmodule_lockswhich should never be frozen - There is a check in
traverse_freezewhich should be removed in favour of this mechanism. Probably incheck_freezable
- Implement the
- Allow
freeze()to take multiple arguments - Make
freeze()return the (first) passed in object - Fix rollback of SCC given failed freeze.
Tobias
- Investigate naming convention, should
isfrozenbeis_frozen?- Either adjust paper (which uses
is_frozen) - Or our implementation which uses
isfrozen
- Either adjust paper (which uses
- Add
@freezable,@frozen,@explicitlyFreezableand@unfreezabledecorator - Add
mutable(obj, ...)context manager to temporarily setfreezabilitytoNo- Maybe add a C mechanism which could be used in a similar way
Fred
- Expose mutable module state in
sys.mut_modules - Make
shadow_function_globalsless smart (Don't freeze values based on strings which might index) - Some test were failing for module objects in proxy mode
- Add pre-freeze hook (and check for it)
- Change module and functions to use the pre-freeze hook instead of
if-statement
- Change module and functions to use the pre-freeze hook instead of
- Add
Py_mod_reachableto module slots
Pending TODOs, but not critical for PLDI or DPO:
- Add
ImmutableErrorto the immutable module (Error name and message is open to change) - Investigate if
_PyOwnership_is_c_wrapperis still needed - Improve RC overhead for frozen objects
- https://github.com/mjp41/cpython/blob/b6510b9c60b441f3bcdcdc2ce124c78fff44a98e/Objects/typeobject.c#L6599
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels