From f677e26a26ae23918c05ac2be06712c0fcd5d172 Mon Sep 17 00:00:00 2001 From: sanjey99 Date: Fri, 24 Jul 2026 16:36:11 +0800 Subject: [PATCH] Fix PEP 701 multi-line f-strings breaking Python 3.10/3.11 import bond.py used a PEP 701 multi-line replacement field inside an f-string (Python 3.12+ only), which is a SyntaxError on 3.10/3.11 despite pyproject.toml declaring requires-python = ">=3.10,<3.14". This took down financepy.products.bonds and everything importing it transitively on those interpreters. Found and fixed a second instance (OAS warning, line ~1548) beyond the one reported in #248, matching the same pattern. Fixes #248 --- financepy/products/bonds/bond.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/financepy/products/bonds/bond.py b/financepy/products/bonds/bond.py index 5d079afd..12965c7f 100644 --- a/financepy/products/bonds/bond.py +++ b/financepy/products/bonds/bond.py @@ -1235,8 +1235,7 @@ def yield_to_maturity( maxiter=50, ) except RuntimeError: - print(f"Warning: YTM calculation did not converge for price { - dirty_price}") + print(f"Warning: YTM calculation did not converge for price {dirty_price}") ytm = np.nan ytms.append(ytm) @@ -1546,8 +1545,7 @@ def option_adjusted_spread( oass.append(oas) except RuntimeError: - print(f"Warning: OAS calculation did not converge for price { - dirty_price}") + print(f"Warning: OAS calculation did not converge for price {dirty_price}") oass.append(np.nan) if len(oass) == 1: