Skip to content

Fix crash in states CLI when printing counties - #102

Merged
pauldhawk merged 1 commit into
unitedstates:mainfrom
arpitjain099:fix/cli-counties-crash
Sep 19, 2026
Merged

pauldhawk merged 1 commit into
unitedstates:mainfrom
arpitjain099:fix/cli-counties-crash

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

The `counties` attribute added in 4.0.0 is a list of `County` objects, but the CLI's "other attributes" loop still tries to `", ".join()` any list value. Joining the County objects raises `TypeError: sequence item 0: expected str instance, County found`, so running `states ` crashes for every state (it dies right after printing the scalar attributes).

This special-cases counties to print a count instead, which avoids dumping hundreds of county names inline and keeps the existing join path for the string-valued lists like `time_zones`. I added a small regression test that runs the CLI and checks it completes; it fails on main and passes with the change. Thanks for the recent 4.0.0 work on this library.

The counties attribute added in 4.0.0 is a list of County objects, but
the CLI's attribute loop tries to ", ".join() every list value, which
raises a TypeError on the County objects. This crashed `states <state>`
for every state. Show the county count instead and add a regression test.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@pauldhawk
pauldhawk merged commit a9fc1e1 into unitedstates:main Sep 19, 2026
@pauldhawk pauldhawk mentioned this pull request Sep 19, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants