[Twisted-Python] Twisted v21.2.0 breaks Crossbar.io

Tobias Oberstein tobias.oberstein at crossbario.com
Tue Mar 2 19:48:24 MST 2021


Hi Jean-Paul,

> It seems like this change does not actually violate Twisted's 
> compatibility policy.  This is not to say introducing such regressions 
> is desirable, but when constructing such work-arounds it might be worth 
> paying closer-than-average attention to what the policy actually is.
> 
> The policy is currently documented at 
> https://twistedmatrix.com/documents/current/core/development/policy/compatibility-policy.html#new-attributes 

Thanks! I wasn't aware (well, I was, but I never read all the docs;)

That indeed quite precisely hints at sth we did in our workaround: 
relying on the output of dir()

IOW, we should have done

except (AttributeError, NotImplementedError):

in the first place, because that catches both.

on an different angle, I wonder about the relation between both 
exceptions independent of Twisted.

eg "attribute not defined" certainly is an "attribute error"? and in any 
case, a missing attribute means it cannot be implemented?

so it cannot be implemented without making attribute access succeed, right?

but even if that would all be defined, it could not be expressed in 
python. or even statically checked. because that would require some 
machine readable language / decorators / whatever to exhaustively state 
what exceptions can be raised in the first place.

and then, an app developer (crossbar in this case) can make sure and 
test that it does actually have code to treat _all_ exceptions that can 
ever be raised.

anyways, just some ramblings .. python won't give me that, yes.


> (and that anchor takes you to the section that I think allows the change).
> 
> Policy aside, this change doesn't seem like much of an improvement to 
> me.  If I were to guess, I would guess the change was made to satisfy 
> some check Mypy is now being asked to make about Twisted.  If that's the 
> case, it seems unfortunate that real-world software is suffering so that 
> a synthetic goal can be achieved.  I do recognize there is a perception 
> that practical value can come from attending to the errors Mypy 
> reports.  It would probably benefit everyone if more care were taken to 
> consider the real-world consequences of changes that are made to satisfy 
> the non-real-world goalposts set by tools like Mypy.

fwiw, I highly welcome the use of mypy! even with some fallout;) we use 
it too (in crossbarfx).

but ^ might indeed be what happened practically. np, I can deal with it. 
Twisted has been a very reliable, and central piece of our stack - and 
is here to stay! happy user=) and, I guess, all workarounds (mine) 
eventually come back and bite. that's life;)

Cheers,
/Tobias


> 
> Jean-Paul
> 
>     _______________________________________________
>     Twisted-Python mailing list
>     Twisted-Python at twistedmatrix.com
>     <mailto:Twisted-Python at twistedmatrix.com>
>     https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 

-- 

Tobias Oberstein - phone +49 176 2375 2055 - tobias.oberstein at crossbario.com
Crossbar.io GmbH - Waldstrasse 18 - 91054 Erlangen
HRB 15870 - Amtsgericht Fuerth - Geschäftsfuehrer/CEO - Tobias Oberstein

https://crossbar.io
https://crossbario.com



More information about the Twisted-Python mailing list