Skip to content

Commit 5739e0b

Browse files
Fix TypeError when conda 26.x returns dict from fetch_latest() (#1196)
* Fix TypeError when conda 26.x returns dict from fetch_latest() In conda 26.x, `subdir_data.repo_fetch.fetch_latest()` returns an already-parsed dict instead of a JSON string. Add a type check to handle both cases, maintaining backward compatibility with older conda versions. * chore: add news file * Apply suggestion from @marcoesters Co-authored-by: Marco Esters <mesters@anaconda.com> --------- Co-authored-by: Marco Esters <mesters@anaconda.com>
1 parent 8b1d7db commit 5739e0b

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

constructor/conda_interface.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ def get_repodata(url):
130130
"packages.conda": {},
131131
"removed": [],
132132
}
133+
elif isinstance(raw_repodata_str, dict):
134+
# conda 26.x+ may return an already-parsed dict from fetch_latest()
135+
full_repodata = raw_repodata_str
133136
else:
134137
full_repodata = json.loads(raw_repodata_str)
135138

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Enhancements
2+
3+
* <news item>
4+
5+
### Bug fixes
6+
7+
* Fix TypeError when conda 26.x returns dict from `fetch_latest()`. (#1196)
8+
9+
### Deprecations
10+
11+
* <news item>
12+
13+
### Docs
14+
15+
* <news item>
16+
17+
### Other
18+
19+
* <news item>

0 commit comments

Comments
 (0)