[Python-Dev] __signature__ for PySide ready
tismer at stackless.com
Sat Aug 19 04:38:37 EDT 2017
On 19.08.17 09:37, Nick Coghlan wrote:
> On 19 August 2017 at 02:55, Jelle Zijlstra <jelle.zijlstra at gmail.com> wrote:
>> 2017-08-18 18:20 GMT+02:00 Yury Selivanov <yselivanov.ml at gmail.com>:
>>> There's a backport of signature API to Python 2. Although last time I
>>> checked it was fairly outdated.
>> I wrote a backport earlier this year: https://pypi.python.org/pypi/inspect2.
> Yury was probably referring to https://funcsigs.readthedocs.io/, which
> is a partial backport specifically of inspect.Signature and friends.
> Either way, the answer to Christian's original question is that "Yes,
> supporting __signature__ is also useful in Python 2.x", as even though
> the native inspect module doesn't support it, 3rd party backports do.
I did not use a backport, but simply hacked it together, myself:
- Take the signature part of Python 3.6 out,
- Adjust the syntax to Python 2.7.
The hairy part was my way to create the PySide PyCFunction objects in
a compatible way like Python 3 does it: the handling of PyCFunction's
"self" parameter is different (holds type info, Python 2 does not).
That needed much more internal knowledge as intended...
Well, I thought the existence of __signature__ might be a good reason
to switch to Python 3, but if I support Python 2, the advantage
is gone. But if it's ok with you, then I'll publish both versions.
Thanks a lot for the feedback.
Ciao - Chris
Christian Tismer :^) tismer at stackless.com
Software Consulting : http://www.stackless.com/
Karl-Liebknecht-Str. 121 : https://github.com/PySide
14482 Potsdam : GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776 fax +49 (30) 700143-0023
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 496 bytes
Desc: OpenPGP digital signature
More information about the Python-Dev