Skip to content

Conversation

@zhangyangyu
Copy link
Member

No description provided.

@zhangyangyu zhangyangyu added the type-feature A feature request or enhancement label May 11, 2017
@zhangyangyu zhangyangyu requested a review from pitrou May 11, 2017 10:03
@mention-bot
Copy link

@zhangyangyu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @tim-one and @serhiy-storchaka to be potential reviewers.

Objects/object.c Outdated
* up distorting allocation statistics.
*/
assert(op->ob_refcnt == 0);
/* The deallocator executing this function still occupies
Copy link
Member

Choose a reason for hiding this comment

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

I am confused about the first sentence, "The deallocator executing this function still occupies the stack". Otherwise, LGTM.

Copy link
Member Author

Choose a reason for hiding this comment

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

What I want to say is the "root deallocator" is still doing job and the stack is not released yet. So counting it into trash_delete_nesting is natural. And I also want to list the example you give here. Is it okay?

Copy link
Member

Choose a reason for hiding this comment

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

So counting it into trash_delete_nesting is natural.

That's not really what matters here, though. What the increment avoids is the possibility of an arbitrary deep recursion in _PyTrash_thread_destroy_chain.

And I also want to list the example you give here. Is it okay?

Yes!

Copy link
Member Author

Choose a reason for hiding this comment

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

Delete the first sentence and add the example. :-)

Objects/object.c Outdated
del tups
*/
assert(tstate->trash_delete_nesting == 0);
++tstate->trash_delete_nesting;
Copy link
Member

Choose a reason for hiding this comment

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

Why not move the increasing/decreasing outside of the loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, misunderstood your comment and gave a wrong reply. Hmm, I cannot think of a reason why not. What's your opinion @pitrou ?

Copy link
Member

Choose a reason for hiding this comment

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

It may be safe to move it out of the loop indeed. But I'm not sure it's a good idea to touch this code too much, either.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay. Although touching it too much seems not wise, but Serhiy's suggestion sounds good and this will only go into 3.7, we have time to check it.

@zhangyangyu zhangyangyu merged commit a66f9c6 into python:master May 13, 2017
@zhangyangyu zhangyangyu deleted the bpo-30341 branch May 13, 2017 05:36
@zhangyangyu
Copy link
Member Author

Thanks @pitrou and @serhiy-storchaka !

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

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants