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

Make PngImagePlugin.add_text() zip argument type bool #2890

Merged
merged 1 commit into from
Dec 19, 2017
Merged

Make PngImagePlugin.add_text() zip argument type bool #2890

merged 1 commit into from
Dec 19, 2017

Conversation

jdufresne
Copy link
Contributor

Always used as a bool, but was previously defined as 0/1. Use modern idiomatic Python by using the bool type for bool arguments.

Always used as a bool, but was previously defined as 0/1. Use modern
idiomatic Python by using the bool type for bool arguments.
@@ -249,7 +249,7 @@ def add_itxt(self, key, value, lang="", tkey="", zip=False):
self.add(b"iTXt", key + b"\0\0\0" + lang + b"\0" + tkey + b"\0" +
value)

def add_text(self, key, value, zip=0):
def add_text(self, key, value, zip=False):
Copy link
Member

Choose a reason for hiding this comment

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

As an aside, this is a really badly named parameter, as it shadows a builtin. However, since it's (nominally) a named parameter in a public interface, changing it is potentially going to cause more pain than it's worth.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but I wasn't attempting to change the public interface. I agree, that may be worthwhile to avoid the builtin.

Copy link
Member

Choose a reason for hiding this comment

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

Yep.

@wiredfool wiredfool merged commit 09c8b06 into python-pillow:master Dec 19, 2017
@jdufresne jdufresne deleted the add-text-bool branch January 1, 2018 13:23
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.

None yet

2 participants