Skip to content

Commit

Permalink
Use CPython __new__ for Plural on PyPy 3.9.
Browse files Browse the repository at this point in the history
PyPy 3.8 and earlier use __init__
  • Loading branch information
domdfcoding committed Dec 19, 2022
1 parent dcfc4f3 commit d318e21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions domdf_python_tools/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. versionadded:: 0.4.5
"""
#
# Copyright © 2020 Dominic Davis-Foster <[email protected]>
# Copyright © 2020-2022 Dominic Davis-Foster <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,6 +40,7 @@
import functools
import random
import re
import sys
from gettext import ngettext
from reprlib import recursive_repr
from string import ascii_lowercase, ascii_uppercase
Expand Down Expand Up @@ -601,7 +602,8 @@ def __call__(self, n: int) -> str: # type: ignore
:param n:
"""

if PYPY: # pragma: no cover (!PyPy)
# if PYPY: # pragma: no cover (!PyPy)
if PYPY and sys.version_info < (3, 9): # pragma: no cover (!PyPy)

def __init__(self, singular: str, plural: str):
super().__init__(ngettext, singular, plural) # type: ignore[call-arg]
Expand Down

0 comments on commit d318e21

Please sign in to comment.