[Zope-dev] zope-tests - FAILED: 44, OK: 21
Tres Seaver
tseaver at palladion.com
Mon Feb 18 17:20:12 UTC 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 02/18/2013 03:59 AM, Marius Gedminas wrote:
> Who wants to come up with something saner than this?
Python doesn't seem to expose a mechanism for asking for the '%p' form
from Python:
>>> print '%p' % id(object())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: unsupported format character 'p' (0x70) at index 1
Stackoverflow[1] suggests as an alternative that we avoid the '%p' format
character and use the following (its example uses 'printf'):
#include <inttypes.h>
#include <stdint.h>
...
printf("%016" PRIxPTR "\n", (uintptr_t)ptr);
I prefer your workaround, frankly: I'd rather interoduce the weird code
in the tests than in C.
[1]
http://stackoverflow.com/questions/1255099/whats-the-proper-use-of-printf-to-display-pointers-padded-with-0s
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iEYEARECAAYFAlEiYswACgkQ+gerLs4ltQ771wCgqtdB/w7v48CnU7EG0lIn82f/
e34AoINlQRwRLGG10vbzgtmrIganS4vH
=IaW7
-----END PGP SIGNATURE-----
More information about the Zope-Dev
mailing list