Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
vstinner merged 1 commit into
python:mainpython/cpython:mainfrom
vstinner:array_errmsgvstinner/cpython:array_errmsgCopy head branch name to clipboard
May 15, 2026
Merged

gh-148675: Reuse typecodes for array.array() error message#149779
vstinner merged 1 commit into
python:mainpython/cpython:mainfrom
vstinner:array_errmsgvstinner/cpython:array_errmsgCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented May 13, 2026

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.
@vstinner

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 vstinner merged commit a8ef467 into python:main May 15, 2026
56 checks passed
@vstinner vstinner deleted the array_errmsg branch May 15, 2026 11:22
@vstinner

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).

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.