Skip to content

Conversation

@undingen
Copy link
Contributor

fixes leaks in

  • interactive mode
  • -m mode
  • when calling tp_setattr from setattr()
  • creating duplicate set and dict entries from an AST node

I could not enable the tests yet because the need the generator abandonment fix but this fix is not ready yet but I want to land this fixes now so we don't do duplicate work.

@undingen undingen closed this Apr 22, 2016
@undingen undingen reopened this Apr 22, 2016
@undingen undingen merged commit bacf0cf into pyston:refcounting Apr 22, 2016
auto&& p = set->s.insert(data[i]);
if (!p.second /* already exists */) {
Py_DECREF(p.first->value);
*p.first = data[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should use the original value and decref the duplicate one: set([1, 1L]) is 1 for CPython and 1L for us.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This matches the behavior for dict keys, but is different from dict values -- {1:1, 1L:1L} is {1: 1L}.

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