Called to run a new tasklet: rebind the creation so that we can trace it.
(self, *args, **kwargs)
| 317 | # setup |
| 318 | # ======================================================================================================================= |
| 319 | def setup(self, *args, **kwargs): |
| 320 | """ |
| 321 | Called to run a new tasklet: rebind the creation so that we can trace it. |
| 322 | """ |
| 323 | |
| 324 | f = self.tempval |
| 325 | |
| 326 | def new_f(old_f, args, kwargs): |
| 327 | debugger = get_global_debugger() |
| 328 | if debugger is not None: |
| 329 | debugger.enable_tracing() |
| 330 | |
| 331 | debugger = None |
| 332 | |
| 333 | # Remove our own traces :) |
| 334 | self.tempval = old_f |
| 335 | register_tasklet_info(self) |
| 336 | |
| 337 | # Hover old_f to see the stackless being created and *args and **kwargs to see its parameters. |
| 338 | return old_f(*args, **kwargs) |
| 339 | |
| 340 | # This is the way to tell stackless that the function it should execute is our function, not the original one. Note: |
| 341 | # setting tempval is the same as calling bind(new_f), but it seems that there's no other way to get the currently |
| 342 | # bound function, so, keeping on using tempval instead of calling bind (which is actually the same thing in a better |
| 343 | # API). |
| 344 | |
| 345 | self.tempval = new_f |
| 346 | |
| 347 | return _original_setup(self, f, args, kwargs) |
| 348 | |
| 349 | # ======================================================================================================================= |
| 350 | # __call__ |
no outgoing calls
no test coverage detected