From 01f798705f7dae5fcc82274099ec8d0d8f78b873 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Thu, 9 Jan 2014 20:13:17 +0200 Subject: Merge the two duplicated _fmt_address() --- src/zope/security/proxy.py | 2 +- src/zope/security/tests/test_proxy.py | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/zope/security/proxy.py b/src/zope/security/proxy.py index 7f7d626..16bb95f 100644 --- a/src/zope/security/proxy.py +++ b/src/zope/security/proxy.py @@ -52,7 +52,7 @@ def _fmt_address(obj): # the platform sprintf(buf, "%p", obj), which we cannot access from Python # directly (and ctypes seems like overkill). if sys.platform == 'win32': - return '0x%08x' % id(obj) + return '0x%08X' % id(obj) else: return '0x%0x' % id(obj) diff --git a/src/zope/security/tests/test_proxy.py b/src/zope/security/tests/test_proxy.py index d2e1dbc..fbe4964 100644 --- a/src/zope/security/tests/test_proxy.py +++ b/src/zope/security/tests/test_proxy.py @@ -36,15 +36,6 @@ def _skip_if_Py2(testfunc): return dummy return testfunc -def _fmt_address(obj): - # Try to replicate PyString_FromString("%p", obj), which actually uses - # the platform sprintf(buf, "%p", obj), which we cannot access from Python - # directly (and ctypes seems like overkill). - if sys.platform == 'win32': - return '0x%08X' % id(obj) - else: - return '0x%0x' % id(obj) - class ProxyTestBase(object): @@ -160,6 +151,7 @@ class ProxyTestBase(object): def test___str___checker_forbids_str(self): from zope.security.interfaces import ForbiddenAttribute from zope.security._compat import _BUILTINS + from zope.security.proxy import _fmt_address target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) @@ -177,6 +169,7 @@ class ProxyTestBase(object): def test___repr___checker_forbids_str(self): from zope.security.interfaces import ForbiddenAttribute from zope.security._compat import _BUILTINS + from zope.security.proxy import _fmt_address target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) -- cgit v1.2.1