Description of problem: The Python exceptions raised in libpwquality set the exception value as a tuple of (error code, error descrption). PWQError does not define any attributes, so trying to access PWQError.message always returns an empty string. PWQError derives from Exception, so it should provide a message attribute, either by using PyErr_SetString instead of PyErr_SetObject and adding the error code to the exception object elsewhere, or by setting the message attribute manually. libpwquality also returns AttributeErrors with the value set to a tuple, same problem. Steps to Reproduce: from pwquality import PWQSettings, PWQError try: PWQSettings().check("password", None, None) except PWQError as e: # This should print something print(e.message)
This message is a reminder that Fedora 20 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 20. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '20'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 20 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Is there a way how to fix this without breaking the compatibility with existing callers of the pwquality module?
Of course. The python2 exception types are already subscriptable, so an exception object could be created with the tuple items as the argument list and then the excepted attributes can be set on the object.
Is there any code example somewhere? Of course pull request on the github project would be the best but the example would be good enough. https://github.com/libpwquality/libpwquality
So actually the message is deprecated in python >= 2.6 and dropped in python 3. I am wontfixing this.