Title: fix: iterate over list copies in remove_hook to avoid mutation during iteration by Copilot · Pull Request #1943 · usethis-python/usethis-python · GitHub
Open Graph Title: fix: iterate over list copies in remove_hook to avoid mutation during iteration by Copilot · Pull Request #1943 · usethis-python/usethis-python
X Title: fix: iterate over list copies in remove_hook to avoid mutation during iteration by Copilot · Pull Request #1943 · usethis-python/usethis-python
Description: remove_hook iterates over model.repos and repo.hooks while calling .remove() on the same lists, skipping elements when a hook_id matches multiple hooks or multiple repos become empty in one pass. Fix: iterate over list(model.repos) and list(repo.hooks) copies Tests: added cases for duplicate hooks in same repo and multiple repos becoming empty simultaneously # Before (buggy) for repo in model.repos: for hook in repo.hooks: if match: repo.hooks.remove(hook) # skips next element if not repo.hooks: model.repos.remove(repo) # skips next repo # After for repo in list(model.repos): for hook in list(repo.hooks): ...
Open Graph Description: remove_hook iterates over model.repos and repo.hooks while calling .remove() on the same lists, skipping elements when a hook_id matches multiple hooks or multiple repos become empty in one pass. ...
X Description: remove_hook iterates over model.repos and repo.hooks while calling .remove() on the same lists, skipping elements when a hook_id matches multiple hooks or multiple repos become empty in one pass. ...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1943
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c4f46355-65b8-6e04-44b0-257993e87ade |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9186:112EC5:1A8C2B8:249C7DE:6A4EB2F4 |
| html-safe-nonce | 60b80dbc594043c5dc4e03d75d8d5271ac655109d544d62459255c4ca665cbf4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTg2OjExMkVDNToxQThDMkI4OjI0OUM3REU6NkE0RUIyRjQiLCJ2aXNpdG9yX2lkIjoiNzA5MzE0MTA4NTI4Nzc4OTMwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 953e9c858e1f954b27d209a7c7fc0317ce821a8cc1006e6eea70dc5586c7856c |
| hovercard-subject-tag | pull_request:3713389886 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/usethis-python/usethis-python/pull/1943/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | remove_hook iterates over model.repos and repo.hooks while calling .remove() on the same lists, skipping elements when a hook_id matches multiple hooks or multiple repos become empty in one pass. ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width