Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Restore order of operators before executing the git command only for < py3.6#1193

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

bertwesarg
Copy link
Contributor

Since Python 3.6 kwargs are stable ordered again and Python 3.5 reached
its end-of-life too, so we can revert89ade7b
again. Thus make it able to pass ordered options to Git commands again.

Copy link
Member

@ByronByron left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution, it's much appreciated!

Does that also mean that kwargs are now ordered by default? Or does it mean that the order won't change between calls even though the order is not as specified?
In the latter case, the result might still be considered unstable compared to ordering them.

What do you think?

@bertwesarg
Copy link
ContributorAuthor

What do you think?

The PEP speaks aboutpreserving order, this should also mean, that the order wont changebetween calls. I cannot reproduce the examplegit.remote.pull(), given in the original commit. But I can reproduce therandom order of kwargs between two executions of Python 3.5 with this code:

defpkwargs(**kwargs):print(kwargs)pkwargs(**{'one':1,'two':2,'three':3,'four':4})

This gives me one of these possible outputs:

{'three': 3, 'four': 4, 'one': 1, 'two': 2}{'two': 2, 'one': 1, 'three': 3, 'four': 4}

For Python 3.6 it is stable and preserves the order:

{'one': 1, 'two': 2, 'three': 3, 'four': 4}
Byron reacted with thumbs up emoji

@bertwesarg
Copy link
ContributorAuthor

The PEP link is also in the commit message:https://www.python.org/dev/peps/pep-0468/

@Byron
Copy link
Member

Thanks a lot! Now this PR would be ready for merge even though I feel a little uncomfortable to remove support half a year after py3.5 reached its end of life given that it took 2 years to remove 3.4 support to be able to support inline types which has incredibly high value.

My suggestion is to wait with the merge till Sept. 5, 2020 giving folks another half a year to stop using python 3.5 or face the potential for breakage.

If you would like a merge right now one could add a python version check to keep the sort code for py3.5 maybe along a depreciation warning to let people know the date of removal.

Thanks for sharing your thoughts.

@bertwesarg
Copy link
ContributorAuthor

I don't think, shifting the date further back will have any effect. Most of us (the users) will drop py3.5, ony if we notice, that its not supported by the package we are using. But in the end, this is your call.

I also do not have a problem, to make this conditionally on the python version in use, so stay tuned for an update, without the py3.5 drop.

@bertwesargbertwesarg changed the titleRevert "Fix order of operators before executing the git command" Restore order of operators before executing the git command only for < py3.6Mar 12, 2021
# only since 3.6 Python preserves the order of kwargs and thus has a stable
# order. For older versions sort the kwargs by the key to get a stable
# order.
if sys.version_info[:2] < (3, 6):
Copy link
Member

Choose a reason for hiding this comment

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

In order to make people aware, could you add a deprecation warning mentioning the date until this will work?

…< py3.6Since Python 3.6 kwargs order will be preserved and thus provide a stableorder, therefore we can make89ade7bconditional based on the Python. Thus make it able to pass ordered optionsto Git commands.See:https://www.python.org/dev/peps/pep-0468/
@Byron
Copy link
Member

Thanks a lot for your help!

I will set a reminder for myself to remove python 3.5 support on September 5th. It would be super helpful to have a PR waiting which does that - the code was present here but seems to have been overwritten.

@ByronByron merged commit48c1e9b intogitpython-developers:masterMar 13, 2021
@ByronByron added this to thev3.1.15 - Bugfixes milestoneMar 13, 2021
@bertwesargbertwesarg deleted the revert-sorted-kwargs branchMarch 13, 2021 19:24
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ByronByronByron requested changes

Assignees
No one assigned
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
@bertwesarg@Byron

[8]ページ先頭

©2009-2025 Movatter.jp