Title: _PyEval_SetTrace() fails with RuntimeError: Cannot install a trace function while another trace function is being installed · Issue #98257 · python/cpython · GitHub
Open Graph Title: _PyEval_SetTrace() fails with RuntimeError: Cannot install a trace function while another trace function is being installed · Issue #98257 · python/cpython
X Title: _PyEval_SetTrace() fails with RuntimeError: Cannot install a trace function while another trace function is being installed · Issue #98257 · python/cpython
Description: The test_concurrency() of test_import fails randomly on sys.settrace(). Example: $ ./python -m test test_import -m test_concurrency -v -j30 -F --fail-env-changed (...) 0:00:13 load avg: 12.46 [ 97/1] test_import failed (env changed) test...
Open Graph Description: The test_concurrency() of test_import fails randomly on sys.settrace(). Example: $ ./python -m test test_import -m test_concurrency -v -j30 -F --fail-env-changed (...) 0:00:13 load avg: 12.46 [ 97/...
X Description: The test_concurrency() of test_import fails randomly on sys.settrace(). Example: $ ./python -m test test_import -m test_concurrency -v -j30 -F --fail-env-changed (...) 0:00:13 load avg: 12.46 [ 97/...
Opengraph URL: https://github.com/python/cpython/issues/98257
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_PyEval_SetTrace() fails with RuntimeError: Cannot install a trace function while another trace function is being installed","articleBody":"The test_concurrency() of test_import fails randomly on sys.settrace(). Example:\r\n\r\n```\r\n$ ./python -m test test_import -m test_concurrency -v -j30 -F --fail-env-changed \r\n(...)\r\n0:00:13 load avg: 12.46 [ 97/1] test_import failed (env changed)\r\ntest_concurrency (test.test_import.ImportTests) ... ok\r\n\r\n----------------------------------------------------------------------\r\nRan 1 test in 0.487s\r\n\r\nOK\r\nWarning -- Uncaught thread exception: RuntimeError\r\nException in thread Thread-13 (run):\r\nTraceback (most recent call last):\r\n File \"/home/vstinner/python/3.10/Lib/threading.py\", line 1016, in _bootstrap_inner\r\n self.run()\r\n File \"/home/vstinner/python/3.10/Lib/threading.py\", line 953, in run\r\n self._target(*self._args, **self._kwargs)\r\n File \"/home/vstinner/python/3.10/Lib/test/test_import/__init__.py\", line 457, in run\r\n sys.settrace(None)\r\nRuntimeError: Cannot install a trace function while another trace function is being installed\r\n(...)\r\n```\r\n\r\nThe problem is that the _PyEval_SetTrace() function fails with RuntimeError(\"Cannot install a trace function while another trace function is being installed\") on ``Py_XDECREF(traceobj);`` indirectly calls ``sys.settrace()``.\r\n\r\nIMO ``Py_XDECREF(traceobj);`` should be called *after* ``reentrant = 0;``, at the end of the function.","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2022-10-14T10:19:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/98257/cpython/issues/98257"}
| 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:48e1bb08-803f-1239-3ccc-86a2133dbdc6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9A0:37ACD:BB4C33:1002C1A:6969EC90 |
| html-safe-nonce | 1964709240086215fb8deb2c89ac885798c2ec90ddb6fdbadade255a65ebe16e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUEwOjM3QUNEOkJCNEMzMzoxMDAyQzFBOjY5NjlFQzkwIiwidmlzaXRvcl9pZCI6IjIxMTQxMzAwMzMyNTk0NDEyOTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9f99e74b68c7b3e6a3a2abea28690e908b7c5340c3bbb80e817a3e9dd6cd6591 |
| hovercard-subject-tag | issue:1409119966 |
| 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/98257/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7093d7ea32c55bd86fdc63fbf75055ca503b89b30913f80b0195544f287fa33a/python/cpython/issues/98257 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7093d7ea32c55bd86fdc63fbf75055ca503b89b30913f80b0195544f287fa33a/python/cpython/issues/98257 |
| og:image:alt | The test_concurrency() of test_import fails randomly on sys.settrace(). Example: $ ./python -m test test_import -m test_concurrency -v -j30 -F --fail-env-changed (...) 0:00:13 load avg: 12.46 [ 97/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| 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 | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width