Title: TupleManager string inputs: cryptic ValueError for bare strings, silent key/value shredding for 2-char elements · Issue #242 · derek73/python-nameparser · GitHub
Open Graph Title: TupleManager string inputs: cryptic ValueError for bare strings, silent key/value shredding for 2-char elements · Issue #242 · derek73/python-nameparser
X Title: TupleManager string inputs: cryptic ValueError for bare strings, silent key/value shredding for 2-char elements · Issue #242 · derek73/python-nameparser
Description: TupleManager (and RegexTupleManager) inherit dict.__init__ unchanged, so string inputs behave inconsistently with the guarded SetManager (#238): from nameparser.config import Constants, TupleManager Constants(capitalization_exceptions='a...
Open Graph Description: TupleManager (and RegexTupleManager) inherit dict.__init__ unchanged, so string inputs behave inconsistently with the guarded SetManager (#238): from nameparser.config import Constants, TupleManage...
X Description: TupleManager (and RegexTupleManager) inherit dict.__init__ unchanged, so string inputs behave inconsistently with the guarded SetManager (#238): from nameparser.config import Constants, TupleManage...
Opengraph URL: https://github.com/derek73/python-nameparser/issues/242
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TupleManager string inputs: cryptic ValueError for bare strings, silent key/value shredding for 2-char elements","articleBody":"`TupleManager` (and `RegexTupleManager`) inherit `dict.__init__` unchanged, so string inputs behave inconsistently with the guarded `SetManager` (#238):\n\n```python\nfrom nameparser.config import Constants, TupleManager\n\nConstants(capitalization_exceptions='ab')\n# ValueError: dictionary update sequence element #0 has length 1; 2 is required\n# loud, but names no argument and suggests no fix\n\nTupleManager(['ab', 'cd']) # {'a': 'b', 'c': 'd'} — silent\nConstants(capitalization_exceptions=['ii']) # {'i': 'i'} — silent\n```\n\nThe bare-string case fails loudly but cryptically (dict internals, `ValueError` where the sibling set-backed args now raise a friendly `TypeError`). The worse case is the silent one: an iterable of 2-character strings is a valid dict-update sequence, so each string shreds into a key/value pair with no error — same family as #238 through the mapping constructor.\n\nFix: give `TupleManager` an `__init__` that rejects `str`/`bytes` outright (mirroring `SetManager._reject_bare_string`'s message style) and rejects non-tuple string *elements*, closing the 2-char variant.\n\nFound by review of PR #240 — pre-existing, unrelated to that change.","author":{"url":"https://github.com/derek73","@type":"Person","name":"derek73"},"datePublished":"2026-07-06T01:08:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/242/python-nameparser/issues/242"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b496ceaa-09d9-6172-e1f0-2ca2e63a2fdf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA60:3F2796:10D142C:16D8F33:6A5711A7 |
| html-safe-nonce | f2051e8ca11816f18092d7d28763ca548fb6787dfb53e25a273f3a613f0565f1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTYwOjNGMjc5NjoxMEQxNDJDOjE2RDhGMzM6NkE1NzExQTciLCJ2aXNpdG9yX2lkIjoiNjEzNjYxMzQ0OTk4NjY3NTExMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 56c15a16a741b829dcb62d382fbc705b59ea462091291116c9df52a8b4d601a9 |
| hovercard-subject-tag | issue:4815179187 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/derek73/python-nameparser/242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aea56086add2aa52ec552c5fad1701c74906de2e867050217f5d65a029f22685/derek73/python-nameparser/issues/242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aea56086add2aa52ec552c5fad1701c74906de2e867050217f5d65a029f22685/derek73/python-nameparser/issues/242 |
| og:image:alt | TupleManager (and RegexTupleManager) inherit dict.__init__ unchanged, so string inputs behave inconsistently with the guarded SetManager (#238): from nameparser.config import Constants, TupleManage... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | derek73 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| turbo-cache-control | no-preview |
| go-import | github.com/derek73/python-nameparser git https://github.com/derek73/python-nameparser.git |
| octolytics-dimension-user_id | 18306 |
| octolytics-dimension-user_login | derek73 |
| octolytics-dimension-repository_id | 18353524 |
| octolytics-dimension-repository_nwo | derek73/python-nameparser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 18353524 |
| octolytics-dimension-repository_network_root_nwo | derek73/python-nameparser |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2576d1f0198cf1588faf2edf27f1ed120903be10 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width