bpo-34788: Add support for scoped IPv6 addresses#13772
bpo-34788: Add support for scoped IPv6 addresses#13772miss-islington merged 61 commits intopython:masterfrom
Conversation
Support for scoped IPv6 addresses (including network and interface addresses) is required according to RFC 4007 (https://tools.ietf.org/html/rfc4007).
There was a problem hiding this comment.
@opavlyuk Welcome and thanks for the contribution!
I would advise breaking up this PR into multiple smaller ones (approximately the size of the commits or smaller, but as self-contained chunks starting with the least dependent ones). This would allow for both easier review and debugging of the integration tests. Otherwise, this process will likely take significantly longer.
Also from the perspective of readability, I would recommend replacing the longer code blocks of repeating assertBadSplit() with iteration.
For example on lines 359-368, instead of using this:
assertBadSplit("3ffe::1::1%scope")
assertBadSplit("1::2::3::4:5%scope")
assertBadSplit("2001::db:::1%scope")
assertBadSplit("3ffe::1::%scope")
assertBadSplit("::3ffe::1%scope")
assertBadSplit(":3ffe::1::1%scope")
assertBadSplit("3ffe::1::1:%scope")
assertBadSplit(":3ffe::1::1:%scope")
assertBadSplit(":::%scope")
assertBadSplit('2001:db8:::1%scope')I would recommend something like this:
# since this is just an example, I didn't include all of them
bad_split_asserts = ["3ffe::1::1%scope", "1::2::3::4:5%scope", "2001::db:::1%scope",]
for assertion in bad_split_asserts:
assertBadSplit(assertion)This would significantly improve the overall readability of the code and more quickly conveys the message of what is being done. This doesn't have to be done when using a similar format for 2-3 lines, but it starts to add an unnecessary number of extra lines and characters when it's done 5+ times.
Edit: Also I forgot to mention that we generally use underscores to represent spaces, not camelCase. So assertBadSplit() should be assert_bad_split().
|
@aeros167 Thanks for your review!
As for me, this PR could not be broken into multiple smaller ones, because it refers to and covers a single issue. Also, all changes depend on each other and could not be merged separately (e.g. tests after main code or vice versa). According to devguide, tests and documentation should be included to PR. So, seems it would not be right to make separate PR`s.
Please, take a look at cpython/Lib/test/test_ipaddress.py Lines 348 to 357 in fb99b6b
Again, cpython/Lib/test/test_ipaddress.py Line 343 in fb99b6b |
Usually, for more involved issues, a single PR represents a self-contained step towards the resolution. Self-contained meaning that the PR also contains the respective documentation changes, test coverage, and is compatible with the existing code-base by itself. This doesn't mean that the entire issue has to be covered at once. As for this PR specifically, I'm not entirely certain into what self-contained pieces it could be further fragmented into, it's just a general guideline. If it's not reasonably possible to do this, it's not at all required. The most substantial benefit of fragmenting it into multiple PRs is easier debugging when the integration tests aren't passing.
Upon reconsideration and further inspection of the existing tests, keeping the current style of the library is understandable, especially given the sheer volume. Perhaps I'll work on refactoring it in a future PR, but it'd likely have to be done all at once for consistency. When I had first submitted my initial review, I had underestimated the size of the existing tests. Improving the readability would likely be a project on it's own. I wouldn't expect you to refactor all of the entire existing tests within the same issue. The above also applies to the naming conventions. I'm far more used to our more recent unit tests using the underscore naming. My apologies, it looks like I focused a bit too much on your additions rather than the context.
As someone who isn't a core dev, my reviews are just recommendations based on my experiences thus far working within the Python repositories. So if you have reasons for doing anything a particular way and the core devs agree with your justification, you can definitely keep it as it is. |
|
@aeros167, I've added entry to Misc/NEWS.d and resolved issues with suspicious lines in documentation, which caused checks to fail. Now, all checks are passing. |
There was a problem hiding this comment.
The documentation and changes to ipaddress look good as far as I can tell. Next, we just have give the core devs some time to review the PR. Based on the experts index pmoody is the expert for ipaddress, but there is not a github account listed on their issue tracker profile. As a result, I won't be able to mention them in the PR's comment. They're already on the issue's nosy list though.
As a minor fix, the news entry column width is supposed to be 80 characters according to the devguide, so I split it into two lines. Also, I trimmed the path to ipaddress down by replacing it with reST inline markup (mod is an abbreviation of module).
To simply a conditional, I made a minor suggestion for line 1863 of ipaddress.py.
Misc/NEWS.d/next/Library/2019-07-17-08-26-14.bpo-34788.pwV1OK.rst
Outdated
Show resolved
Hide resolved
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
|
The hundreds of commits listed above is an error that might be fixed by a simple update. But the file conflict has to be fixed first. I will try to do so. The conflict shows why What's New entries should not be added until a PR is merge-ready. |
|
@terryjreedy Sorry, previous reviewers strongly recommended adding that What'sNew (#13772 (comment), #13772 (comment)), so I followed their advice. |
|
@terryjreedy, I thought the point of the new blurb tool was to avoid What's New troubles -- am I missing something? |
|
@lisroach Lisa, you approved the idea on the tracker, and are the only core dev to give an opinion. Can you review at least part of the patch? Do you know ipaddress well enough to merge? |
|
@ethanfurman Blurb solved conflict problems with the single news items file, Misc/NEWS.rst, linked to after html-ified, as changelog from What's New. The single whatsnew/3.9.rst has the same issue as having a single NEWS.rst did. Traditionally, entries were not added with commits, but were selectively added later by a few editors trolling the news file. Adding as we go, with changes in PRs that sit around for months, recreates the old problem. |
|
@opavlyuk There are 3 issues more important at the moment than the whatsnew item.
Please ask on core-mentorship list how to deal with 1 and 2 and anything about 3 that you are not sure of. |
3eb3d42 to
e041c2e
Compare
|
@terryjreedy , thank you for your help with this PR, I really appreciate your efforts.
|
|
@gnprice Of your many suggestions, opavlyuk has "applied all suggestions, that I consider reasonable". Of the rest, are there any you consider critical, or would you be comfortable merging as is? |
asvetlov
left a comment
There was a problem hiding this comment.
Looks good and ready to merge.
Please drop a few lines from whatsnew.
Sorry, for the long review, I was pretty busy.
Thanks for your patience.
Doc/whatsnew/3.9.rst
Outdated
| * Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` | ||
| as regular functions for the limited API. Previously, there were defined as | ||
| macros, but these macros didn't work with the limited API which cannot access | ||
| ``PyThreadState.recursion_depth`` field. Remove ``_Py_CheckRecursionLimit`` | ||
| from the stable ABI. | ||
| (Contributed by Victor Stinner in :issue:`38644`.) | ||
|
|
There was a problem hiding this comment.
Please drop these lines, they are added by accident.
Victor decided to move this text to another place.
There was a problem hiding this comment.
Thanks a lot! Fixed and also corrected typo in my own surname (what a shame).
|
@opavlyuk: Status check is done, and it's a failure ❌ . |
|
@opavlyuk: Status check is done, and it's a success ✅ . |
|
Thanks! |
|
|
Error message for build 286 is Since patch did not add a C include, it is not obvious that this is really related. Since there have not been any subsequent merges and builds, I triggered a rebuild. |
|
@terryjreedy thanks! I have no idea how my patch could cause such things. It is likely an environment issue. |
|
The next build, 288, passed, so I think we are good for this issue. |
|
Agree |
https://bugs.python.org/issue34788
Automerge-Triggered-By: @asvetlov