#twisted

/

      • emk has quit
      • emk joined the channel
      • brodolfo joined the channel
      • moshez joined the channel
      • jwhisnant has quit
      • jwhisnant joined the channel
      • faldridge joined the channel
      • tacomaster joined the channel
      • cyphase_eviltwin joined the channel
      • faldridge has quit
      • tacomaster has left the channel
      • efphe has quit
      • kenaan
        Tickets pending review: https://tm.tl/#8464 (rodrigc), #8902, #8912, #8966 (the0id), #8981, #8995, #9024, #9015, #9006, #9017, #5726, #9014, #9027, #9028
      • cyphase_eviltwin is now known as cyphase
      • faldridge joined the channel
      • faldridge has quit
      • derek_v joined the channel
      • fiddlerwoaroof has quit
      • faldridge joined the channel
      • faldridge has quit
      • moshez has quit
      • avium has quit
      • adema has quit
      • moshez joined the channel
      • avium joined the channel
      • fluter has quit
      • terrycojones has quit
      • adema joined the channel
      • terrycojones joined the channel
      • Lightsword joined the channel
      • fluter joined the channel
      • brodolfo has quit
      • cwillu has quit
      • cwillu joined the channel
      • fiddlerwoaroof joined the channel
      • moshez has quit
      • meejah
        nanonyme: IMO an API method should either return a Deferred or not (and thus, all-Failures or all-exceptions)
      • also, maybeDeferred it pretty simple code, I doubt it would induce that much slowness
      • moshez joined the channel
      • wachpwnski-mobi joined the channel
      • wachpwnski-mobi
        Does anyone have any good examples of how to use multiservice?
      • kenaan
        Tickets pending review: https://tm.tl/#8464 (rodrigc), #8902, #8912, #8966 (the0id), #8981, #8995, #9024, #9015, #9006, #9017, #5726, #9014, #9027, #9028
      • jamesaxl joined the channel
      • wachpwnski-mobi has quit
      • InfoTest joined the channel
      • InfoTest has quit
      • __main__ has quit
      • __main__ joined the channel
      • __marco joined the channel
      • jwhisnant has quit
      • InfoTest joined the channel
      • efphe joined the channel
      • [0xAA] joined the channel
      • jwhisnant joined the channel
      • InfoTest has quit
      • brodolfo joined the channel
      • Tickets pending review: https://tm.tl/#8464 (rodrigc), #8902, #8912, #8966 (the0id), #8981, #8995, #9024, #9015, #9006, #9017, #5726, #9014, #9027, #9028
      • __marco has quit
      • bigpet has quit
      • hynek
        so I feel really stupid, but why would `twist web -p "tls:cust-ws.service.consul:443:privateKey=/etc/ssl/private/*.service.consul.key" --wsgi cust_ws.wsgi.application` return `ValueError: Unknown endpoint type: 'tls'` ? is the new and shiny tls type legacy Python-only?
      • __marco joined the channel
      • faldridge joined the channel
      • faldridge has quit
      • cdunklau
        hynek: perhaps you didn't install twisted[tls] ?
      • random thought, but hey, maybe
      • __marco has quit
      • nanonyme
        meejah, yes, imo that would be reasonable assumption as well
      • meejah, https://paste.fedoraproject.org/547104/63052771/ I just wonder whose responsibility here is to make sure that exceptions are rolled into deferred failures
      • Or should *every* frame that claims they return a Deferred always catch exceptions and roll them into deferred failures?
      • asdf
        i don't think it's sane to take special care to make sure your function never throws an exception (and instead returns a failure) - because in python, mostly everything can possibly throw an exception, right
      • but in this case this looks like something i'd call validation i guess, so yeah, if it's part of the api, it should probably return a failure instead
      • nanonyme
        asdf, that way of thinking means you can't rely on any Twisted API and must always use maybeDeferred
      • asdf
        i mean in a "exceptions you know how to handle / expected by the programmer" vs "exceptions that you don't handle (which should bubble up)"
      • nanonyme
        I mean, you can't really know what some other library will raise. You just have to turn *everything* into a Failure if you want your API to reliably return a Deferred
      • asdf
        (i dont think the latter need to be failures)
      • nanonyme
        Okay, so someone who actually can handle all failures then needs to wrap everything as maybeDeferred
      • As in, like, my errback handler was basically "okay, this URl failed, I'm going to log error and add it to ignore list"
      • Instead the synchronous exception went in some weird codepaths and apparently broke my reactor
      • kenaan
        exarkun submitted <https://tm.tl/#9021>; - twisted.python._url.URL docstring for .child() method is incorrect (unassigned) for review
      • cdunklau
        hynek: from all i'm seeing it should be 'ssl', not 'tls'
      • efphe has quit
      • efphe joined the channel
      • nanonyme
        asdf, and seriously my assumption was *everything* is Failures, then you trap in your errback
      • Apparently you just can't code like this in significant bulks of Twisted
      • I mean, having two parallel flow controls is just silly
      • cyphase joined the channel
      • Eezer joined the channel
      • Eezer has quit
      • slav0nic joined the channel
      • kenaan
        Tickets pending review: https://tm.tl/#8464 (rodrigc), #8902, #8912, #8966 (the0id), #8981, #8995, #9024, #9015, #9006, #9021, #9017, #5726, #9014, #9027, #9028
      • average has quit
      • average joined the channel
      • Julian reviewed <https://tm.tl/#9021>; - twisted.python._url.URL docstring for .child() method is incorrect (assigned to exarkun)
      • meejah
        nanonyme: if a function is @inlineCallback-decorated then any exception will become a Failure. And ditto for maybeDeferred. but yeah I imagine stuff like SyntaxError will often be a synchronous exception for "normal" Deferred-returning functions
      • nanonyme
        meejah, well, as in my traceback above, this was actually just some parse error in a string which was raised but layers of Twisted left it not wrapped as Failure since they were only doing it for expected exception types
      • Even when the API documented that these things always return Deferred's
      • I'm here trying to find some core devs to argue on this since it seems a philosophical thing to me and I don't want to start filing tickets until I've checked whether my idea is the same as with core devs'
      • I basically workarounded my specific case with maybeDeferred but it feels like a workaround to me
      • hynek
        cdunklau: ssl: is deprecated in favor of TLS:…
      • hetii joined the channel
      • [0xAA] has quit
      • tomprince
        Well, not deprecated in that it likely won't be removed any time soon.
      • meejah
        nanonyme: yeah i'm not sure if there's a policy, but effectively all you're asking for is every public-API to be wrapped in maybeDeferred ;)
      • nanonyme
        meejah, I guess. For every public API that isn't documented not to return a deferred anyway
      • But I think more that there would be a guarantee that API's that return a deferred never raise directly and whenever you hit a boundary between an API that does not return deferred, you wrap the return value and exception
      • So that you don't necessarily do it at public API level but API boundary level
      • If that makes any sense to you
      • meejah
        sort-of. but i'm a little ambivilant on straight-up errors like SyntaxError etc
      • not that i'm a core twisted dev ;) so *shruggy-face* but ...
      • i've been using @inlineCallbacks "mostly" in a lot of my stuff, making that a sort of non-issue
      • tomprince
        There are arguments either way.
      • __marco joined the channel
      • It is impossible to catch everything without doing `except:` everywhere which is problematic for other reasons.
      • Often, raising an exception is a bug.
      • nanonyme
        tomprince, I'd be fine with even Exception being wrapped
      • tomprince
        On the other hand, an argument could be made that raising an exception is reasonable, if a function was passed nonsense, rather than couldn't do what was asked.
      • nanonyme
        tomprince, http://paste.fedoraproject.org/547104/63052771/ is the stack trace that made me start wondering about all of this FWIW
      • tomprince
        Probably glyph has some thoughts.
      • nanonyme
        I was assuming in that case that I could just *always* do errbacks but turned out I was wrong
      • runciter
        nanonyme: can you share app.py?
      • if you raise an exception in a deferred's callback, it will automatically get converted to a failure
      • nanonyme
        Sure, nanobot is opensource
      • runciter
        so that covers a lot of cases
      • nanonyme
        runciter, the thing is, the API that was supposed to give me a deferred never did but raised an exception instead
      • runciter
        here, you seem to be using a cooperator
      • nanonyme
        runciter, I used maybeDeferred and the problem went away
      • runciter
        nanonyme: yeah, if an exception occurs *before* the callbacks can run, then it will propogate synchronously
      • nanonyme
        I would have had an errback to handle the error from the defered
      • runciter
      • nanonyme
        Yes
      • And the exception gets raised on line 201
      • runciter
        so the Cooperator API is special
      • you give it an iterable that yields deferreds
      • nanonyme
        I was expecting a deferred instead
      • runciter
        this is distinct from inlineCallbacks
      • in that the generator will be wrapped in a Deferred automatically
      • so with Cooperator there's this gap where your iterator can throw an exception and it will be raised synchronously
      • nanonyme
        You're not getting it, I think
      • runciter
        nanonyme: my point is that this there isn't a general code path here
      • the common code path is covered - getting an exception in a callback or errback
      • nanonyme
        runciter, what do you mean general?
      • runciter
        but that's not the path you're hitting
      • nanonyme
        The problem is that there is no deferred here
      • runciter
        nanonyme: you're asking about how you can generally manage exceptions in twisted
      • i think
      • and your argument is: wrap everything in maybeDeferred, so you always get a Failure
      • i think
      • nanonyme
        No, I'm saying that API's that are documented that they return a deferred shouldn't randomly raise