Title: `test_walk_above_recursion_limit` uses absolute limits · Issue #116057 · python/cpython · GitHub
Open Graph Title: `test_walk_above_recursion_limit` uses absolute limits · Issue #116057 · python/cpython
X Title: `test_walk_above_recursion_limit` uses absolute limits · Issue #116057 · python/cpython
Description: Bug report Bug description: os.walk and Path.walk both have a test verifying that they're not implemented recursively. However, their recursion limits are absolute rather than relative to the current frame. Since the test framework itsel...
Open Graph Description: Bug report Bug description: os.walk and Path.walk both have a test verifying that they're not implemented recursively. However, their recursion limits are absolute rather than relative to the curre...
X Description: Bug report Bug description: os.walk and Path.walk both have a test verifying that they're not implemented recursively. However, their recursion limits are absolute rather than relative to the c...
Opengraph URL: https://github.com/python/cpython/issues/116057
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`test_walk_above_recursion_limit` uses absolute limits","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\n`os.walk` and `Path.walk` both have a test verifying that they're not implemented recursively. However, their recursion limits are absolute rather than relative to the current frame. Since the test framework itself already consumes about 30 frames, it only takes a few extra frames to cause a spurious failure. This can easily happen when running the tests within another script, which happens in the Android testbed.\r\n\r\nFor example, if the limit in test_pathlib is reduced from 40 to 35:\r\n\r\n```\r\n======================================================================\r\nERROR: test_walk_above_recursion_limit (test.test_pathlib.test_pathlib.PosixPathTest.test_walk_above_recursion_limit)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 241, in __str__\r\n return self._str\r\n ^^^^^^^^^\r\nAttributeError: 'PosixPath' object has no attribute '_str'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 300, in drive\r\n return self._drv\r\n ^^^^^^^^^\r\nAttributeError: 'PosixPath' object has no attribute '_drv'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/Users/msmith/git/python/cpython/Lib/test/test_pathlib/test_pathlib.py\", line 1203, in test_walk_above_recursion_limit\r\n list(base.walk())\r\n ~~~~^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/_abc.py\", line 875, in walk\r\n scandir_obj = path._scandir()\r\n ~~~~~~~~~~~~~^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 588, in _scandir\r\n return os.scandir(self)\r\n ~~~~~~~~~~^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 177, in __fspath__\r\n return str(self)\r\n ~~~^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 243, in __str__\r\n self._str = self._format_parsed_parts(self.drive, self.root,\r\n ^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 302, in drive\r\n self._drv, self._root, self._tail_cached = self._parse_path(self._raw_path)\r\n ^^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pathlib/__init__.py\", line 293, in _raw_path\r\n path = self.pathmod.join(*paths)\r\n ~~~~~~~~~~~~~~~~~^^^^^^^^\r\n File \"\u003cfrozen posixpath\u003e\", line 77, in join\r\nRecursionError: maximum recursion depth exceeded\r\n```\r\n\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\n* macOS\r\n* Android\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-116058\r\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/mhsmith","@type":"Person","name":"mhsmith"},"datePublished":"2024-02-28T17:48:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/116057/cpython/issues/116057"}
| 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:e3d30728-1d45-eacf-2f26-ffdf1d3fd292 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFEC:275F42:153E38E:1D2EFCC:696AA4BF |
| html-safe-nonce | 2d618ea35f4889f22e66766cefcf2c8fc072944bd3e386d733a7d6823a759f87 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkVDOjI3NUY0MjoxNTNFMzhFOjFEMkVGQ0M6Njk2QUE0QkYiLCJ2aXNpdG9yX2lkIjoiNDUxMzUzNzI2ODYzNDAwMjYyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 744530e4608d3cca8180e8f21555dbe4fbcced29174777e775b7aa6dcf83fd84 |
| hovercard-subject-tag | issue:2159503423 |
| 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/116057/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bce44a3cce1c26c47101ed33baf749ad912492a653149c912539294174424f45/python/cpython/issues/116057 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bce44a3cce1c26c47101ed33baf749ad912492a653149c912539294174424f45/python/cpython/issues/116057 |
| og:image:alt | Bug report Bug description: os.walk and Path.walk both have a test verifying that they're not implemented recursively. However, their recursion limits are absolute rather than relative to the curre... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mhsmith |
| hostname | github.com |
| expected-hostname | github.com |
| None | a51f97dbb9326f71c08ecb61577457d543c602124d1a2672871258ef37ac5261 |
| 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 | 4bd0eac606c70914085176ef312ebdcd97a8cdf1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width