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

incompatible_always_check_depset_elements: depset: depset(direct=...) constructor does not check element validity #10313

Open
alandonovan opened this issue Nov 26, 2019 · 2 comments

Comments

@alandonovan
Copy link
Contributor

@alandonovan alandonovan commented Nov 26, 2019

The depset(direct=...) constructor that we have been recently migrating users towards does not apply the same element validity checks as the legacy depset([...]) constructor. Consequently one can insert mutable items such as structs and tuples containing lists:

x = [1, 2, 3]
s = depset(direct = [(x,)])
print(s)  # 'depset([([1, 2, 3],)])'

x.append(4) 
print(s) # 'depset([([1, 2, 3, 4],)])'

The fix is to apply the same checks as done by the legacy constructor, but this is a breaking change. The new check will thus be behind a flag called --incompatible_always_check_depset_elements.

@laurentlb

This comment has been minimized.

Copy link
Member

@laurentlb laurentlb commented Nov 26, 2019

Can you check if s = depset([(x,)]) behaves correctly? This is the notation most people have been using. Also, please check what happens with the --incompatible_disable_depset_items flag.

I suspect this migration should be a blocker for #9017.

@alandonovan

This comment has been minimized.

Copy link
Contributor Author

@alandonovan alandonovan commented Nov 27, 2019

Without the flag, depset([(x,)]) reports an error if and only if x is (or contains) a mutable value. With the flag, the expression succeeds even if x is (or contains) a mutable value. I could not see any difference between Blaze at tip and the previous release of Blaze, which is encouraging.

@laurentlb laurentlb changed the title depset: depset(direct=...) constructor does not check element validity incompatible_always_check_depset_elements: depset: depset(direct=...) constructor does not check element validity Nov 27, 2019
@aehlig aehlig added the migration-2.0 label Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.