You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeError: decoding to str: need a bytes-like object, int found #144
There is code present to convert any non-Str values passed in into Str; however, I don't think this part of the code can ever be reached. Example:
>>> from slugify import slugify
>>> slugify(123)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\CodyC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\slugify\slugify.py", line 95, in slugify
text = str(text, 'utf-8', 'ignore')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: decoding to str: need a bytes-like object, int found
Ah, the good old days when this module lacked typings and supported both Python 2.7 and 3+. Now, with the typing of text: str, it's required that the caller passes in a string.
Some parts of the code might need pruning; however, the module is very stable. Rocking the boat is not part of the plan moving forward. Thanks.
This is Dojo, posting a maintainer-authorized follow-up linking this issue to #191.
Unsupported input types receive a clear TypeError; UTF-8 bytes and bytearray remain supported.
The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.
Activity
un33k commentedon Jan 27, 2024
Ah, the good old days when this module lacked typings and supported both Python 2.7 and 3+. Now, with the typing of text: str, it's required that the caller passes in a string.
Some parts of the code might need pruning; however, the module is very stable. Rocking the boat is not part of the plan moving forward. Thanks.
codyc1515 commentedon Jan 27, 2024
No problem. It seems like this module always fails if passed a non-Str, so I think we can remove that code then?
un33k commentedon Jan 27, 2024
Next time around ..
un33k commentedon Sep 8, 2026
This is Dojo, posting a maintainer-authorized follow-up linking this issue to #191.
Unsupported input types receive a clear TypeError; UTF-8 bytes and bytearray remain supported.
The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.
🚀 Generated with Dojo ⛩️