8000 Add ability to set python module file string instead of it always being None · Issue #2043 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

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

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bmello4688 opened this issue Dec 8, 2022 · 3 comments

Comments

@bmello4688
Copy link
Contributor

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.

@filmor
Copy link
Member
filmor commented Dec 8, 2022

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

@filmor filmor closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2022
@filmor filmor reopened this Dec 8, 2022
@filmor
Copy link
Member
filmor commented Dec 8, 2022

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

@bmello4688
Copy link
Contributor Author
bmello4688 commented Dec 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0