Title: ifcopenshell: attach owning file to geom.tree select results (#3189) by petruconduraru · Pull Request #8522 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: ifcopenshell: attach owning file to geom.tree select results (#3189) by petruconduraru · Pull Request #8522 · IfcOpenShell/IfcOpenShell
X Title: ifcopenshell: attach owning file to geom.tree select results (#3189) by petruconduraru · Pull Request #8522 · IfcOpenShell/IfcOpenShell
Description: Fixes #3189. Problem Elements returned by geom.tree.select / select_box come back with wrapped_data.file == None. That forces entity_instance.__eq__ down the slow recursive get_info_2 attribute comparison instead of the fast step-id path, and drops the file reference that keeps the instance alive, which showed up as slowdowns and transaction issues. Cause Both methods wrapped their C++ results as entity_instance(e) with no file argument, so __init__ set wrapped_data.file = None. The underlying instances carry a valid file_pointer(), so the owning file was recoverable but never attached. (The 2023 PR #3190 added the lazy entity_instance.file getter but never assigned wrapped_data.file on tree results, so the reported problem persisted.) Fix Add a small tree._wrap helper that resolves the owning file from each result's file_pointer() via file.from_pointer() and attaches it, and route both select and select_box through it. Verification Repro on basic.ifc with the compiled wrapper: Before: wrapped_data.file is None; equality takes the slow path (2 get_info_2 calls). After: file attached; equality/hash use the fast path (0 slow calls); eq and hash match an identically-owned instance, for both select and select_box. black and ruff (line-length 120) pass. This contribution was produced with the assistance of an AI coding tool.
Open Graph Description: Fixes #3189. Problem Elements returned by geom.tree.select / select_box come back with wrapped_data.file == None. That forces entity_instance.__eq__ down the slow recursive get_info_2 attribute com...
X Description: Fixes #3189. Problem Elements returned by geom.tree.select / select_box come back with wrapped_data.file == None. That forces entity_instance.__eq__ down the slow recursive get_info_2 attribute com...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/8522
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f60de82e-cf1d-f00a-d237-cf662ef9fa8b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DF64:C51C8:CA38D4:10D0888:6B05045D |
| html-safe-nonce | 0f6d6b3dde86cc65e1c2528f650ba21f7b97655bae8a70df836653ffb049d0cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjY0OkM1MUM4OkNBMzhENDoxMEQwODg4OjZCMDUwNDVEIiwidmlzaXRvcl9pZCI6IjU4ODYyNjYwODEyNjE0NTQ0MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b757df95a9682c8e89c8a2907befef2605fc56581ccd8c18ea4b8a4778121038 |
| hovercard-subject-tag | pull_request:4036322395 |
| 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/IfcOpenShell/IfcOpenShell/pull/8522/files |
| twitter:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| og:image:alt | Fixes #3189. Problem Elements returned by geom.tree.select / select_box come back with wrapped_data.file == None. That forces entity_instance.__eq__ down the slow recursive get_info_2 attribute com... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width