Source: epydoc
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness

Hi,

as mentioned before, here's another reproducibility issue in epydoc 
I have recently addressed.
The point is that Instances of the weakref.WeakKeyDictionary,
weakref.WeakValueDictionary and weakref.WeakSet classes have a __repr__
string that contains the instance's memory address. This value should be
skipped when printing their values for reproducibility of epydoc output.
The attached patch adds explicit treatment for these classes, only including
their class names in the output.

An example affected package is ldaptor, which -- along with some additional
specific patches to itself -- now builds reproducibly for me.
If you have any more questions, please feel free to get back to me.

Thanks for considering the patch.
Best regards,
Sascha
Description: remove memory addresses for weakref.* instances
 Instances of the weakref.WeakKeyDictionary, weakref.WeakValueDictionary
 and weakref.WeakSet classes have a __repr__ string which contains their
 memory address. This should be skipped when printing their values for
 reproducibility of epydoc output.
Author: Sascha Steinbiss <sas...@steinbiss.name>
--- a/epydoc/markup/pyval_repr.py
+++ b/epydoc/markup/pyval_repr.py
@@ -203,6 +203,8 @@
         elif pyval_type is dict:
             self._multiline(self._colorize_dict, self._sort(pyval.items()),
                             state, '{', '}')
+        elif hasattr(pyval, '__class__') and (pyval.__class__.__name__ == 'WeakKeyDictionary' or pyval.__class__.__name__ == 'WeakValueDictionary' or pyval.__class__.__name__ == 'WeakSet'):
+            self._colorize_str(pyval.__class__.__name__,  state, '', 'string-escape')
         elif is_re_pattern(pyval):
             self._colorize_re(pyval, state)
         else:
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to