Christian Heimes added the comment:
Why should I use (sizeof(lower)-1)? Do you mean
PyMem_Malloc(strlen(encoding) + 1)?
Changes since last patch:
* added #include bytes_methods.h in unicodeobject.c
* fix all is* to use the macros from bytes_methods.h
* use malloc/free the lower version instead
Guido van Rossum added the comment:
Committed revision 58659.
I'm sorry I confused you; I was fine with the version that has char
lower[N] but I wanted you to not repeat N-1 later in the code. See what
I checked in. :-)
--
resolution: - accepted
status: open - closed
Christian Heimes added the comment:
Guido van Rossum wrote:
Guido van Rossum added the comment:
Committed revision 58659.
I'm sorry I confused you; I was fine with the version that has char
lower[N] but I wanted you to not repeat N-1 later in the code. See what
I checked in. :-)
I
Alexandre Vassalotti added the comment:
I still don't understand why you are using (sizeof lower) - 2
It is simply to avoid duplicating the constant (a.k.a. the Don't Repeat
Yourself (DRY) rule).
and what lower[(sizeof lower) - 2] returns. Is it the memory address
of lower[17]?
It the
Alexandre Vassalotti added the comment:
Personally, I used like to subtract pointer, ((lower - l + 1)
(sizeof lower)) to get the bound.
Doh. I got it backward. It's (l - lower + 1), not (lower - l + 1).
But now, I find Guido's trick more cute (and less error-prone).
At least, I got that
Christian Heimes added the comment:
Alexandre Vassalotti wrote:
It the address of lower[18] to be exact. (l lower[(sizeof lower) -
2]) is simply tricky notation to check the bound of the array.
Personally, I used like to subtract pointer, ((lower - l + 1) (sizeof
lower)) to get the bound.
Guido van Rossum added the comment:
I like Chris's patch better, but he should use (sizeof(lower)-1) instead
of 8, and he should use the TOLOWER macro from bytes_methods.h.
Please submit a new one and I'll check it in!
--
priority: - normal
__
Tracker
Christian Heimes added the comment:
The new patch does a far more better job. I had the idea after a
discussion with Alexandre on #python and a small debugging session.
The tests for profile, cProfile and doctest are failing on my Linux box
because Py_FileSystemDefaultEncoding is UTF-8 but
New submission from Christian Heimes:
The patch fixes the output for profile and cProfile. Another patch from
Alexandre and me added additional calls to the UTF-8 codec.
--
components: Library (Lib)
messages: 56569
nosy: gvanrossum, tiran
severity: normal
status: open
title: Fixes for
Christian Heimes added the comment:
Sure there is a patch ... well it's ... *uhm* ... it's hidden under your
bed. O:-)
Added file: http://bugs.python.org/file8569/py3k_profile_fix.patches
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1302
Brett Cannon added the comment:
There is no patch. =)
--
assignee: - gvanrossum
keywords: +py3k
nosy: +brett.cannon
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1302
__
Changes by Martin v. Löwis:
--
keywords: +patch
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1302
__
___
Python-bugs-list mailing list
Unsubscribe:
12 matches
Mail list logo