- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
          Fix possible variable shadow in create_new_client_event
          #14575
        
      Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix a possible variable shadow in `create_new_client_event`. | 
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -1135,11 +1135,13 @@ async def create_new_client_event( | |||||||||||
| ) | ||||||||||||
| state_events = await self.store.get_events_as_list(state_event_ids) | ||||||||||||
| # Create a StateMap[str] | ||||||||||||
| state_map = {(e.type, e.state_key): e.event_id for e in state_events} | ||||||||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the  (just pulled out of #12083) synapse/synapse/handlers/message.py Lines 972 to 976 in cd93056 
 For reference and confusingly, all of the  
 As mentioned, since none of the stuff I've worked on for MSC2716 uses these parameters, I don't think there is a case where they interact unless @H-Shay has refactored some of that code and is probably the one to better answer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, my misunderstanding! Sorry about that. I assumed it all had to do with MSC2716 due to the "batch" comment in it. 😢 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 @H-Shay Can you create a follow-up issue to track this? And a separate one for "If we could somehow differentiate our internal batched event creating from MSC2716 that would be fabulous..." (#14575 (review)) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||||||||||||
| current_state_ids = { | ||||||||||||
| (e.type, e.state_key): e.event_id for e in state_events | ||||||||||||
| } | ||||||||||||
| # Actually strip down and only use the necessary auth events | ||||||||||||
| auth_event_ids = self._event_auth_handler.compute_auth_events( | ||||||||||||
| event=temp_event, | ||||||||||||
| current_state_ids=state_map, | ||||||||||||
| current_state_ids=current_state_ids, | ||||||||||||
| for_verification=False, | ||||||||||||
| ) | ||||||||||||
|  | ||||||||||||
|  | ||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wish we could add a lint for variable shadowing (parameter re-assigning) problem. Previously discussed at #10439 (comment)
The
mypyissue still exists: python/mypy#11076