Skip to content

Assign local variable scalar and compare bytes of two values #37

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 2 commits into from
May 30, 2019

Conversation

GnaneshKunal
Copy link
Contributor

@GnaneshKunal GnaneshKunal commented May 30, 2019

Squashed Commit:

* Assign a val to local variable `scalar` before returning
* Compare bytes of two values

Long:

  1. There are two cases where we get an exception UnboundLocalError: local variable 'scalar' referenced before assignment
    • We find the type to be boolean and find the value not being true or false (Happens when we compare bytes with a string) and we reach the return statement and we get the above exception since we haven't defined scalar in the outer scope.
    • When the scalar_type is ResultSetScalarTypes.PROPERTY_UNKNOWN, we reach the final statement and return scalar which hasn't been defined.
  2. We have to compare byte response with byte string as b'true' is not equal to true, we always return the boolean values as None since we have reached the else statement.

Short:

  • 1st commit solves local variable 'UnboundLocalError: scalar' referenced before assignment by assigning a value to the variable.
  • 2nd commit compares byte values and returns the appropriate values instead of None.

@GnaneshKunal GnaneshKunal changed the title Assign local variable scalar and decode values before processing Assign local variable scalar and compare bytes of two values May 30, 2019
@swilly22
Copy link
Contributor

@GnaneshKunal Thank you!

@swilly22 swilly22 merged commit 60ad0a4 into RedisGraph:master May 30, 2019
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