← 输入框|github.com|刷新
Skip to content

Add ability to set python module file string instead of it always being None #2043

Open

Description

@bmello4688

Environment

  • Pythonnet version: Latest
  • Python version: 3.7+
  • Operating System: All
  • .NET Runtime: All

Details

  • Describe what you were trying to get done.

    When creating a python module from a string (PyModule FromString) the file parameter is always set to None. If I want to create a virtual package structure in memory I need to be able to set file to a specified file structure.

Activity

  1. filmor commented on Dec 8, 2022

    @filmor
    Member

    You have to set it yourself, that's how it works in the C-API as well: https://docs.python.org/3/c-api/module.html#c.PyModule_NewObject

  2. reopened this on Dec 8, 2022
  3. filmor commented on Dec 8, 2022

    @filmor
    Member

    Sorry, I just saw your PR (#2044), is this not the same as just setting __file__ explicitly on the PyModule object?

  4. bmello4688 commented on Dec 8, 2022

    @bmello4688
    ContributorAuthor
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions