[issue28692] gettext: deprecate selecting plural form by fractional numbers

2017-03-24 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2017-03-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f6595983e08fe20cf06a2535d74d912c6dbb044f by Serhiy Storchaka in branch 'master': bpo-28692: Deprecate using non-integer value for selecting a plural form in gettext. (#507) https://github.com/python/cpython/commit/f6595983e08fe20cf06a2535d74d91

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2017-03-17 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: -605 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2017-03-17 Thread Larry Hastings
Changes by Larry Hastings : -- pull_requests: +605 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2017-03-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +416 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-12-04 Thread Julien Palard
Julien Palard added the comment: > It seems to me that a fractional number should be formatted with the same > form independently from it's value Ok, so 1.000 seconds, ok, LGTM. Should we mention something explicit about it? Not sure how to write it down, but I still fear that everyone's reac

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: round() was used because it is the simplest way to convert fractional numbers to integers that doesn't involve strings-to-integer converting (as in int()). Perhaps math.trunc() looks a little more appropriate. math.ceil() returns a float in 2.7 and is limite

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-12-04 Thread Julien Palard
Julien Palard added the comment: > But gettext formulas are not purposed to support non-integer values and can > return incorrect result Looks like the cast to integer is done *before* giving the value to the C gettext expression. > For example (in Ukrainian) As long as gettext expression do

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-15 Thread Xiang Zhang
Xiang Zhang added the comment: Ohh, sorry. It should be 4 and I make a mistake. Sorry for the noise. Patch LGTM. -- ___ Python tracker ___ __

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-15 Thread Xiang Zhang
Xiang Zhang added the comment: I think the stacklevel should be 3. stacklevel = 3: ./python -Walways /tmp/a.py /tmp/a.py:2: DeprecationWarning: Plural value must be an integer, got float c2py('n!=1')(1.1) stacklevel = 4: ./python -Walways /tmp/a.py sys:1: DeprecationWarning: Plural value

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, of cause. Thank your for noticing this. -- Added file: http://bugs.python.org/file45487/gettext-non-int-plural-deprecate.patch ___ Python tracker __

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: Maybe you have forgotten to remove the debug print in the patch? -- nosy: +xiang.zhang ___ Python tracker ___ _

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry. Here is a patch. -- keywords: +patch Added file: http://bugs.python.org/file45485/gettext-non-int-plural-deprecate.patch ___ Python tracker __

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Julien Palard
Julien Palard added the comment: Hi, did you forget to attach the patch? -- nosy: +mdk ___ Python tracker ___ ___ Python-bugs-list mai

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: GNU gettext library accepts only integer value for selecting plural form. Python gettext accepts arbitrary numbers. But gettext formulas are not purposed to support non-integer values and can return incorrect result. For example (in Ukrainian): "1 площ