-
Notifications
You must be signed in to change notification settings - Fork 3
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
All PsdBooleans are True #10
Comments
Thanks for reporting. I rely on the |
I can't seem to reproduce the bizarre side effect, ballooning. Can you share a file and/or code? |
Happy to help report bugs, always :). I think there's something going on with my use of channels in |
The PsdBoolean read issue should be fixed in v2024.2.22. |
Hi there Christoph,
psdtags is great! But I just found a bug while doing an overly[*] paranoid
assert(originalbytes == frombytes(originalbytes).tobytes()
at thePsdLayer
level). It seemed to me that a layer's infx value should have been 0000, but it was being written out as 1000. The same thing was true of knko. But I noticed that there wasn't an unexpected diff in the layer's clbl. They're allPsdBoolean
s. Then it occurred to me.. it's because they were all hardcoded by psdtags to 1000 (True), and only the clbl was originally true. Lo and behold:In https://github.com/cgohlke/psdtags/blob/v2024.1.15/psdtags/psdtags.py#L2490 we see:
However:
I believe this is is making all
PsdBoolean
'sread()
/frombytes()
True
, regardless of input value. This also isn't the only place I see abool(fh.read(1))
, which I think is generally a bug for the above reason - unless the read literally returnsFalse
orNone
, you're always going to beTrue
.I tried patching this in my local checkout to check for
fh.read(1) != '\x00'
, but it had really bizarre side effects - namely thatwrite()
/tobytes()
output of myPsdLayer
object ballooned in size. If I just hardcodedvalue = True
I had identical broken output, but if I got it to parse correctly, I think some other routine is conditioning on somePsdBoolean
somewhere, and since it's never beenFalse
before (or at least recently - I didn't check blame history) I'm guessing said codepath wasn't exercised.Hope this helps,
-Andrew
[*] turns out maybe this wasn't overly paranoid, but "just right paranoid" ;)
The text was updated successfully, but these errors were encountered: