
Andrew MacIntyre wrote:
On 27 Jan 2002, Martin v. Loewis wrote:
Andrew MacIntyre <andymac@bullseye.apana.org.au> writes:
- Modules/unicodedata.c is affected by a name clash between the internally defined _getname() and an EMX routine of the same name defined in <stdlib.h>. The patch renames the internal routine to _getucname() to avoid this, but this change may not be acceptable - advice please.
My advice for renaming things because of name clashes: Always rename in a way that solves this particular problem for good, by using the Py prefix (or _Py to further indicate that this is not public API; it's a static function, anyway). Somebody may have a function _getucname somewhere, whereas it is really unlikely that people add a Py prefix to their functions (if they have been following the last 30 years of C programming).
Fair enough. I was trying to minimise stylistic differences in the fix, but if using _Py_getname is the canonical solution, that's easy fixed.
+1
- Objects/stringobject.c and Objects/unicodeobject.c contain changes to handle the EMX runtime library returning "0x" as the prefix for output formatted with a "%X" format.
I'd suggest a different approach here, which does not use #ifdefs: Instead of testing for the system, test for the bug. Then, if the bug goes away, or appears on other systems as well, the code will be good.
I did it the way I did because there's already code dealing with other brokeness in this area which doesn't solve the EMX issue, and the #ifdef solution minimises the risk of EMX fixes breaking something else which I can't test. At this stage I can't see this bug being fixed in EMX :-(
I'd go with Martin's suggestion here: there already is code in formatint() which tests for '%#X' adding '0x' or not. This code should be made to handle the special case by testing for it -- who knows: there may be other platforms where this doesn't work as expected either. BTW, could you point me to your patch for this ? Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/