Skip to content

bpo-32643: Drop support for a few private Task and Future APIs.#5293

Merged
1st1 merged 1 commit into
python:masterfrom
1st1:simplefut2
Jan 24, 2018
Merged

bpo-32643: Drop support for a few private Task and Future APIs.#5293
1st1 merged 1 commit into
python:masterfrom
1st1:simplefut2

Conversation

@1st1

@1st1 1st1 commented Jan 24, 2018

Copy link
Copy Markdown
Member

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

  • Future._schedule_callbacks
  • Task._step
  • Task._wakeup

https://bugs.python.org/issue32643

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

* Future._schedule_callbacks
* Task._step
* Task._wakeup

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

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 merged commit 22feeb8 into python:master Jan 24, 2018
@1st1
1st1 deleted the simplefut2 branch January 24, 2018 16:31
@matianjun1

matianjun1 commented Apr 1, 2019

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants