cybit · GitHub

Bug report

Bug description:

It seems to me that #132036 not only made the import time faster but did also change the exception thrown if the arguments in shlex.quote are not of type str.

It used to be "TypeError", now it is "AttributeError" .

I am not able to find this change in the release notes or the PR.

Test code:

import shlex
shlex.quote(123)

Test run on the shell:

for i in 10 11 12 13 14 ; do echo "3.$i" ; uv run --python 3.$i test.py 2>&1 | tail -n 1 ; done
3.10
TypeError: expected string or bytes-like object
3.11
TypeError: expected string or bytes-like object, got 'int'
3.12
TypeError: expected string or bytes-like object, got 'int'
3.13
TypeError: expected string or bytes-like object, got 'int'
3.14
AttributeError: 'int' object has no attribute 'isascii'

CPython versions tested on:

3.10, 3.11, 3.12, 3.13, 3.14

Operating systems tested on:

macOS

Linked PRs

Read the original on github.com ↗