You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Py_GetArgcArgv() is no longer exported by the C API #85087
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=Noneclosed_at=<Date2020-06-08.17:26:53.015>created_at=<Date2020-06-08.13:22:42.062>labels= ['expert-C-API', '3.9', '3.10']
title='Py_GetArgcArgv() is no longer exported by the C API'updated_at=<Date2020-06-15.15:19:10.261>user='https://github.com/vstinner'
Python 3.9 is now built with -fvisibility=hidden. The Py_GetArgcArgv() function is no longer exported. Previously, it was exported because all symbols were exported by default.
"""
setproctitle is quite stable, my company uses it in production environment very heavily with python 2.x. Probably its users base is not huge, but that's because it's a relatively specialized tool.
Python3 porting is not straightforward because python2 exports the original argv pointer using Py_GetArgcArgv() whereas python3 only exports a decoded version in a wchar_t* array. This may not be a showstopper: probably the original argv can still be found scanning backwards from environ: I want to test it but I haven't had requests for it yet, so it wasn't a top priority.
So, while I'd be pleased to have it included in the stdlib, I'm not really convinced it would be useful to such a large audience. Anyway I'm available for any improvement it would make the tool more useful and to anybody eager to push for its inclusion.
"""
Py_GetArgcArgv() is not new at all. It exists since:
commit ac56b03
Author: Guido van Rossum <guido@python.org>
Date: Sun Jul 21 02:33:38 1996 +0000
New style names for getprogramname and getargcargv
Previously, the function was known as getargcargv() and it existed since:
commit 7b1e974
Author: Guido van Rossum <guido@python.org>
Date: Mon Aug 29 10:46:42 1994 +0000
Makefile.pre.in: add $(OPT) to link command
audioop.c: fix for MPW
config.c.in: save original argc/argv for Lance
rotormodule.c: new coding conventions
timemodule.c: add casts for Lance
Activity
vstinner commentedon Jun 8, 2020
Python 3.9 is now built with -fvisibility=hidden. The Py_GetArgcArgv() function is no longer exported. Previously, it was exported because all symbols were exported by default.
I'm working on a PR to export it again.
Fedora downstream issue, setproctitle is broken on Python 3.9: https://bugzilla.redhat.com/show_bug.cgi?id=1792059
vstinner commentedon Jun 8, 2020
setproctitle upstream report:
dvarrazzo/py-setproctitle#76
vstinner commentedon Jun 8, 2020
See also bpo-15577 "Real argc and argv in embedded interpreter".
vstinner commentedon Jun 8, 2020
See also bpo-5672 "Implement a way to change the python process name", especially this comment:
https://bugs.python.org/issue5672#msg108524
"""
setproctitle is quite stable, my company uses it in production environment very heavily with python 2.x. Probably its users base is not huge, but that's because it's a relatively specialized tool.
Python3 porting is not straightforward because python2 exports the original argv pointer using Py_GetArgcArgv() whereas python3 only exports a decoded version in a wchar_t* array. This may not be a showstopper: probably the original argv can still be found scanning backwards from environ: I want to test it but I haven't had requests for it yet, so it wasn't a top priority.
So, while I'd be pleased to have it included in the stdlib, I'm not really convinced it would be useful to such a large audience. Anyway I'm available for any improvement it would make the tool more useful and to anybody eager to push for its inclusion.
"""
vstinner commentedon Jun 8, 2020
See also bpo-29857: Provide
sys.executable_argvfor host application's command line arguments.vstinner commentedon Jun 8, 2020
See also bpo-23427 "Python should expose command when invoked with -c"
dvarrazzo commentedon Jun 8, 2020
Thank you for opening this. FYI:
this is how the module works indeed in Python 3.
vstinner commentedon Jun 8, 2020
New changeset e81f6e6 by Victor Stinner in branch 'master':
bpo-40910: Export Py_GetArgcArgv() function (GH-20721)
e81f6e6
vstinner commentedon Jun 8, 2020
Py_GetArgcArgv() is not new at all. It exists since:
commit ac56b03
Author: Guido van Rossum <guido@python.org>
Date: Sun Jul 21 02:33:38 1996 +0000
Previously, the function was known as getargcargv() and it existed since:
commit 7b1e974
Author: Guido van Rossum <guido@python.org>
Date: Mon Aug 29 10:46:42 1994 +0000
+void
+getargcargv(argc,argv)
+ int *argc;
+ char ***argv;
+{
+ *argc = orig_argc;
+ *argv = orig_argv;
+}
+
vstinner commentedon Jun 8, 2020
New changeset dedaac0 by Victor Stinner in branch '3.9':
bpo-40910: Export Py_GetArgcArgv() function (GH-20721) (GH-20723)
dedaac0
vstinner commentedon Jun 8, 2020
Ok, I fixed Python 3.9: Py_GetArgcArgv() function is exported again.
Let's continue the discussion in bpo-23427.
vstinner commentedon Jun 15, 2020
New changeset e2d47a0 by Victor Stinner in branch 'master':
bpo-40910: PyConfig_Clear() clears _orig_argv (GH-20886)
e2d47a0
miss-islington commentedon Jun 15, 2020
New changeset bab0833 by Miss Islington (bot) in branch '3.9':
bpo-40910: PyConfig_Clear() clears _orig_argv (GH-20886)
bab0833