Skip to content
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

Overloading "Py_GetPath" does not work #75926

Closed
kayhayen mannequin opened this issue Oct 10, 2017 · 2 comments
Closed

Overloading "Py_GetPath" does not work #75926

kayhayen mannequin opened this issue Oct 10, 2017 · 2 comments
Labels
3.8 only security fixes build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@kayhayen
Copy link
Mannequin

kayhayen mannequin commented Oct 10, 2017

BPO 31745
Nosy @vstinner

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 = <Date 2019-05-27.15:17:12.715>
created_at = <Date 2017-10-10.14:08:15.684>
labels = ['type-bug', '3.8', 'build']
title = 'Overloading "Py_GetPath" does not work'
updated_at = <Date 2019-05-27.15:17:12.713>
user = 'https://bugs.python.org/kayhayen'

bugs.python.org fields:

activity = <Date 2019-05-27.15:17:12.713>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2019-05-27.15:17:12.715>
closer = 'vstinner'
components = ['Build']
creation = <Date 2017-10-10.14:08:15.684>
creator = 'kayhayen'
dependencies = []
files = []
hgrepos = []
issue_num = 31745
keywords = []
message_count = 2.0
messages = ['304045', '343643']
nosy_count = 2.0
nosy_names = ['vstinner', 'kayhayen']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue31745'
versions = ['Python 3.8']

@kayhayen
Copy link
Mannequin Author

kayhayen mannequin commented Oct 10, 2017

Hello,

for my Python compiler Nuitka, I want to make sure that compiled binaries in standalone mode do not access the original installation, but solely the distribution folder created.

I am using the new API Py_SetPath on Python3 and it works fine. The Python2.7 documentation of the C-API however says:

The embedding application can steer the search by calling Py_SetProgramName(file) before calling Py_Initialize(). Note that PYTHONHOME still overrides this and PYTHONPATH is still inserted in front of the standard path. An application that requires total control has to provide its own implementation of Py_GetPath(), Py_GetPrefix(), Py_GetExecPrefix(), and Py_GetProgramFullPath() (all defined in Modules/getpath.c).

My attempts at overloading this have badly failed, because of conflicting "declspec" (dllimport vs dllexport). And when defining Py_GetPath away before making the include, so the conflict is not seen by the MSVC compiler, the result is that the function is not called.
Is this known to work? Can you point me to a working example, because my searches didn't reveal anything. Not normal web search, nor global code search for Py_GetPath code.

I did not try on Linux yet. I am assuming it might work, I just wanted to tap on knowledge on your side. Is it feasible. For Linux? For Windows?

Thanks,
Kay Hayen

@kayhayen kayhayen mannequin added build The build process and cross-build type-bug An unexpected behavior, bug, or error labels Oct 10, 2017
@vstinner
Copy link
Member

If I understood correctly, this issue has been fixed by the PEP-587 "Python Initialization Configuration" in bpo-36763 which now provides a more reliable way to configure the "Path Configuration". I close the issue.

If I misunderstood the issue, please reopen it.

@vstinner vstinner added the 3.8 only security fixes label May 27, 2019
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant