Re: [PATCH] don't dump private data members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> diff --git a/exception.py b/exception.py
> index e4e7c08..b146315 100644
> --- a/exception.py
> +++ b/exception.py
> @@ -89,6 +89,9 @@ class AnacondaExceptionDump:
>          pad = ' ' * ((level) * 2)
>
>          for key, value in instance.__dict__.items():
> +            if key.startswith("_%s__" % instance.__class__.__name__):
> +                continue
> +
>              if parentkey != "":
>                  curkey = parentkey + "." + key
>              else:
>
> This is beyond my python skills, so no comment on this.

Python has some funny ideas about how to make something a private member
of a class.  It mangles the name to be _ClassName__MemberName.  So if
you have the following class:

class A:
   def __init__(self):
      self.__blah = None

Then you really have class A with member _A__blah in any instances.
Kind of silly, really.

This part of the patch looks through all the members in an instance of a
class and skips over any that have been mangled into being private.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux