From 05b422928735492d0448fbcb6b56f03aadc53eef Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@gentoo.org>
Date: Mon, 15 Sep 2025 12:10:18 -0400
Subject: [PATCH] fix crash when using binhost due to using conditionally
 defined variable

extra_info didn't always exist, so if you get http 304 but no
Last-Modified, portage errors out with:

```
  File "/usr/lib/python3.13/site-packages/portage/dbapi/bintree.py", line 1519, in _populate_remote
    "up-to-date", extra_info
                  ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'extra_info' where it is not associated with a value
```

Fixes: c83466a50efdee2cac81a5ed6a660c11b9ac746e
Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
---
 lib/portage/dbapi/bintree.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index f88d5e0aa..ebd0ec08c 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1506,6 +1506,7 @@ class binarytree:
                             if (
                                 hasattr(err, "code") and err.code == 304
                             ):  # not modified (since local_timestamp)
+                                extra_info = ""
                                 if hasattr(err, "headers") and err.headers.get(
                                     "Last-Modified", ""
                                 ):
-- 
2.49.1

