LEW21 / pydbus

Pythonic DBus library
GNU Lesser General Public License v2.1
331 stars 75 forks source link

Python2 compatibility: use object to query for it's doc #71

Closed psukys closed 6 years ago

psukys commented 6 years ago

Previously Python2 type(object) returned instance instead of actual class. instance's __doc__ is:

instance(class[, dict])

Create an instance without calling its __init__() method.
The class must be a classic class.\nIf present, dict must be a dictionary or None.

Shortly checked on python3.6 and it seems to run as well.

Will add a test later for this functionality later on.

Fix #70

psukys commented 6 years ago

Actually just understood that the sample code didn't use an object base class, thus why it failed. Eitherway, the proposed solution works for retrieving class's __doc__

psukys commented 6 years ago

Test is ready

LEW21 commented 6 years ago

Thanks!

However, I don't want to support object-level (not class-level) introspection XMLs, unless somebody gives me a good reason (other than Python 2 class stupidity) to do so.

psukys commented 6 years ago

@LEW21 , then it would make sense to drop Python 2.* support as software's not functioning correctly then.

LEW21 commented 6 years ago

Actually, it's functioning correctly. It only does not support old-style classes, which are a deprecated, should-not-be-used part of Python 2.

Also, I'm going to drop Python 2 support in the next release.