File tree 4 files changed +17
-3
lines changed
4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,10 @@ Deprecated
180
180
both deprecated in Python 3.4 now emit :exc: `DeprecationWarning `. (Contributed
181
181
by Matthias Bussonnier in :issue: `29576 `)
182
182
183
+ - Using non-integer value for selecting a plural form in :mod: `gettext ` is
184
+ now deprecated. It never correctly worked.
185
+ (Contributed by Serhiy Storchaka in :issue: `28692 `.)
186
+
183
187
184
188
Removed
185
189
=======
Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ def _as_int(n):
164
164
except TypeError :
165
165
raise TypeError ('Plural value must be an integer, got %s' %
166
166
(n .__class__ .__name__ ,)) from None
167
+ import warnings
168
+ warnings .warn ('Plural value must be an integer, got %s' %
169
+ (n .__class__ .__name__ ,),
170
+ DeprecationWarning , 4 )
167
171
return n
168
172
169
173
def c2py (plural ):
Original file line number Diff line number Diff line change @@ -443,9 +443,12 @@ def test_plural_number(self):
443
443
f = gettext .c2py ('n != 1' )
444
444
self .assertEqual (f (1 ), 0 )
445
445
self .assertEqual (f (2 ), 1 )
446
- self .assertEqual (f (1.0 ), 0 )
447
- self .assertEqual (f (2.0 ), 1 )
448
- self .assertEqual (f (1.1 ), 1 )
446
+ with self .assertWarns (DeprecationWarning ):
447
+ self .assertEqual (f (1.0 ), 0 )
448
+ with self .assertWarns (DeprecationWarning ):
449
+ self .assertEqual (f (2.0 ), 1 )
450
+ with self .assertWarns (DeprecationWarning ):
451
+ self .assertEqual (f (1.1 ), 1 )
449
452
self .assertRaises (TypeError , f , '2' )
450
453
self .assertRaises (TypeError , f , b'2' )
451
454
self .assertRaises (TypeError , f , [])
Original file line number Diff line number Diff line change @@ -270,6 +270,9 @@ Extension Modules
270
270
Library
271
271
-------
272
272
273
+ - bpo-28692: Using non-integer value for selecting a plural form in gettext is
274
+ now deprecated.
275
+
273
276
- bpo-26121: Use C library implementation for math functions:
274
277
tgamma(), lgamma(), erf() and erfc().
275
278
You can’t perform that action at this time.
0 commit comments