From 47c9bb143c3121048957d1078525caaee9f4a10e Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Thu, 26 Nov 2015 15:48:04 +0200 Subject: [PATCH] Fix `smart_repr()` to also clean upper-case hex addresses. Windows Pythons seem to like printing addresses in upper-case, while Linux Pythons like lower-case hexes. This led to an amusing (for a given value of "amusing", anyway) situation where some repr tests would fail if the objects they were testing happened to be allocated at an address with a hex digit in the range A..F. --- rest_framework/utils/representation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/utils/representation.py b/rest_framework/utils/representation.py index 92075171..49f829c1 100644 --- a/rest_framework/utils/representation.py +++ b/rest_framework/utils/representation.py @@ -40,7 +40,7 @@ def smart_repr(value): # # Should be presented as # - value = re.sub(' at 0x[0-9a-f]{4,32}>', '>', value) + value = re.sub(' at 0x[0-9A-Fa-f]{4,32}>', '>', value) return value