-
Notifications
You must be signed in to change notification settings - Fork 47
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
GenericProperty (and therefore Expando) changes str values to bytes (sometimes) #99
Comments
I think changing one line here, from appengine-python-standard/src/google/appengine/ext/ndb/model.py Lines 2743 to 2750 in a900a13
Edit: I guess this would break if you are putting bytes in and expecting bytes out, but for that case, GenericProperty will still fail for any bytes object that isn't an ascii-encoded string anyway, for example if you are putting binary data into it (but this would also fail in Python 2). Since binary data was never (edit: "properly") supported, it shouldn't be a compatibility issue to not support
|
Same issue exists with Expando:
|
Just a note: I noticed the existing tests for this only test with |
Expected Behavior
If I set the value of a GenericProperty to a
str
, then read it back from datastore, the value should still always be astr
. The value I read back should equal the value I put in.Actual Behavior
If I set a GenericProperty to the string
'oops'
, then read it back from datastore, the value is nowb'oops'
, so it is not equal to the value I put in the property.If I set a GenericProperty to the string
'oøps'
, then read it back from datastore, the value is still'oøps'
. Apparently we are deciding to do different behavior depending on the contents of the string.The same thing happens in appengine Python 2 incidentally, but it was not a big problem in practice because in Python 2,
'oops' == u'oops'
wasTrue
. In Python 3 it is a problem :)Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: