Title: Fix closerange empty ranges before unsigned conversion by youknowdot · Pull Request #9031 · RustPython/RustPython · GitHub
Open Graph Title: Fix closerange empty ranges before unsigned conversion by youknowdot · Pull Request #9031 · RustPython/RustPython
X Title: Fix closerange empty ranges before unsigned conversion by youknowdot · Pull Request #9031 · RustPython/RustPython
Description: Summary Fix empty os.closerange() ranges before converting the exclusive upper bound to an inclusive unsigned bound. After clamping the lower bound, equal bounds must return without calling close_range(). Otherwise an empty range with a zero upper bound can convert -1 to UINT_MAX and close every descriptor; other equal bounds must also be no-ops. Refresh the existing PR by merging main df0d1b74c04408365f66666a03054d673dbccee7 append-only. The current-main diff contains only the Rust fix and its existing subprocess regression; the previously shared PyO3 benchmark-import correction is already on main and no longer appears in this PR's diff. No new tests, skips, or Lib changes are introduced by this refresh. Regression coverage and reference limitation The existing stdlib_os.py snippet runs the closerange regression in a child process. All RustPython no-op cases remain active: (0, 0), (-1, 0), positive equal bounds, positive reversed bounds, and (-2, -1). The single-descriptor case verifies adjacent descriptors remain open. The exact CPython 3.15.0 Linux reference artifact reproduced python/cpython#159182; upstream fix #159183 remains open at this refresh. The existing guard excludes only the three documented zero/negative-upper-bound cases on CPython 3.15.0 final, Linux, with HAVE_CLOSE_RANGE. Other reference cases and all RustPython cases remain active. This refresh does not alter that guard or any assertion. Validation The resulting closerange function and complete existing stdlib_os.py snippet are byte-identical to previously tested PR head 5bc1814470459db99366b67e855c71d58d2f414c. Existing canonical Lib/test/test_os closerange tests do not cover the empty/equal-bound regression; no duplicate snippet coverage was added during this refresh. Fresh cargo check and strict cargo clippy -- -D warnings for rustpython-host_env --lib passed against the current-main composition (locked, offline, Linux target, fresh target directory). Input closure verification passed before and after both checks. The first offline check stopped before compilation because the shared cache lacked registry xml; a separate cache populated with normal locked Cargo fetch resolved it without changing dependencies or Cargo.lock. Normal commit hooks passed for merge commit 335a575a7e202501f683e1d07e945ed7fa44542b: merge-conflict and rustfmt passed; Ruff, redundant-test-patches and Prettier selected no files. Only cspell was excluded with the maintainer-authorized one-commit exception because its dependency setup was blocked. This is not a cspell pass. The earlier head's hosted CI succeeded. This is historical evidence, not a claim that the current-main composition has passed CI or fresh interpreter runtime tests. No full interpreter build, closerange execution, full workspace/C-API suite or unrelated GC-stress test was run locally for this refresh. Hosted correctness CI completed successfully for exact merge commit 335a575a7e202501f683e1d07e945ed7fa44542b: all 24 jobs passed, including Linux/macOS/Windows snippets and CPython tests and Rust tests. The Lib Dependencies Check workflow does not apply because this PR changes no Lib/** files. AI assistance: dot inspected, prepared and reviewed the current-main refresh under maintainer direction. The runtime does not expose its exact model version.
Open Graph Description: Summary Fix empty os.closerange() ranges before converting the exclusive upper bound to an inclusive unsigned bound. After clamping the lower bound, equal bounds must return without calling close_r...
X Description: Summary Fix empty os.closerange() ranges before converting the exclusive upper bound to an inclusive unsigned bound. After clamping the lower bound, equal bounds must return without calling close_r...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9031
X: @github
Domain: github.com
| 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:bec43392-f1ed-d6fa-bce8-44b3b229ecd9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BC86:16AB79:3A28C90:49EC8D9:6B01FE1D |
| html-safe-nonce | 36e0452c45a833bfea0a68f8c7e8d9baacedfe9979a538f778ff0c884318e24b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzg2OjE2QUI3OTozQTI4QzkwOjQ5RUM4RDk6NkIwMUZFMUQiLCJ2aXNpdG9yX2lkIjoiMjI4Nzg1MDY3MDQyOTMwMjA1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 316b0a3b2f1e39a0b2d709cf7f271bbf6834a733b3b2992aa3d2f265fb4e3cb3 |
| hovercard-subject-tag | pull_request:4807594141 |
| 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/RustPython/RustPython/pull/9031/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Fix empty os.closerange() ranges before converting the exclusive upper bound to an inclusive unsigned bound. After clamping the lower bound, equal bounds must return without calling close_r... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width