jamesturk / jellyfish

🪼 a python library for doing approximate and phonetic matching of strings.
https://jamesturk.github.io/jellyfish/
MIT License
2.04k stars 157 forks source link

py310 jellyfish.metaphone incorrectly raises TypeError with string argument #160

Closed jbrockmendel closed 2 years ago

jbrockmendel commented 2 years ago

I get this on both Mac and Ubuntu in python 3.10.4, not in 3.8 or 3.9

>>> import jellyfish
>>> jellyfish.metaphone("Alabama")
<stdin>:1: DeprecationWarning: getargs: The 'u' format is deprecated. Use 'U' instead.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: str argument expected
NickCrews commented 2 years ago

Pretty sure this is caused by

https://github.com/jamesturk/cjellyfish/blob/66c48ae2998af3364b0653f74634b507fa5be823/jellyfishmodule.c#L262-L272

but I am not familiar enough with the c arg parsing API to know what exactly the fix is. If someone knows what to do, I can actually implement it.

jamesturk commented 2 years ago

@jbrockmendel What version of Jellyfish are you using? As you can see in the code NickCrews linked the code has been updated to use "U" instead of "u"

jbrockmendel commented 2 years ago

With jellyfish 0.6.1 (Mac, py3.9.13) I just got

>>> import jellyfish
>>> jellyfish.metaphone("Alabama")
<stdin>:1: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
'ALBM'
jamesturk commented 2 years ago

0.6.1?

On Mon, Sep 12, 2022, at 3:03 PM, jbrockmendel wrote:

With jellyfish 0.6.1 (Mac, py3.9.13) I just got

`>>> import jellyfish

jellyfish.metaphone("Alabama")

:1: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats 'ALBM' `

— Reply to this email directly, view it on GitHub https://github.com/jamesturk/jellyfish/issues/160#issuecomment-1244332444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAB6YTC7AJFOT4RTBKHL53V56EA7ANCNFSM5WCXKJSA. You are receiving this because you commented.Message ID: @.***>

jbrockmendel commented 2 years ago

0.6.1?

Yes. No warning when I upgrade to 0.9.0. Though pip complains that us is pinned to 0.6.1.

Fine by me to close here.