From e3cf8d1d61f3c2c614918f475819c73d1d5401bd Mon Sep 17 00:00:00 2001
From: Tim Peters <tim.one@comcast.net>
Date: Thu, 2 Jun 2005 21:28:14 +0000
Subject: [PATCH] Merge rev 30609 from 3.4 branch.

Port from ZODB 3.2.

referencesf():  Use %r instead of %s format in the error message, else
the pickle shown is full of unprintable characters.
---
 NEWS.txt              | 7 +++++++
 src/ZODB/serialize.py | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS.txt b/NEWS.txt
index 0fca2733..19accb1b 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -43,6 +43,13 @@ _Persistence.c
   has its own copy, and the C code hadn't been compiled in ZODB since before
   ZODB 3.3.
 
+Error reporting
+---------------
+
+- In the unlikely event that ``referencesf()`` reports an unpickling error
+  (for example, a corrupt database can cause this), the message it
+  produces no longer contains unprintable characters.
+
 
 What's new in ZODB3 3.4b1?
 ==========================
diff --git a/src/ZODB/serialize.py b/src/ZODB/serialize.py
index 48171bbf..58086a2c 100644
--- a/src/ZODB/serialize.py
+++ b/src/ZODB/serialize.py
@@ -514,7 +514,7 @@ def referencesf(p, rootl=None):
         u.persistent_load = []
         u.noload()
         if len(p) > f.tell():
-            raise ValueError, 'Error unpickling, %s' % p
+            raise ValueError, 'Error unpickling %r' % p
 
 
     # References may be:
-- 
2.30.9