Author louielu
Recipients arigo, benjamin.peterson, bjorns, debatem1, eric.araujo, ezio.melotti, fdrake, georg.brandl, giampaolo.rodola, louielu, nbastin, pitrou, rhettinger, tim.peters,, ubershmekel
Date 2017-02-25.07:35:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
giampaolo: it seems that contextmanager will somehow make a bad return in  `trace_dispatch_return`:

$ ./python
# logging.fatal('%r %r' % (frame.f_code.co_name, self.cur[-3]))
CRITICAL:root:'runblock' '' ('profile', 0, '')
CRITICAL:root:'__enter__' '' ('profile', 0, '')
Traceback (most recent call last):
  File "", line 18, in <module>
    with p.runblock():
  File "/home/grd/Python/cpython/Lib/", line 82, in __enter__
    return next(self.gen)
  File "/home/grd/Python/cpython/Lib/", line 256, in trace_dispatch_i
    if self.dispatch[event](self, frame, t):
  File "/home/grd/Python/cpython/Lib/", line 346, in trace_dispatch_return
    raise AssertionError("Bad return", self.cur[-3])
AssertionError: ('Bad return', ('profile', 0, ''))

I make a workaround in GitHub PR, that skip the assert when self.cur[-3] is ('profile', 0, ''), and this work fine with your test cases.

p.s. I'm not very sure about the assertion of bad return, maybe this workaround may cause some side affact I didn't notice.
Date User Action Args
2017-02-25 07:35:23louielusetrecipients: + louielu, tim.peters, fdrake, arigo, georg.brandl, rhettinger, nbastin, pitrou, giampaolo.rodola, benjamin.peterson, ezio.melotti, eric.araujo,, debatem1, ubershmekel, bjorns
2017-02-25 07:35:22louielusetmessageid: <>
2017-02-25 07:35:22louielulinkissue9285 messages
2017-02-25 07:35:22louielucreate