From 4113aad5d0955b521351b7465d81874e889e5c20 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 7 Apr 2026 07:40:07 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20to=5Fabc()=20crash=20on=20parts=20with=20?= =?UTF-8?q?drum=20tones=20=E2=80=94=20v0.41.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- pytheory/__init__.py | 2 +- pytheory/rhythm.py | 4 ++++ uv.lock | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb6778..8369565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to PyTheory are documented here. +## 0.41.1 + +- **Fix** — `to_abc()` no longer crashes on parts containing drum tones. + ## 0.41.0 - **ABC notation export** — `Score.to_abc()` converts scores to ABC notation diff --git a/pyproject.toml b/pyproject.toml index c9e1e63..e935245 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pytheory" -version = "0.41.0" +version = "0.41.1" description = "Music Theory for Humans" readme = "README.md" license = "MIT" diff --git a/pytheory/__init__.py b/pytheory/__init__.py index c7bbae6..90e4dfa 100644 --- a/pytheory/__init__.py +++ b/pytheory/__init__.py @@ -1,6 +1,6 @@ """PyTheory: Music Theory for Humans.""" -__version__ = "0.41.0" +__version__ = "0.41.1" from .tones import Tone, Interval from .systems import System, SYSTEMS, TET diff --git a/pytheory/rhythm.py b/pytheory/rhythm.py index 646b6ed..bd1be5a 100644 --- a/pytheory/rhythm.py +++ b/pytheory/rhythm.py @@ -4442,6 +4442,10 @@ class Score: if tone is None: return "z" + # Skip drum tones — they don't have pitched names + if not hasattr(tone, "name") or not hasattr(tone, "octave"): + return "z" + name = tone.name # e.g. "C", "C#", "Bb" octave = tone.octave if tone.octave is not None else 4 diff --git a/uv.lock b/uv.lock index 78d3162..cf0a3a5 100644 --- a/uv.lock +++ b/uv.lock @@ -690,7 +690,7 @@ wheels = [ [[package]] name = "pytheory" -version = "0.41.0" +version = "0.41.1" source = { editable = "." } dependencies = [ { name = "rich" },