Skip to content

Conversation

@vstinner
Copy link
Member

No description provided.

@mention-bot
Copy link

@Haypo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mdickinson, @Yhg1s and @serhiy-storchaka to be potential reviewers.

Misc/NEWS Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Unicode instead → Unicode string
bytes string → byte string [or bytes object if you prefer]

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

3.6 → 3.7
I think either “byte string” or “bytes object” would read better.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe use just str and bytes? There is nothing specific to the Unicode standard here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, I used "str" and "bytes" types.

@brettcannon brettcannon added the type-feature A feature request or enhancement label Mar 27, 2017
@vstinner
Copy link
Member Author

@vadmium, @serhiy-storchaka: I updated my PR to take in account your remarks. Would you mind to review my PR again, please?

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Since this change breaks backward compatibility, it should be documented in What's New.

What is the result of the discussion on Python-Dev?

Misc/NEWS Outdated
Copy link
Member

Choose a reason for hiding this comment

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

I think :class: is not needed.

Copy link
Member

Choose a reason for hiding this comment

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

Why not make s_format an instance of str?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to write minimum changes. I expect that most of the code is written to work with C strings char*, not with Python Unicode strings.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW I already did this in my format-str.patch. I was able to get a char* out of the string with PyUnicode_AsUTF8.

@vstinner
Copy link
Member Author

What is the result of the discussion on Python-Dev?

No answer: https://mail.python.org/pipermail/python-dev/2017-March/147688.html

@vstinner
Copy link
Member Author

Since this change breaks backward compatibility, it should be documented in What's New.

Ok, done.

The change is now documented in the changelog (Misc/NEWS), twice in What's New in Python 3.7 (struct module and Porting to Python 3.7), and in struct documentation. I don't think that you can document it more :-)

Seriously, I don't think that anyone rely on the exact type of struct.Struct.format. If someone cares, it will be trivial to notice, and also likely trivial to fix the code.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM, but add a reference to the issue and wait yet short time for a reaction on Python-Dev.

Copy link
Member

Choose a reason for hiding this comment

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

Add a reference to issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, done

Copy link
Member

Choose a reason for hiding this comment

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

Actually I'm not sure that mentioning this change here is needed. This is not a new feature.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, removed

Copy link
Member

Choose a reason for hiding this comment

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

IMO, self.assertIsInstance(s.format, str) would be better to understand (for future readers) the behavior change.

@vstinner
Copy link
Member Author

@serhiy-storchaka: "LGTM, but add a reference to the issue and wait yet short time for a reaction on Python-Dev."

Serhiy wrote an email to my old thread:
https://mail.python.org/pipermail/python-dev/2017-June/148360.html

@ncoghlan wrote "As long as it's noted in the "Porting to Python 3.7" section of the 3.7 What's New guide, this seems like a sensible change to me."

It's the case, I added an entry to Porting to Python 3.7. I will wait until Friday (June 23) evening.

@vstinner
Copy link
Member Author

It's the case, I added an entry to Porting to Python 3.7. I will wait until Friday (June 23) evening.

It's today. I began by rebasing my change.

@vstinner vstinner merged commit f87b85f into python:master Jun 23, 2017
@vstinner vstinner deleted the struct_format branch June 23, 2017 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants