Bug 55598 - B023 Function definition does not bind loop variable
B023 Function definition does not bind loop variable
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-3-errata
Assigned To: Mika Westphal
Florian Best
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-01-26 19:04 CET by Florian Best
Modified: 2023-02-22 11:12 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): bitesize, Cleanup
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2023-01-26 19:04:25 CET
flake8-bugbear detected multiple issues in our code:

base/univention-config-registry/python/univention/service_info.py:197:18: B023 Function definition does not bind loop variable `link`                                       
base/univention-config-registry/python/univention/service_info.py:198:11: B023 Function definition does not bind loop variable `commandline`                                
base/univention-config-registry/python/univention/service_info.py:198:50: B023 Function definition does not bind loop variable `commandline`                                
base/univention-config-registry/python/univention/service_info.py:198:79: B023 Function definition does not bind loop variable `commandline`                                
base/univention-system-setup/umc/python/setup/__init__.py:459:38: B023 Function definition does not bind loop variable `maxlenth`                                           
base/univention-system-setup/umc/python/setup/__init__.py:463:40: B023 Function definition does not bind loop variable `table`                                              
management/univention-directory-manager-modules/modules/univention/admin/syntax.py:862:18: B023 Function definition does not bind loop variable `module`                    
management/univention-directory-manager-modules/modules/univention/admin/syntax.py:863:24: B023 Function definition does not bind loop variable `module`                    
management/univention-directory-manager-modules/modules/univention/admin/syntax.py:863:45: B023 Function definition does not bind loop variable `filter_s`                  
management/univention-directory-manager-modules/modules/univention/admin/syntax.py:871:14: B023 Function definition does not bind loop variable `module`                    
management/univention-directory-manager-modules/modules/univention/admin/syntax.py:871:38: B023 Function definition does not bind loop variable `filter_s`                  
management/univention-directory-manager-modules/scripts/convert-user-base64-photos:63:29: B023 Function definition does not bind loop variable `idn`                        
services/univention-net-installer/univention-net-installer-daemon:127:4: B023 Function definition does not bind loop variable `client`                                      
services/univention-net-installer/univention-net-installer-daemon:129:12: B023 Function definition does not bind loop variable `client`                                     
services/univention-net-installer/univention-net-installer-daemon:133:5: B023 Function definition does not bind loop variable `client`

B023: Functions defined inside a loop must not use variables redefined in the loop, because late-binding closures are a classic gotcha: https://docs.python-guide.org/writing/gotchas/#late-binding-closures
Comment 1 Mika Westphal univentionstaff 2023-02-08 08:42:20 CET
Some functions did not bound the loop variables over the function signature. This was changed.

univention-system-setup (13.0.5-1)
0c190f91d80e | Bug #55598: Function now binds the loop variables
7318b3588239 | Bug #55598: Function now binds the loop variables

univention-net-installer (13.0.3-1)
0c190f91d80e | Bug #55598: Function now binds the loop variables

univention-directory-manager-modules (15.0.15-1)
0c190f91d80e | Bug #55598: Function now binds the loop variables
d4c540a574af | Bug #55598: Function now binds the loop variables

univention-config-registry (15.0.9-1)
694580dacc38 | Bug #55598: Function now binds the loop variables
Comment 2 Florian Best univentionstaff 2023-02-22 10:49:13 CET
OK: code changes
OK: changelog entry
Comment 3 Florian Best univentionstaff 2023-02-22 11:12:15 CET
UCS 5.0-3 has been released.

https://docs.software-univention.de/release-notes/5.0-3/en/

If this error occurs again, please clone this bug.