FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148675: Reuse typecodes for array.array() error message by vstinner · Pull Request #149779 · python/cpython · GitHub

/ cpython Public

gh-148675: Reuse typecodes for array.array() error message - #149779

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:array_errmsg
May 15, 2026
Merged

gh-148675: Reuse typecodes for array.array() error message#149779
vstinner merged 1 commit into
python:mainfrom
vstinner:array_errmsg

Conversation

vstinner commented May 13, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

array.array() error message now reuses array.typecodes, instead of maintaining an hardcoded list of valid type codes.

array.array() error message now reuses array.typecodes, instead of
maintaining an hardcoded list of valid type codes.

Copy link
Copy Markdown
Member Author

Example:

import array
array.array('v')

Output:

Traceback (most recent call last):
  File "/home/vstinner/python/main/x.py", line 2, in <module>
    array.array('v')
    ~~~~~~~~~~~^^^^^
ValueError: bad typecode (must be: b, B, u, w, h, H, i, I, l, L, q, Q, e, f, d, Zf, Zd)

vstinner merged commit a8ef467 into python:main May 15, 2026
56 checks passed
vstinner deleted the array_errmsg branch May 15, 2026 11:22

Copy link
Copy Markdown
Member Author

Merged, thanks for the review.

I wrote this change since recently, I noticed that 3 type codes were missing from this error message. I fixed the error message, but with this change it's no longer neeeded (it's always up to date).

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL