Title: new `TestUopsOptimization` test case failing an assert · Issue #117180 · python/cpython · GitHub
Open Graph Title: new `TestUopsOptimization` test case failing an assert · Issue #117180 · python/cpython
X Title: new `TestUopsOptimization` test case failing an assert · Issue #117180 · python/cpython
Description: Bug report Bug description: While writing test cases for #116168, I ran into a case that failed on main too. Here's the test as a diff. It's under test_opt.TestUopsOptimization: diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test...
Open Graph Description: Bug report Bug description: While writing test cases for #116168, I ran into a case that failed on main too. Here's the test as a diff. It's under test_opt.TestUopsOptimization: diff --git a/Lib/te...
X Description: Bug report Bug description: While writing test cases for #116168, I ran into a case that failed on main too. Here's the test as a diff. It's under test_opt.TestUopsOptimization: diff --git ...
Opengraph URL: https://github.com/python/cpython/issues/117180
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"new `TestUopsOptimization` test case failing an assert","articleBody":"# Bug report\n\n### Bug description:\n\nWhile writing test cases for #116168, I ran into a case that failed on `main` too. Here's the test as a diff. It's under `test_opt.TestUopsOptimization`:\n\n```diff\ndiff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py\nindex b0859a382d..269753e4c1 100644\n--- a/Lib/test/test_capi/test_opt.py\n+++ b/Lib/test/test_capi/test_opt.py\n@@ -955,6 +955,31 @@ def testfunc(n):\n _, ex = self._run_with_optimizer(testfunc, 16)\n self.assertIsNone(ex)\n\n+ def test_many_nested(self):\n+ # overflow the trace_stack\n+ def dummy_a(x):\n+ return x\n+ def dummy_b(x):\n+ return dummy_a(x)\n+ def dummy_c(x):\n+ return dummy_b(x)\n+ def dummy_d(x):\n+ return dummy_c(x)\n+ def dummy_e(x):\n+ return dummy_d(x)\n+ def dummy_f(x):\n+ return dummy_e(x)\n+ def dummy_g(x):\n+ return dummy_f(x)\n+ def dummy_h(x):\n+ return dummy_g(x)\n+ def testfunc(n):\n+ a = 0\n+ for _ in range(n):\n+ a += dummy_h(n)\n+ return a\n+\n+ self._run_with_optimizer(testfunc, 32)\n\n if __name__ == \"__main__\":\n unittest.main()\n```\n\nI'm running this locally (source build of `main` `9967b568edd2e35b0415c14c7242f3ca2c0dc03d` on an M1 mac).\n\nCommand:\n\n```\n./python.exe -m test test.test_capi.test_opt\n```\n\nOutput:\n\n```\nUsing random seed: 1780919823\nRaised RLIMIT_NOFILE: 256 -\u003e 1024\n0:00:00 load avg: 2.88 Run 1 test sequentially\n0:00:00 load avg: 2.88 [1/1] test.test_capi.test_opt\nAssertion failed: ((this_instr + 2)-\u003eopcode == _PUSH_FRAME), function optimize_uops, file optimizer_cases.c.h, line 1600.\nFatal Python error: Aborted\n\nCurrent thread 0x000000020140a100 (most recent call first):\n File \"/Users/peterlazorchak/repos/oss-clones/forks/cpython/Lib/test/test_capi/test_opt.py\", line 979 in testfunc\n File \"/Users/peterlazorchak/repos/oss-clones/forks/cpython/Lib/test/test_capi/test_opt.py\", line 588 in _run_with_optimizer\n File \"/Users/peterlazorchak/repos/oss-clones/forks/cpython/Lib/test/test_capi/test_opt.py\", line 982 in test_many_nested\n File \"/Users/peterlazorchak/repos/oss-clones/forks/cpython/Lib/unittest/case.py\", line 589 in _callTestMethod\n....[truncated for brevity]....\n File \"/Users/peterlazorchak/repos/oss-clones/forks/cpython/Lib/runpy.py\", line 88 in _run_code\n File \"/Users/peterlazorchak/repos/oss-clones/forks/cpython/Lib/runpy.py\", line 198 in _run_module_as_main\n\nExtension modules: _testcapi, _testinternalcapi (total: 2)\nzsh: abort ./python.exe -m test test.test_capi.test_opt\n```\n\nThis assertion is in the optimizer case for `_INIT_CALL_PY_EXACT_ARGS`. I haven't investigated any further beyond that.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-117184\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/lazorchakp","@type":"Person","name":"lazorchakp"},"datePublished":"2024-03-23T13:26:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/117180/cpython/issues/117180"}
| 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:86d7a298-8666-2a3b-7db1-28c092470d46 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9A0:93150:5A33D90:7E4E9DA:6A572DBE |
| html-safe-nonce | daca7c54a750a3e054ae4494b12fd14b1519a7cb58ac47b87952dd1247296f17 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUEwOjkzMTUwOjVBMzNEOTA6N0U0RTlEQTo2QTU3MkRCRSIsInZpc2l0b3JfaWQiOiIxNzYyNzQ0MDIyNzU2NDM3NDM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f7c1fe28963a13024a8107052fd3d361230ccb6f8ccfe001fe0d4e777c7d4c9d |
| hovercard-subject-tag | issue:2203879536 |
| 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/117180/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d7cf05f5d46a2c0dce5c5ce4220c756fdab71b44734d9ccff6b5f3638124bee0/python/cpython/issues/117180 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d7cf05f5d46a2c0dce5c5ce4220c756fdab71b44734d9ccff6b5f3638124bee0/python/cpython/issues/117180 |
| og:image:alt | Bug report Bug description: While writing test cases for #116168, I ran into a case that failed on main too. Here's the test as a diff. It's under test_opt.TestUopsOptimization: diff --git a/Lib/te... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lazorchakp |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| 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 | 2576d1f0198cf1588faf2edf27f1ed120903be10 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width