Title: Improve CAPI tests of `set` and `frozenset` · Issue #110525 · python/cpython · GitHub
Open Graph Title: Improve CAPI tests of `set` and `frozenset` · Issue #110525 · python/cpython
X Title: Improve CAPI tests of `set` and `frozenset` · Issue #110525 · python/cpython
Description: Feature or enhancement Right now CAPI tests of set and frozenset are quite outdated. They are defined as .test_c_api method on set objects, when Py_DEBUG is set: cpython/Objects/setobject.c Lines 2371 to 2511 in 7e30821 #ifdef Py_DEBUG /...
Open Graph Description: Feature or enhancement Right now CAPI tests of set and frozenset are quite outdated. They are defined as .test_c_api method on set objects, when Py_DEBUG is set: cpython/Objects/setobject.c Lines 2...
X Description: Feature or enhancement Right now CAPI tests of set and frozenset are quite outdated. They are defined as .test_c_api method on set objects, when Py_DEBUG is set: cpython/Objects/setobject.c Lines 2...
Opengraph URL: https://github.com/python/cpython/issues/110525
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve CAPI tests of `set` and `frozenset`","articleBody":"# Feature or enhancement\n\nRight now CAPI tests of `set` and `frozenset` are quite outdated. They are defined as `.test_c_api` method on `set` objects, when `Py_DEBUG` is set:\n\nhttps://github.com/python/cpython/blob/7e30821b17b56bb5ed9799f62eb45e448cb52c8e/Objects/setobject.c#L2371-L2511\n\nThere are several things that I can see as problematic:\n- It is stored together with the production code\n- These tests are mixing CAPI (`PySet_Check`), internal CAPI (`_PySet_Update`), and internal function calls (`set_clear_internal`)\n- These tests are hard to parametrize since they are called as \n\nhttps://github.com/python/cpython/blob/7e30821b17b56bb5ed9799f62eb45e448cb52c8e/Lib/test/test_set.py#L638-L641\n\n- Multiple things are not tested: like `set` and `frozenset` subclasses\n- Test failures are not quite informative, because using C `assert`\n- This is a single huge test\n- This test is only run under debug builds and not under \"release\" builds\n\nI propose a plan to improve it:\n- [x] Move CAPI tests to `Modules/_testcapi/set.c` and add `Lib/test/test_capi/test_set.py`\n- [x] Move internal CAPI tests `Modules/_testinternalcapi/set.c` and make sure that they are executed in `test_capi.py`\n- [x] Delete `test_c_api` from `setobject.c`\n\nI plan to work on this and already have the PR for `1.` :)\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-110526\n* gh-110544\n* gh-110547\n* gh-110554\n* gh-110630\n* gh-110688\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2023-10-08T20:21:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/110525/cpython/issues/110525"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bd964aa3-6d0e-58e8-6d77-9e7d15516cf6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8FC:2D4000:1D075CA:287B18A:696A57B1 |
| html-safe-nonce | 67703a6a56d3c71fa7587b0d187b7aed52d3ee5f31c92f127a88740cf8858c2b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEZDOjJENDAwMDoxRDA3NUNBOjI4N0IxOEE6Njk2QTU3QjEiLCJ2aXNpdG9yX2lkIjoiNjI4OTkyMjQxMDY4MTA5NjExMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ad22a11bb4e247e38cc6d6a01538c93d726121d1ed93d99f051c95e710bb520f |
| hovercard-subject-tag | issue:1932054634 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/110525/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3378674e883380fc7674a41b978ed559da066b67b22dca933a0cd9a08fd3964f/python/cpython/issues/110525 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3378674e883380fc7674a41b978ed559da066b67b22dca933a0cd9a08fd3964f/python/cpython/issues/110525 |
| og:image:alt | Feature or enhancement Right now CAPI tests of set and frozenset are quite outdated. They are defined as .test_c_api method on set objects, when Py_DEBUG is set: cpython/Objects/setobject.c Lines 2... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width