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

bpo-43521: Allow ast.unparse with empty sets and NaN#24897

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

Kodiologist
Copy link
Contributor

@KodiologistKodiologist commentedMar 16, 2021
edited by miss-islington
Loading

https://bugs.python.org/issue43521

Automerge-Triggered-By: GH:pablogsal

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed thePSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@Kodiologist

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please followthe steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You cancheck yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@isidentical
Copy link
Member

Thanks for the fix@Kodiologist!

Lib/ast.py Outdated
else:
# `{}` would be interpreted as a dictionary literal, and
# `set` might not be shadowed. Thus:
self.write('{1}.__class__()')
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps{*()} would be a bit more concise?

Copy link
Member

Choose a reason for hiding this comment

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

I agree, the{1} can be a bit confusing.

Copy link
Member

Choose a reason for hiding this comment

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

just for the reference, the proposed was is how astor does it. Though I think{*()} is also a good alternative

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yep, I'm the one who wrote that astor patch. I didn't realize{*()} was a possibility.

Copy link
Member

@pablogsalpablogsalMar 16, 2021
edited
Loading

Choose a reason for hiding this comment

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

< joking>

What about this nuclear option?

>>> ctypes.pythonapi.PySet_New.argtypes = ctypes.py_object,>>> ctypes.pythonapi.PySet_New.restype = ctypes.py_object>>> ctypes.pythonapi.PySet_New([]).__class__<class 'set'>

< /joking>

isidentical reacted with laugh emoji
Copy link
Member

@isidenticalisidentical left a comment

Choose a reason for hiding this comment

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

Overall it looks fine to me. One little nit is that, can you please adjust your style (like end parens on different lines) to match with the other parts of the code?

E.g;

self.write(repr(value)    .replace("inf",_INFSTR)    .replace("nan","({}-{})".format(_INFSTR,_INFSTR)))

(same goes for the tests)

Copy link
Member

@ericvsmithericvsmith left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I'm not an expert in this module.@pablogsal should probably take a look at it.

@KodiologistKodiologistforce-pushed theunparse-empty-set-and-nan branch 3 times, most recently fromec165a0 to9cbd740CompareMarch 16, 2021 19:59
@pablogsal
Copy link
Member

Looks fantastic.@Kodiologist could you also add a NEWS entry usingblurb orhttps://blurb-it.herokuapp.com/ ?

@KodiologistKodiologistforce-pushed theunparse-empty-set-and-nan branch from9cbd740 tod811584CompareMarch 16, 2021 20:06
@Kodiologist
Copy link
ContributorAuthor

Thanks, done.

@brandtbucher
Copy link
Member

Also, no need to force-push. The commits will be squashed anyways when your patch is merged.

(I find it's better to keep a full commit history here, since it gives context to the discussions if we need to come back to this later.)

@pablogsal
Copy link
Member

I plan to backport this because I consider it close enough to the "bug" territory (although is within the initial design constraints). If someone disagrees, please, express yourself and we can remove the label.

isidentical reacted with thumbs up emoji

@isidentical
Copy link
Member

Is automerge stuck?

@miss-islington
Copy link
Contributor

Thanks@Kodiologist for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-24921 is a backport of this pull request to the3.9 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.9only security fixes labelMar 18, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMar 18, 2021
Automerge-Triggered-By: GH:pablogsal(cherry picked from commit08ff436)Co-authored-by: Kodi Arfer <Kodiologist@users.noreply.github.com>
@Kodiologist
Copy link
ContributorAuthor

Ah, I had to usehttps://check-python-cla.herokuapp.com to get the bots to notice that I'd signed the CLA.

miss-islington added a commit that referenced this pull requestMar 18, 2021
Automerge-Triggered-By: GH:pablogsal(cherry picked from commit08ff436)Co-authored-by: Kodi Arfer <Kodiologist@users.noreply.github.com>
jab added a commit to jab/cpython that referenced this pull requestMar 20, 2021
* master: (129 commits)  bpo-43452: Micro-optimizations to PyType_Lookup (pythonGH-24804)  bpo-43517: Fix false positive in detection of circular imports (python#24895)  bpo-43494: Make some minor changes to lnotab notes (pythonGH-24861)  Mention that code.co_lnotab is deprecated in what's new for 3.10. (python#24902)  bpo-43244: Remove symtable.h header file (pythonGH-24910)  bpo-43466: Add --with-openssl-rpath configure option (pythonGH-24820)  Fix a typo in c-analyzer (pythonGH-24468)  bpo-41561: Add workaround for Ubuntu's custom security level (pythonGH-24915)  bpo-43521: Allow ast.unparse with empty sets and NaN (pythonGH-24897)  bpo-43244: Remove the PyAST_Validate() function (pythonGH-24911)  bpo-43541: Fix PyEval_EvalCodeEx() regression (pythonGH-24918)  bpo-43244: Fix test_peg_generators on Windows (pythonGH-24913)  bpo-39342: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl module (pythonGH-18011)  bpo-43244: Fix test_peg_generator for PyAST_Validate() (pythonGH-24912)  bpo-42128: Add 'missing :' syntax error message to match statements (pythonGH-24733)  bpo-43244: Add pycore_ast.h header file (pythonGH-24908)  bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (pythonGH-24907)  Remove unnecessary imports in the grammar parser (pythonGH-24904)  bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (pythonGH-24843)  Add PEP 626 to what's new in 3.10. (python#24892)  ...
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ericvsmithericvsmithericvsmith left review comments

@pablogsalpablogsalpablogsal left review comments

@brandtbucherbrandtbucherbrandtbucher left review comments

@isidenticalisidenticalisidentical approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@Kodiologist@the-knights-who-say-ni@isidentical@pablogsal@brandtbucher@miss-islington@bedevere-bot@ericvsmith

[8]ページ先頭

©2009-2025 Movatter.jp