Title: Fix constants argument silently discarding Constants subclasses by derek73 · Pull Request #237 · derek73/python-nameparser · GitHub
Open Graph Title: Fix constants argument silently discarding Constants subclasses by derek73 · Pull Request #237 · derek73/python-nameparser
X Title: Fix constants argument silently discarding Constants subclasses by derek73 · Pull Request #237 · derek73/python-nameparser
Description: Summary The exact-type check in HumanName.__init__ (type(self.C) is not type(CONSTANTS)) silently replaced Constants subclass instances with fresh defaults, discarding the caller's configuration without any error (closes #226) Now validated explicitly: None → private per-instance Constants (unchanged); any Constants instance including subclasses → used as given; anything else → TypeError instead of a silent swap to defaults The constants annotation now admits None (always accepted and documented); fixed stale customize.rst prose ("pass something falsey" → only None; constant → constants keyword typo) Behavior notes Previously, garbage values (e.g. a string, or falsey values like ""/0) were silently replaced with fresh defaults; they now raise TypeError — called out in the release log Test plan Two tests written first (TDD, both verified failing): a customized Constants subclass instance is kept (assertIs) and honored by parsing; a non-Constants value raises TypeError Full suite 1360 passed / 22 xfailed (incl. doctests), mypy clean, Sphinx doctest build clean (docs prose changed) 🤖 Generated with Claude Code
Open Graph Description: Summary The exact-type check in HumanName.__init__ (type(self.C) is not type(CONSTANTS)) silently replaced Constants subclass instances with fresh defaults, discarding the caller's configurati...
X Description: Summary The exact-type check in HumanName.__init__ (type(self.C) is not type(CONSTANTS)) silently replaced Constants subclass instances with fresh defaults, discarding the caller's configu...
Opengraph URL: https://github.com/derek73/python-nameparser/pull/237
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2d23f6ad-9117-653c-aef7-db4a8776d133 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E512:3DEC57:6456A20:8DE563E:6A57600D |
| html-safe-nonce | 35e9831b0ab6eb4e3b0aa4c33985ea07cf62b86e619870ee3e7412d97484b767 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTEyOjNERUM1Nzo2NDU2QTIwOjhERTU2M0U6NkE1NzYwMEQiLCJ2aXNpdG9yX2lkIjoiMzQzMDA5MzU5MDI2OTIyMjkyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 46af5db9f8efa8dc411579e8b6df1cc50ef5d2e5b4b6ae5340486d0b8b380a69 |
| hovercard-subject-tag | pull_request:3995024663 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/derek73/python-nameparser/pull/237/files |
| twitter:image | https://avatars.githubusercontent.com/u/18306?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/18306?s=400&v=4 |
| og:image:alt | Summary The exact-type check in HumanName.__init__ (type(self.C) is not type(CONSTANTS)) silently replaced Constants subclass instances with fresh defaults, discarding the caller's configurati... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 87685a1c739dbf97e95760413799bb0221799457 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width