René's URL Explorer Experiment


Title: fix: translate RecursionError to StackError in fallback Unpacker.skip() by hdimer · Pull Request #727 · msgpack/msgpack-python · GitHub

Open Graph Title: fix: translate RecursionError to StackError in fallback Unpacker.skip() by hdimer · Pull Request #727 · msgpack/msgpack-python

X Title: fix: translate RecursionError to StackError in fallback Unpacker.skip() by hdimer · Pull Request #727 · msgpack/msgpack-python

Description: Finding #6 of #683. Unpacker.skip() is the one unpack entry point in fallback.py that lets a RecursionError escape. unpack() and __next__() both translate it, skip() does not: def skip(self): self._unpack(EX_SKIP) # no guard self._consume() def unpack(self): try: ret = self._unpack(EX_CONSTRUCT) except RecursionError: raise StackError self._consume() return ret so on deeply nested input the two disagree: >>> data = b"\x91" * 3000 # nested fixarray(len=1) >>> u = Unpacker(); u.feed(data); u.unpack() msgpack.exceptions.StackError >>> u = Unpacker(); u.feed(data); u.skip() RecursionError: maximum recursion depth exceeded The C extension has no such gap: its skip() goes through the same Unpacker._unpack as unpack(), which raises StackError on ret == -3 (_unpacker.pyx:503). So what a caller sees on this path depends on which implementation is loaded. StackError subclasses ValueError, so code that guards against adversarial nesting with except StackError or except ValueError is unprotected on the skip path under the pure-Python implementation, which is the configuration where the recursion is reachable in the first place. The fix Wrap the body the way unpack() already does, four lines away: def skip(self): try: self._unpack(EX_SKIP) except RecursionError: raise StackError self._consume() self._consume() stays outside the try, matching unpack(), so the buffer state after a failure is the same on both paths. I checked that: after the failure tell() is 0 and a retry raises StackError again, identical to unpack() on the same input. The except cannot mask a user error here. Under EX_SKIP, _unpack calls no user-supplied hook: the array and map branches recurse with EX_SKIP without touching list_hook / object_hook / object_pairs_hook, and the if execute == EX_SKIP: return short-circuits before ext_hook. The only recursion inside the try is msgpack's own, which makes this guard strictly narrower than the two it copies. read_array_header() / read_map_header() do not need the same treatment: _unpack returns the header count before it reaches the recursion, so they are unaffected by nesting depth. Tests The assertion sits next to the existing one-shot StackError case in test_invalidvalue, since it closes the one-shot vs. streaming gap on the same payload. It fails on main with RecursionError: maximum recursion depth exceeded and passes with the change. It is green under the C extension too, where the same input trips the embed stack limit, so it also pins the parity rather than just the fallback. Verified on CPython 3.14: full suite green in both the C-extension and MSGPACK_PUREPYTHON=1 configurations, ruff check and ruff format clean. Disclosure: I used an AI assistant while investigating and writing this patch. I reproduced the divergence myself, confirmed the fix against both builds, and I stand behind the change.

Open Graph Description: Finding #6 of #683. Unpacker.skip() is the one unpack entry point in fallback.py that lets a RecursionError escape. unpack() and __next__() both translate it, skip() does not: def skip(self): s...

X Description: Finding #6 of #683. Unpacker.skip() is the one unpack entry point in fallback.py that lets a RecursionError escape. unpack() and __next__() both translate it, skip() does not: def skip(self): s...

Opengraph URL: https://github.com/msgpack/msgpack-python/pull/727

X: @github

direct link

Domain: redirect.github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:cc84e005-4af6-6266-9834-d90402bc9803
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBBFE:20D75E:2DC3EE:3F1137:6B074C57
html-safe-noncef4265b65421c80f8fdaf4b95ec513908dfce845c8317322ccee26bfa26596451
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkZFOjIwRDc1RToyREMzRUU6M0YxMTM3OjZCMDc0QzU3IiwidmlzaXRvcl9pZCI6IjgxMzgyNjU4MDQxOTk2NDQyNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5e8b846aa8baeb3d9dc854c965b504bcb6acdf25ba53f4e87f8aa1930f4d6c23
hovercard-subject-tagpull_request:4292046598
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/msgpack/msgpack-python/pull/727/files
twitter:imagehttps://avatars.githubusercontent.com/u/94395445?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/94395445?s=400&v=4
og:image:altFinding #6 of #683. Unpacker.skip() is the one unpack entry point in fallback.py that lets a RecursionError escape. unpack() and __next__() both translate it, skip() does not: def skip(self): s...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None26f151990bcb5b67b87df8b3f96ed340f849939d44e36f348402de5e39cca989
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/msgpack/msgpack-python git https://github.com/msgpack/msgpack-python.git
octolytics-dimension-user_id198264
octolytics-dimension-user_loginmsgpack
octolytics-dimension-repository_id2242705
octolytics-dimension-repository_nwomsgpack/msgpack-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id2242705
octolytics-dimension-repository_network_root_nwomsgpack/msgpack-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecd00d8452bcb4e56a60ba7c0e61a697b46513fe9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/msgpack/msgpack-python/pull/727/files#start-of-content
https://redirect.github.com/
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmsgpack%2Fmsgpack-python%2Fpull%2F727%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmsgpack%2Fmsgpack-python%2Fpull%2F727%2Ffiles
Sign uphttps://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=msgpack%2Fmsgpack-python
Reloadhttps://redirect.github.com/msgpack/msgpack-python/pull/727/files
Reloadhttps://redirect.github.com/msgpack/msgpack-python/pull/727/files
Reloadhttps://redirect.github.com/msgpack/msgpack-python/pull/727/files
msgpackhttps://redirect.github.com/msgpack
msgpack-pythonhttps://redirect.github.com/msgpack/msgpack-python
Codehttps://redirect.github.com/msgpack/msgpack-python
Issues5 (5)https://redirect.github.com/msgpack/msgpack-python/issues
Pull requests21 (21)https://redirect.github.com/msgpack/msgpack-python/pulls
Discussionshttps://redirect.github.com/msgpack/msgpack-python/discussions
Actionshttps://redirect.github.com/msgpack/msgpack-python/actions
Security and quality2 (2)https://redirect.github.com/msgpack/msgpack-python/security
Insightshttps://redirect.github.com/msgpack/msgpack-python/insights
Sign up for GitHub https://redirect.github.com/signup?return_to=%2Fmsgpack%2Fmsgpack-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://redirect.github.com/login?return_to=%2Fmsgpack%2Fmsgpack-python%2Fissues%2Fnew%2Fchoose
methanehttps://redirect.github.com/methane
msgpack:mainhttps://redirect.github.com/msgpack/msgpack-python/tree/main
hdimer:fallback-skip-stackerrorhttps://redirect.github.com/hdimer/msgpack-python/tree/fallback-skip-stackerror
Conversation 0 https://redirect.github.com/msgpack/msgpack-python/pull/727
Commits 1 https://redirect.github.com/msgpack/msgpack-python/pull/727/commits
Checks 50 https://redirect.github.com/msgpack/msgpack-python/pull/727/checks
Files changed https://redirect.github.com/msgpack/msgpack-python/pull/727/files
Please reload this pagehttps://redirect.github.com/msgpack/msgpack-python/pull/727/files
fix: translate RecursionError to StackError in fallback Unpacker.skip() https://redirect.github.com/msgpack/msgpack-python/pull/727/files#top
Show all changes 1 commit https://redirect.github.com/msgpack/msgpack-python/pull/727/files
5ab5ea2 fix: translate RecursionError to StackError in fallback Unpacker.skip() hdimer Aug 16, 2026 https://redirect.github.com/msgpack/msgpack-python/pull/727/commits/5ab5ea2899001240f8e65573ddec64f02b64fa07
Clear filters https://redirect.github.com/msgpack/msgpack-python/pull/727/files
Please reload this pagehttps://redirect.github.com/msgpack/msgpack-python/pull/727/files
Please reload this pagehttps://redirect.github.com/msgpack/msgpack-python/pull/727/files
fallback.py https://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-f0ef50c152a99b4bcd7326e0dd398927ac285ee234ec697b7544594b8d457a1d
test_except.py https://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-9cd77a04aaa61e85f445c4ad4d8500b68a7be941526820c8c0289fb774f92270
msgpack/fallback.pyhttps://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-f0ef50c152a99b4bcd7326e0dd398927ac285ee234ec697b7544594b8d457a1d
View file https://redirect.github.com/hdimer/msgpack-python/blob/5ab5ea2899001240f8e65573ddec64f02b64fa07/msgpack/fallback.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/msgpack/msgpack-python/pull/727/{{ revealButtonHref }}
https://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-f0ef50c152a99b4bcd7326e0dd398927ac285ee234ec697b7544594b8d457a1d
https://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-f0ef50c152a99b4bcd7326e0dd398927ac285ee234ec697b7544594b8d457a1d
test/test_except.pyhttps://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-9cd77a04aaa61e85f445c4ad4d8500b68a7be941526820c8c0289fb774f92270
View file https://redirect.github.com/hdimer/msgpack-python/blob/5ab5ea2899001240f8e65573ddec64f02b64fa07/test/test_except.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/msgpack/msgpack-python/pull/727/{{ revealButtonHref }}
https://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-9cd77a04aaa61e85f445c4ad4d8500b68a7be941526820c8c0289fb774f92270
https://redirect.github.com/msgpack/msgpack-python/pull/727/files#diff-9cd77a04aaa61e85f445c4ad4d8500b68a7be941526820c8c0289fb774f92270
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.