-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
posix_spawn explicit file_actions=None throws error #80995
Comments
Allowing posix_spawn file_actions to default to None works, but explicitly setting it throws a TypeError: Python 3.8.0a3 (v3.8.0a3:9a448855b5, Mar 25 2019, 17:05:20)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> os.posix_spawnp('whoami', ['whoami'], os.environ, file_actions=None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: file_actions must be a sequence or None This required me to default to an empty sequence to complete it: >>> os.posix_spawnp('whoami', ['whoami'], os.environ, file_actions=[])
6308 |
Verified on master
Python 3.8.0a3+ (heads/bpo-28367:373c7aa098, May 6 2019, 17:34:39)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> os.posix_spawnp('whoami', ['whoami'], os.environ, file_actions=None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'os' is not defined
>>> import os
>>> os.posix_spawnp('whoami', ['whoami'], os.environ, file_actions=None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: file_actions must be a sequence or None |
Issue is in parse_file_actions parse_file_actions(PyObject *file_actions,
posix_spawn_file_actions_t *file_actionsp,
PyObject *temp_buffer)
{
PyObject *seq;
PyObject *file_action = NULL;
PyObject *tag_obj;
seq = v(file_actions,
"file_actions must be a sequence or None");
if (seq == NULL) {
return -1;
} PySequence_Fast will raise a TypeError if PyObject_GetIter fails. |
Raised a fix in #57353 |
After patch: Python 3.8.0a3+ (heads/31968-dirty:c664b342a4, May 6 2019, 18:06:21)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.posix_spawnp('whoami', ['whoami'], os.environ, file_actions=None)
17300
>>> anthonyshaw |
Matthew Tanous: Oops, I completely missed this case! Thanks for the bug report. Thanks Anthony Shaw for the fix. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: