FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-17422:language reference should specify restrictions on class namespace by ananthan-123 · Pull Request #18559 · python/cpython · GitHub

Repository navigation

bpo-17422:language reference should specify restrictions on class namespace - #18559

Merged
gvanrossum merged 12 commits into
python:masterfrom
ananthan-123:namespace
Feb 22, 2020
Merged

gvanrossum merged 12 commits into
python:masterfrom
ananthan-123:namespace

Conversation

ananthan-123 commented Feb 19, 2020 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

brandtbucher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @ananthan-123. No need to request reviews from 3 triagers and 4 core developers though, that's bordering on spam (especially if they have nothing to do with the issue/patch). One request should be fine, maybe a second if the first person doesn't respond after a week or two.

A few things I spotted here (I'm assuming that the wording in Eric's original patch from 7 years ago is correct):

Comment thread Doc/reference/datamodel.rst Outdated

brandtbucher left a comment •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good now. @ericsnowcurrently, care to review the content for this? It's your issue.

brandtbucher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry, one more thing...

…7_9zz.rst

Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
@@ -0,0 +1 @@
Language reference should specify restrictions on class namespace.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please attribute the patch to its author here.

gvanrossum merged commit fbe2e0b into python:master Feb 22, 2020

Copy link
Copy Markdown

@gvanrossum: Please replace # with GH- in the commit message next time. Thanks!

Copy link
Copy Markdown
Contributor

Thanks @ananthan-123 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

Copy link
Copy Markdown
Contributor

Thanks @ananthan-123 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

Copy link
Copy Markdown

GH-18610 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 22, 2020
…mespace (pythonGH-18559)

The language reference now specifies restrictions on class namespaces.  Adapted from a patch by Ethan Furman.
(cherry picked from commit fbe2e0b)

Co-authored-by: ananthan-123 <ananthakrishnan15.2001@gmail.com>

Copy link
Copy Markdown

GH-18611 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Feb 22, 2020
…mespace (GH-18559)

The language reference now specifies restrictions on class namespaces.  Adapted from a patch by Ethan Furman.
(cherry picked from commit fbe2e0b)

Co-authored-by: ananthan-123 <ananthakrishnan15.2001@gmail.com>
miss-islington added a commit that referenced this pull request Feb 22, 2020
…mespace (GH-18559)

The language reference now specifies restrictions on class namespaces.  Adapted from a patch by Ethan Furman.
(cherry picked from commit fbe2e0b)

Co-authored-by: ananthan-123 <ananthakrishnan15.2001@gmail.com>
the final class object is created the namespace is copied into a new ``dict``.

If the metaclass has no ``__prepare__`` attribute, then the class namespace
is initialised as an empty ordered mapping.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Per PEP 520, the default class namespace must be an ordered mapping and the original text here was purposefully phrased. While we've talked about requiring "dict" to be ordered (in the language reference), that hasn't happened. So changing the language spec text here to "dict" is inappropriate without a PEP. Note that elsewhere in the language reference the "ordered mapping" phrasing still exists.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Um, dict is required to be ordered. Since 3.7. See the 3.7. what's new doc "the insertion-order preservation nature of dict objects has been declared to be an official part of the Python language spec."

If after that has sunk in you still think this PR is wrong, please submit a new PR to fix it! (Sorry for landing prematurely.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Per my comment on the bpo I think @ericsnowcurrently is right but for the wrong reasons. I have opened a PR correcting the wording. #18682

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL