File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -4158,10 +4158,15 @@ def evaluate_forward_ref(
41584158
41594159_sentinel_registry = {}
41604160
4161- def _unpickle_fetch_sentinel (name : str , module_name : str ):
4162- """Stable Sentinel unpickling function, fetch Sentinel at 'module_name.name'."""
4161+ def _unpickle_sentinel (
4162+ name : str ,
4163+ module_name : str ,
4164+ config : typing .Dict [str , typing .Any ],
4165+ / ,
4166+ ):
4167+ """Stable Sentinel unpickling function, get Sentinel at 'module_name.name'."""
41634168 # Explicit repr=name because a saved module_name is known to be valid
4164- return Sentinel (name , module_name , repr = name )
4169+ return Sentinel (name , module_name , repr = config . get ( "repr" , name ) )
41654170
41664171class Sentinel :
41674172 """A sentinel object.
@@ -4258,13 +4263,15 @@ def __ror__(self, other):
42584263 return typing .Union [other , self ]
42594264
42604265 def __reduce__ (self ):
4261- """Record where this sentinel is defined."""
4266+ """Record where this sentinel is defined and its current parameters."""
4267+ config = {"repr" : self ._repr }
42624268 # Reduce callable must be at the top-level to be stable whenever Sentinel changes
42634269 return (
4264- _unpickle_fetch_sentinel ,
4265- ( # Only the location of the sentinel needs to be stored
4270+ _unpickle_sentinel ,
4271+ (
42664272 self ._name ,
42674273 self ._module_name ,
4274+ config ,
42684275 ),
42694276 )
42704277
You can’t perform that action at this time.
0 commit comments