Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p.singular_noun("pair_of_scissors") raises a TypeError #222

Open
paulannetts opened this issue Oct 30, 2024 · 1 comment
Open

p.singular_noun("pair_of_scissors") raises a TypeError #222

paulannetts opened this issue Oct 30, 2024 · 1 comment

Comments

@paulannetts
Copy link

This seems to be a regression sometime between v6.0.4 and 7.4.0 with a simple repro step.

Reproed on MacOS Python 3.11, 3.9, confirms v6.0.4 works as expected, as long as pydantic dependency is <v2.

import inflect
p = inflect.engine()
p.singular_noun("pair of scissors")

Expected behaviour:
Returns "pair of scissors"

Actual behaviour:
TypeError: sequence item 0: expected str instance, bool found

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/paulannetts/.pyenv/versions/3.9.18-test/lib/python3.9/site-packages/inflect/__init__.py", line 2597, in singular_noun
    sing = self._sinoun(word, count=count, gender=gender)
  File "/Users/paulannetts/.pyenv/versions/3.9.18-test/lib/python3.9/site-packages/inflect/__init__.py", line 3233, in _sinoun
    return self._handle_long_compounds(words, count=1) or word
  File "/Users/paulannetts/.pyenv/versions/3.9.18-test/lib/python3.9/site-packages/inflect/__init__.py", line 3037, in _handle_long_compounds
    return next(solutions, None)
  File "/Users/paulannetts/.pyenv/versions/3.9.18-test/lib/python3.9/site-packages/inflect/__init__.py", line 3027, in <genexpr>
    " ".join(
TypeError: sequence item 0: expected str instance, bool found
@jaraco
Copy link
Owner

jaraco commented Dec 28, 2024

That does seem like a bug. I'm slightly surprised that case isn't covered by a unit test. Perhaps it's not because "pair of scissors" isn't a plural noun, so calling singular_noun on it is unsupported. I welcome you or others to step up and investigate the underlying cause and propose a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants