Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-34430 Symmetrical chaining futures in asyncio.future.wrap_future #8807

Closed
wants to merge 3 commits into from

Conversation

whuji
Copy link

@whuji whuji commented Aug 18, 2018

The two futures chained by :func:asyncio.future.wrap_future are now
symmetrical.

Before, the behaviour was:

When the wrapped future gets a result, the new future gets the same result,
When the new future is cancelled, the wrapped future is cancelled
now, these new behaviours have been implemented:
3) When the new future gets a result, the wrapped future gets the same result,
4) When the wrapped future is cancelled, the new future is cancelled

so, the new behaviour is:

When either one future is done, the other is done with the same results or exceptions,
When either one future is cancelled, the other is cancelled.

https://bugs.python.org/issue34430

@the-knights-who-say-ni
Copy link

the-knights-who-say-ni commented Aug 18, 2018

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@1st1
Copy link
Member

1st1 commented Oct 1, 2018

I'm OK with the change. Could you please rebase your code onto the recent master branch?

@whuji whuji force-pushed the asyncio_wrap_future_symmetrical branch 3 times, most recently from 3a7aa44 to 91093a4 Compare Oct 9, 2018
@whuji
Copy link
Author

whuji commented Oct 9, 2018

Don't know why appveyor fails with "env_changed" on ubuntu and mac os but passes on Windows.
It passes on my debian.

Some hints would be appreciated.

@asvetlov
Copy link
Contributor

asvetlov commented Oct 10, 2018

@whuji please try ./python -m test --fail-env-changed test_asyncio -v to run tests

@whuji
Copy link
Author

whuji commented Oct 10, 2018

Yes, I already do that. I use the appveryor command line : ./python -u -Wd -E -bb -m test -uall -u-cpu -u-largefile -rwW --slowest --timeout 1200 --fail-env-changed -j0 test_asyncio -v

but, I would like some hints about what could cause the "env_changed" error.
It is raised in test_asyncio.test_tasks which does not directly use wrap_future.

@whuji
Copy link
Author

whuji commented Oct 10, 2018

Ok it uses run_in_executor which uses wrap_future. Looking into this.

@whuji whuji force-pushed the asyncio_wrap_future_symmetrical branch from 3d81aa8 to 5bfeedb Compare Oct 10, 2018
@whuji
Copy link
Author

whuji commented Oct 10, 2018

It is related to a dangling thread in run_in_executor in test_tasks.
Tests are ok if I add a self.loop.stop() in the tearDown function of the concerned test_tasks suite.

@whuji whuji force-pushed the asyncio_wrap_future_symmetrical branch from 5bfeedb to b38194f Compare Oct 10, 2018
@whuji whuji closed this Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants