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 — inspect.dir_static · Issue #55979 · python/cpython

inspect.dir_static #55979

New issue
Copy link
New issue
Copy link
Open
Open
inspect.dir_static#55979
Copy link
Assignees
voidspace
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@voidspace
voidspace
opened on Apr 5, 2011
Issue body actions
BPO 11770
Nosy @merwok, @voidspace, @Trundle, @durban, @PCManticore
Files
  • issue11770.patch
  • 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 = 'https://github.com/voidspace'
    closed_at = None
    created_at = <Date 2011-04-05.11:08:55.202>
    labels = ['type-feature', 'library']
    title = 'inspect.dir_static'
    updated_at = <Date 2014-01-29.06:44:33.488>
    user = 'https://github.com/voidspace'

    bugs.python.org fields:

    activity = <Date 2014-01-29.06:44:33.488>
    actor = 'Claudiu.Popa'
    assignee = 'michael.foord'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2011-04-05.11:08:55.202>
    creator = 'michael.foord'
    dependencies = []
    files = ['21591']
    hgrepos = []
    issue_num = 11770
    keywords = ['patch']
    message_count = 6.0
    messages = ['133017', '133320', '133322', '133372', '133382', '133434']
    nosy_count = 5.0
    nosy_names = ['eric.araujo', 'michael.foord', 'Trundle', 'daniel.urban', 'Claudiu.Popa']
    pr_nums = []
    priority = 'low'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue11770'
    versions = ['Python 3.5']

    Activity

    1. voidspace commented on Apr 5, 2011

      @voidspace
      voidspace
      on Apr 5, 2011
      ContributorAuthor
      More actions

      A version of dir that returns all the members that can be seen by getattr_static.

    2. voidspace
      added
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Apr 5, 2011
    3. voidspace
      self-assigned this
      on Apr 5, 2011
    4. voidspace
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Apr 5, 2011
    5. merwok commented on Apr 8, 2011

      @merwok
      merwok
      on Apr 8, 2011
      Member
      More actions

      Would it respect __dir__?

    6. voidspace commented on Apr 8, 2011

      @voidspace
      voidspace
      on Apr 8, 2011
      ContributorAuthor
      More actions

      No. It would return all members accessible to getattr_static (which is completely unrelated to what __dir__ may or may not return). Also calling __dir__ would mean code execution, and the point of these functions is to avoid this where possible.

    7. Trundle commented on Apr 9, 2011

      @Trundle
      Trundlemannequin
      on Apr 9, 2011
      Mannequin
      More actions

      A first patch, misses any documentation changes. While working on it, I realised that modules technically shadow the dict attribute (because modules use tp_dictoffset, hence module have a dict member that points to the instance dict). I updated _shadowed_dict() so that it now disregards member descriptors as shadowing (as they will never trigger any code execution), but theoretically, the members can be any object (not just dicts), so I have to think a bit more about that case (as a custom object still can trigger code execution).

      Also, dir_static() behaves slightly different from dir() (e.g. dir() raises a TypeError if the module's "dict" attribute isn't a dictionary, which is kind of impossible for dir_static as it doesn't even try to acccess __dict__ if it is shadowed), but IMHO such edge-cases are expected to behave differently for a static version and hence we don't care at all about that.

    8. voidspace commented on Apr 9, 2011

      @voidspace
      voidspace
      on Apr 9, 2011
      ContributorAuthor
      More actions

      Thanks for the patch Andreas. On a quick read through it looks good. I'll do a proper review shortly.

    9. Trundle commented on Apr 9, 2011

      @Trundle
      Trundlemannequin
      on Apr 9, 2011
      Mannequin
      More actions

      See issue bpo-11813 for the module problem.

    10. pitrou
      added
      type-featureA feature request or enhancementA feature request or enhancement
      and removed
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Jul 15, 2011
    11. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    12. serhiy-storchaka
      added this to Inspect issues 🔍on Mar 5, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @voidspace
      voidspace

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • Inspect issues 🔍
      Status
      No status
      Show more project fields

    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.