On 4/17/22 02:37, Paul Allen Newell wrote:
Dear "code-quality _at_ python.org:
I am trying to get pylint working with my Python code running under 3.6 on Centos 7 (fully updated). I found some issues and am trying to figure out how to report. The pylint pages says to look under "issue tracker" at https://github.com/PyCQA/pylint but I could find an issue tracker.
Uh.... that would be the tab labeled "Issues"
I am seeing a "W0212: Access to a protected member %s of a client class" regarding my use of "sys._getframe()". How can this be a warning if the Python documentation lists this as a method to use in their documentation?
It's a warning because the method name starts with an underscore, which by convention means it's intended for internal use. Further, the documentation of _getframe reinforces this, pointing out it should be used "for internal and specialized purposes only". If you've decided you know what you're doing, you can always quiet individual complaints from pylint, you don't have to accept every single thing it complains about.
I am also getting an "E0602: Undefined variable %r" when I use __cached__. I understand that __cached__ may be undefined or defined, but pylint needs to allow me to test this to see what it is. Yeah, exception to the rule?
If you're going to test (access?) something that may be undefined, you need to do so in a manner that lets your program survive in case it's undefined. That typically means using a try block or hasattr().