Conversation
platform.python_version() calls platform._sys_version() which parses sys.version with a regex. On Python 3.10 from conda-forge, sys.version contains '| packaged by conda-forge |' which the 3.10 regex can't handle (fix was only in 3.11+). This causes a ValueError during @conda/@pypi decorator init on any conda-forge Python 3.10 environment. sys.version_info is a struct_sequence populated at interpreter startup and doesn't require parsing sys.version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryFixes a crash in
Confidence Score: 5/5Safe to merge — the one-line fix is a well-understood substitution with no behavioural change on standard CPython and a clear improvement on conda-forge Python 3.10. The change is a single-site substitution that produces byte-for-byte identical output on every standard CPython build and avoids a documented crash on conda-forge 3.10. The removed import was genuinely unused after the change, and no other call sites for No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix: use sys.version_info instead of pla..." | Re-trigger Greptile |
Summary
platform.python_version()with"%d.%d.%d" % sys.version_info[:3]inconda_decorator.pyimport platformProblem
On Python 3.10 installed from conda-forge,
sys.versioncontains| packaged by conda-forge |(e.g.,3.10.20 | packaged by conda-forge | (main, Mar 5 2026, 16:53:43) [GCC 14.3.0]).Python 3.10's
platform.pystdlib uses a regex that can't parse this format, causing:This crashes any
@conda/@pypi/@pypi_basedecorated flow during decorator init on conda-forge Python 3.10. The regex was fixed in CPython 3.11+ but never backported to 3.10.Fix
sys.version_infois astruct_sequencepopulated at interpreter startup — it doesn't parsesys.versionat all, so it works regardless of the version string format.Test plan
"%d.%d.%d" % sys.version_info[:3]produces identical output toplatform.python_version()on standard CPythonsys.version_infois unaffected by conda-forge's sys.version format🤖 Generated with Claude Code