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

Field name checks for StructTuple #1828

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

chrism0dwk
Copy link
Contributor

This PR introduces a new check for field names in a StructTuple, preventing any that over-ride existing members of the tuple base class. It is intended to trap a gotcha in JointDistributionCoroutine if a user names a variable "index" or "count".

This PR introduces a new check for field names in a StructTuple, preventing any that over-ride existing members of the tuple base class.  It is intended to trap a gotcha in JointDistributionCoroutine if a user names a variable "index" or "count".
Copy link
Collaborator

@ColCarroll ColCarroll left a comment

Choose a reason for hiding this comment

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

thanks, chris! i'll try to pull this in soon.

@@ -51,6 +51,9 @@ def _validate_field_names(field_names):
if name.startswith('_'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

i guess this will prevent name="__gt__"

@copybara-service copybara-service bot merged commit 95767a1 into tensorflow:main Aug 9, 2024
7 checks passed
@ColCarroll
Copy link
Collaborator

thanks again, @chrism0dwk -- ended up using the fix @SiegeLordEx suggested, and used your particular case as a unit test.

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