A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-November/114569.html below:

[Python-Dev] cpython: fix compiler warning by implementing this more cleverly

[Python-Dev] cpython: fix compiler warning by implementing this more cleverly [Python-Dev] cpython: fix compiler warning by implementing this more cleverlyAntoine Pitrou solipsis at pitrou.net
Tue Nov 22 22:32:11 CET 2011
On Tue, 22 Nov 2011 21:29:43 +0100
benjamin.peterson <python-checkins at python.org> wrote:
> http://hg.python.org/cpython/rev/77ab830930ae
> changeset:   73697:77ab830930ae
> user:        Benjamin Peterson <benjamin at python.org>
> date:        Tue Nov 22 15:29:32 2011 -0500
> summary:
>   fix compiler warning by implementing this more cleverly

You mean "more obscurely"?
Obfuscating the original intent in order to disable a compiler warning
doesn't seem very wise to me.

Regards

Antoine.


> files:
>   Objects/unicodeobject.c |  7 +------
>   1 files changed, 1 insertions(+), 6 deletions(-)
> 
> 
> diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
> --- a/Objects/unicodeobject.c
> +++ b/Objects/unicodeobject.c
> @@ -6164,12 +6164,7 @@
>      kind = PyUnicode_KIND(unicode);
>      data = PyUnicode_DATA(unicode);
>      len = PyUnicode_GET_LENGTH(unicode);
> -
> -    switch(kind) {
> -    case PyUnicode_1BYTE_KIND: expandsize = 4; break;
> -    case PyUnicode_2BYTE_KIND: expandsize = 6; break;
> -    case PyUnicode_4BYTE_KIND: expandsize = 10; break;
> -    }
> +    expandsize = kind * 2 + 2;
>  
>      if (len > PY_SSIZE_T_MAX / expandsize)
>          return PyErr_NoMemory();
> 
> -- 
> Repository URL: http://hg.python.org/cpython


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4