bpo-32643: Drop support for a few private Task and Future APIs. by 1st1 · Pull Request #5293 · python/cpython (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation2 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

1st1

Specifically, it's not possible to subclass Task/Future classes
and override the following methods:

https://bugs.python.org/issue32643

@1st1

Specifically, it's not possible to subclass Task/Future classes and override the following methods:

methane

asvetlov

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it!

@1st1 1st1 deleted the simplefut2 branch

January 24, 2018 16:31

@matianjun1

This is a broken feature from python3.6 before to python3.7.

class TimedTask(asyncio.Task):

    self.cputime = 0.0

    def _step(self, *args, **kwargs):
        start = time.time()
        super()._step(*args, **kwargs)
        self.cputime += time.time() - start

This is an old way to caculate task cpu_time.

In python3.7 I can't do this because of private APIs.

Is it possible to do this and also I like the new features in Python3.7.