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

Add Task.eventual_parent_nursery introspection attribute #1558

Merged
merged 4 commits into from
May 29, 2020

Conversation

oremanj
Copy link
Member

@oremanj oremanj commented May 27, 2020

This tracks the nursery in which the task is going to run, even if it's not really running there yet because the start() that spawned it hasn't returned. Came up in discussion surrounding #1523 but seems independently useful.

@oremanj oremanj requested a review from njsmith May 27, 2020 07:51
@codecov
Copy link

codecov bot commented May 27, 2020

Codecov Report

Merging #1558 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1558   +/-   ##
=======================================
  Coverage   99.68%   99.68%           
=======================================
  Files         110      110           
  Lines       13466    13481   +15     
  Branches     1024     1025    +1     
=======================================
+ Hits        13423    13438   +15     
  Misses         28       28           
  Partials       15       15           
Impacted Files Coverage Δ
trio/_core/_run.py 99.73% <100.00%> (+<0.01%) ⬆️
trio/_core/tests/test_run.py 100.00% <100.00%> (ø)

Copy link
Member

@njsmith njsmith left a comment

Choose a reason for hiding this comment

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

One typo + one design question

newsfragments/1558.feature.rst Outdated Show resolved Hide resolved

If this task has already called ``started()``, or if it was not
spawned using `nursery.start() <trio.Nursery.start>`, then
`eventual_parent_nursery` is the same as `parent_nursery`.
Copy link
Member

Choose a reason for hiding this comment

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

I think I have a mild preference for "if the task isn't in the middle of start shenanigans, then eventual_parent_nursery is None". What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm indifferent between the two so will change it to suit your preference!

@njsmith njsmith merged commit 7e6cf19 into python-trio:master May 29, 2020
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.

2 participants