Skip to content

bpo-38880: List interpreters associated with a channel end #17323

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

Merged
merged 34 commits into from
Apr 29, 2020

Conversation

LewisGaul
Copy link
Contributor

@LewisGaul LewisGaul commented Nov 21, 2019

This PR adds the functionality requested by ericsnowcurrently/multi-core-python#52.

https://bugs.python.org/issue38880

Automerge-Triggered-By: @ericsnowcurrently

Copy link
Contributor

@nanjekyejoannah nanjekyejoannah left a comment

Choose a reason for hiding this comment

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

@LewisGaul it would be good to have a news entry. Use blurbit

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

Thanks so much for working on this. The approach you took looks good. I've left a lot of comments, but don't get disheartened. :) I'm just thorough. I didn't see any problems with correctness. My comments mostly fall into these groups:

  • use _PyInterpreterID_New()
  • the Python function signature can be simpler
  • simplify the code:
    • variable declarations should be where they are significant rather than at the top
    • don't worry about optimization right now
    • don't use goto where you don't need to

I'd be happy to discuss any of this further. Again, thanks for helping out!

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@LewisGaul
Copy link
Contributor Author

@LewisGaul, I'd like to get this wrapped up in the next week or so. What's left to be done? How can I help?

I'm looking into this right now, and would be happy to work with you to get this finished over the weekend. I'll update you after I've had a look over the next few hours.

@LewisGaul
Copy link
Contributor Author

LewisGaul commented Apr 18, 2020

@LewisGaul, I'd like to get this wrapped up in the next week or so. What's left to be done? How can I help?

I'm looking into this right now, and would be happy to work with you to get this finished over the weekend. I'll update you after I've had a look over the next few hours.

@ericsnowcurrently I've replaced the implementation with the suggestion you had during the review and it seems to work better, with all tests now passing except test_channel_list_interpreters_closed() which is raising ChannelClosedError when trying to list interps associated with one end when only the other end was closed. Probably just needs going through with GDB...

@ericsnowcurrently
Copy link
Member

Awesome. Let me know if I can help in any way.

@LewisGaul
Copy link
Contributor Author

@ericsnowcurrently What seems to be happening is when I call channel_close(cid, send=True) it's going through to hit this block, which removes the channel reference entirely (on line 1078). If I've understood correctly, this call should only be closing the send end, so shouldn't be removing the channel ref?

@ericsnowcurrently
Copy link
Member

I'd be glad to take a look with you. You open to a video chat? I'm available almost any time.

@nanjekyejoannah
Copy link
Contributor

nanjekyejoannah commented Apr 25, 2020

btw, I added this change in #18817 and these tests are failing. This will block my next PR as I want to open a PR on using sub-interpreters for test suite . I want to know how to help as I believe @LewisGaul you have gone a long way into finishing this.

@LewisGaul
Copy link
Contributor Author

@nanjekyejoannah I'm working on this - I have a call with Eric scheduled for Monday. The implementation is basically done, there's just an issue with one test case to do with closing a just one end of a channel. I'll let you know if any further help is required, thanks.

@nanjekyejoannah
Copy link
Contributor

@LewisGaul , nice thanks I will wait for the outcomes of your work with @ericsnowcurrently to open the new PR. Thanks

@LewisGaul
Copy link
Contributor Author

@ericsnowcurrently Thanks for the chat earlier.

I've updated the PR with a fix:

  • In my implementation of _channel_is_associated() I call _channels_lookup()
  • ChannelClosedErrors are propagated from _channels_lookup(), but this doesn't distinguish between channel ends (i.e. send end can be closed but no error is raised if recv end is still open)
  • Fixed by adding a check if (send && chan->closing != NULL) { [raise ChannelClosedError] }

Should be good for re-review now!

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for working on this! I only have one comment (a possible refleak). I'll merge the PR once that is addressed.

@miss-islington
Copy link
Contributor

@LewisGaul: Status check is done, and it's a failure ❌ .

1 similar comment
@miss-islington
Copy link
Contributor

@LewisGaul: Status check is done, and it's a failure ❌ .

@miss-islington
Copy link
Contributor

@LewisGaul: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit f7bbf58 into python:master Apr 29, 2020
@nanjekyejoannah
Copy link
Contributor

Thanks @LewisGaul for your contribution. I really needed this !

@ericsnowcurrently
Copy link
Member

Yay!

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.

7 participants