GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field · Issue #80536 · python/cpython

Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field #80536

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field#80536
Copy link
Labels
3.8 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc dirextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)

Description

MojoVampire
mannequin
opened on Mar 18, 2019
Issue body actions
BPO 36355
Nosy @matrixise, @MojoVampire

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2019-03-18.19:18:19.243>
labels = ['extension-modules', 'interpreter-core', '3.8', 'docs']
title = "Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field"
updated_at = <Date 2019-03-21.00:25:24.928>
user = 'https://github.com/MojoVampire'

bugs.python.org fields:

activity = <Date 2019-03-21.00:25:24.928>
actor = 'josh.r'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Extension Modules', 'Interpreter Core']
creation = <Date 2019-03-18.19:18:19.243>
creator = 'josh.r'
dependencies = []
files = []
hgrepos = []
issue_num = 36355
keywords = []
message_count = 5.0
messages = ['338282', '338283', '338455', '338517', '338518']
nosy_count = 3.0
nosy_names = ['docs@python', 'matrixise', 'josh.r']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue36355'
versions = ['Python 3.8']

Activity

  1. MojoVampire commented on Mar 18, 2019

    @MojoVampire
    MojoVampiremannequin
    on Mar 18, 2019
    MannequinAuthor
    More actions

    While looking up background info for bpo-36347, I noticed that the docs for PyMemberDef ( https://docs.python.org/3/extending/newtypes.html#generic-attribute-management ) define the following flags:

    • READONLY
    • READ_RESTRICTED
    • WRITE_RESTRICTED
    • RESTRICTED

    Of those, WRITE_RESTRICTED has been documented incorrectly since Python 3.0a2 (it got renamed to PY_WRITE_RESTRICTED in structmember.h, apparently due to a name clash with VS 2008 on Windows).

    Luckily, the constants are useless; AFAICT they were there solely to support restricted mode (via the rexec and Bastion modules). The modules were apparently disabled in Python 2.3 "due to various known and not readily fixable security holes" ( https://docs.python.org/2/library/restricted.html ), and the modules themselves officially deprecated in 2.6, and removed completely in 3.0.

    Rather than fixing up the docs, maybe it's time to kill these constants for good? Probably shouldn't remove the definitions in structmember.h (if someone wrote code using them, we shouldn't needlessly break compilation), but the interpreter and standard library should stop setting them, and the documentation for them should be removed.

  2. MojoVampire
    added
    3.8 (EOL)end of lifeend of life
    on Mar 18, 2019
  3. MojoVampire
    assigned
    docspython
    on Mar 18, 2019
  4. MojoVampire
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Mar 18, 2019
  5. MojoVampire commented on Mar 18, 2019

    @MojoVampire
    MojoVampiremannequin
    on Mar 18, 2019
    MannequinAuthor
    More actions

    To be clear, only the constants that include the substring RESTRICTED are useless; READONLY remains useful and should not be removed (though per my suggestion on bpo-36347, it might be good to add an alias for it named PY_READONLY to match the Python C API naming conventions).

  6. MojoVampire
    changed the title [-]Remove documentation and internal use of the RESTRICTED constants for PyMemberDef's flags field[/-] [+]Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field[/+] on Mar 18, 2019
  7. matrixise commented on Mar 20, 2019

    @matrixise
    matrixise
    on Mar 20, 2019
    Member
    More actions

    Josh, I don't know for the uselessness or not of these macros, but these macros are used.

    RESTRICTED is used in Objects/classobject.c and Objects/funcobject.c

    PY_WRITE_RESTRICTED is used in Objects/funcobject.c and Objects/methodobject.c

  8. MojoVampire commented on Mar 21, 2019

    @MojoVampire
    MojoVampiremannequin
    on Mar 21, 2019
    MannequinAuthor
    More actions

    Yes, they're set. They're never *read* anywhere. My suggestion was to stop setting them (because it gives the impression they do something when reading the docs, when in fact they do nothing), and remove them from the docs.

  9. MojoVampire commented on Mar 21, 2019

    @MojoVampire
    MojoVampiremannequin
    on Mar 21, 2019
    MannequinAuthor
    More actions

    Sorry, that should have been "it gives the impression they do something when reading the *source code*"

  10. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  11. iritkatriel commented on Feb 18, 2023

    @iritkatriel
    iritkatriel
    on Feb 18, 2023
    Member
    More actions

    This is out of date, see #99014.

  12. iritkatriel
    closed this as not plannedon Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.8 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc dirextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.