From ee17e91927a26b8c94e231b760cfbd3f7290d3f2 Mon Sep 17 00:00:00 2001 From: Jimmy Song Date: Sun, 1 Mar 2026 04:52:12 -0600 Subject: [PATCH] Fix missing f-string prefixes on error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Strings with {variable} interpolation were missing the f prefix, causing the literal text "{variable}" to appear in error messages instead of the variable's value. - bcur.py:88 — BCURStringFormatError message - descriptor.py:81,85 — ValueError messages (2 instances) - hd.py:712 — ValueError message - psbt.py:776 — SuspiciousTransaction message Co-Authored-By: Claude Opus 4.6 --- buidl/bcur.py | 2 +- buidl/descriptor.py | 4 ++-- buidl/hd.py | 2 +- buidl/psbt.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buidl/bcur.py b/buidl/bcur.py index e0b876a..8122059 100644 --- a/buidl/bcur.py +++ b/buidl/bcur.py @@ -85,7 +85,7 @@ def _parse_bcur_helper(bcur_string): y_int = int(xofy_parts[1]) if x_int > y_int: - raise BCURStringFormatError("x must be >= y (in x-of-y): {xofy_parts}") + raise BCURStringFormatError(f"x must be >= y (in x-of-y): {xofy_parts}") else: raise BCURStringFormatError(f"{string} doesn't have 2-4 slashes") diff --git a/buidl/descriptor.py b/buidl/descriptor.py index 40c5dd3..3c43b4e 100644 --- a/buidl/descriptor.py +++ b/buidl/descriptor.py @@ -78,11 +78,11 @@ def parse_full_key_record(key_record_str): parts = key_record_str.split("/") if parts[-1] != "*": raise ValueError( - "Invalid full key record, does not end with a *: {key_record_str}" + f"Invalid full key record, does not end with a *: {key_record_str}" ) if not is_intable(parts[-2]): raise ValueError( - "Invalid full key record, account index `{parts[-2]}` is not an int: {key_record_str}" + f"Invalid full key record, account index `{parts[-2]}` is not an int: {key_record_str}" ) # Now we strip off the trailing account index and *, and parse the rest as a partial key record diff --git a/buidl/hd.py b/buidl/hd.py index 1c23de6..741d584 100644 --- a/buidl/hd.py +++ b/buidl/hd.py @@ -709,7 +709,7 @@ def raw_parse(cls, s, network=None): elif pub_version in ALL_MAINNET_XPUBS: network = "mainnet" else: - raise ValueError("not a valid [t-z]pub pub_version: {pub_version}") + raise ValueError(f"not a valid [t-z]pub pub_version: {pub_version}") # the next byte is depth depth = byte_to_int(s.read(1)) # next 4 bytes are the parent_fingerprint diff --git a/buidl/psbt.py b/buidl/psbt.py index 34485c0..92bbb13 100644 --- a/buidl/psbt.py +++ b/buidl/psbt.py @@ -773,7 +773,7 @@ def _describe_basic_multisig_inputs(self, hdpubkey_map): if not root_paths_for_signing: raise SuspiciousTransaction( - "No `root_paths_for_signing` with `hdpubkey_map` {hdpubkey_map} in PSBT:\n{self}" + f"No `root_paths_for_signing` with `hdpubkey_map` {hdpubkey_map} in PSBT:\n{self}" ) return {