Title: Sequence-like subclass `__radd__` fallback regression · Issue #146587 · python/cpython · GitHub
Open Graph Title: Sequence-like subclass `__radd__` fallback regression · Issue #146587 · python/cpython
X Title: Sequence-like subclass `__radd__` fallback regression · Issue #146587 · python/cpython
Description: Bug report Bug description: In the 3.15 alphas, the + operator does not dispatch to obj.__radd__ when the left hand object inherits from a sequence like class (list, tuple, ...), but does if it is a base instance. class A: def __radd__(s...
Open Graph Description: Bug report Bug description: In the 3.15 alphas, the + operator does not dispatch to obj.__radd__ when the left hand object inherits from a sequence like class (list, tuple, ...), but does if it is ...
X Description: Bug report Bug description: In the 3.15 alphas, the + operator does not dispatch to obj.__radd__ when the left hand object inherits from a sequence like class (list, tuple, ...), but does if it is ...
Opengraph URL: https://github.com/python/cpython/issues/146587
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sequence-like subclass `__radd__` fallback regression","articleBody":"# Bug report\n\n### Bug description:\n\nIn the 3.15 alphas, the `+` operator does not dispatch to `obj.__radd__` when the left hand object inherits from a sequence like class (`list`, `tuple`, ...), but does if it is a base instance. \n\n```python\nclass A:\n def __radd__(self, other): ...\n\nclass B(tuple): ...\n\n() + A() # No error\nB() + A() # TypeError: can only concatenate tuple (not \"A\") to tuple\n```\n\nI originally ran into the issue with a `NamedTuple`, but looks like subclasses of `array.array`, `bytearray`, `bytes`, `collections.deque`, `list`, `str`, and `tuple` all raise the error. \n\nWorks in 3.14.3. git bisect'd to e6e376a760b7a3b267e89244a2c89e7ddfba9c38, so something in the resolution between `nb_add` and `sq_concat` may have changed while optimizing (`*` has a similar problem with `__rmul__` mapping to `nb_multiply` and `sq_repeat`).\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-146593\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/inventshah","@type":"Person","name":"inventshah"},"datePublished":"2026-03-29T06:58:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/146587/cpython/issues/146587"}
| 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:6f89c85e-e894-5dab-12ad-f2283bef3ee5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A36E:691A8:154425:1D4CDA:6A513106 |
| html-safe-nonce | c63280b7b25bbf789804f090fa7eed72915efdf69d607d087db292e69dc69cb9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzZFOjY5MUE4OjE1NDQyNToxRDRDREE6NkE1MTMxMDYiLCJ2aXNpdG9yX2lkIjoiODA3MjQyMjE2MDI0MzY5OTk3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b4822590f591fce0e86d4bdeb757836b13971e85a27cc69e24c51556e2e69613 |
| hovercard-subject-tag | issue:4163082252 |
| 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/python/cpython/146587/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e127dafd31a44b36b9492b54acc3c051adbb4a771f7c2a49b8c2577fc85e4f26/python/cpython/issues/146587 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e127dafd31a44b36b9492b54acc3c051adbb4a771f7c2a49b8c2577fc85e4f26/python/cpython/issues/146587 |
| og:image:alt | Bug report Bug description: In the 3.15 alphas, the + operator does not dispatch to obj.__radd__ when the left hand object inherits from a sequence like class (list, tuple, ...), but does if it is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | inventshah |
| hostname | github.com |
| expected-hostname | github.com |
| None | a74ad1f4971203e7676c31c6c5233aa0b6995813088e47ba7b62c270d4b1ebfc |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | a4218abefb3ba97edd71b38e508f263fc8c0d1c7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width