Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue31471

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:assertion failure in subprocess.Popen() in case the env arg has a bad keys() method
Type:crashStage:resolved
Components:Extension ModulesVersions:Python 3.7, Python 3.6, Python 2.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: Oren Milman, serhiy.storchaka, vstinner
Priority:normalKeywords:patch

Created on2017-09-14 16:42 byOren Milman, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 3580mergedOren Milman,2017-09-14 17:40
PR 3584mergedpython-dev,2017-09-14 19:30
PR 3595mergedOren Milman,2017-09-15 07:09
Messages (10)
msg302181 -(view)Author: Oren Milman (Oren Milman)*Date: 2017-09-14 16:42
The following code causes an assertion failure on Windows:class BadEnv(dict):    keys = Noneimport subprocessimport syssubprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv())this is because getenvironment() (inModules/_winapi.c) calls PyMapping_Values()immediately after calling PyMapping_Keys().calling PyMapping_Values() ultimately leads to calling _PyObject_FastCallDict(),which does 'assert(!PyErr_Occurred());'.thus, in case of an error in PyMapping_Keys(), the assertion fails.
msg302199 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-14 19:30
New changeset0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab by Serhiy Storchaka (Oren Milman) in branch 'master':bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (#3580)https://github.com/python/cpython/commit/0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab
msg302200 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-14 19:32
Is this bug reproducible in 2.7?
msg302203 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-14 19:56
New changesetf135f62cfd1529cbb9326e53728a22afd05b6bc3 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':[3.6]bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3584)https://github.com/python/cpython/commit/f135f62cfd1529cbb9326e53728a22afd05b6bc3
msg302231 -(view)Author: Oren Milman (Oren Milman)*Date: 2017-09-15 04:53
in 2.7 getenvironment() is inPC/_subprocess.c, and it also calls PyMapping_Values()immediately after calling PyMapping_Keys().however, _PyObject_FastCallDict() doesn't exist here.in case of an error in both PyMapping_Keys() and PyMapping_Values(), theerror in PyMapping_Values() just overwrites the error in PyMapping_Keys().but I haven't gone over all of the code that could be run as part ofPyMapping_Values(), so I am not sure whether something could go wrong in case PyMapping_Keys() failed.
msg302235 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-15 06:10
Then I think it is worth to backport the fix to 2.7.
msg302236 -(view)Author: Oren Milman (Oren Milman)*Date: 2017-09-15 06:31
OK.but there isn't an assertion failure to test in 2.7, so is adding a teststill relevant?
msg302237 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-15 06:49
It's on you.
msg302238 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-15 07:20
New changesetc7f165fe652651c32833245fc902c790a4f173fa by Serhiy Storchaka (Oren Milman) in branch '2.7':[2.7]bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595)https://github.com/python/cpython/commit/c7f165fe652651c32833245fc902c790a4f173fa
msg302239 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-09-15 07:20
Thanks Oren!
History
DateUserActionArgs
2022-04-11 14:58:52adminsetgithub: 75652
2017-09-15 07:20:59serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: +msg302239

stage: patch review -> resolved
2017-09-15 07:20:13serhiy.storchakasetmessages: +msg302238
2017-09-15 07:09:47Oren Milmansetpull_requests: +pull_request3586
2017-09-15 06:49:44serhiy.storchakasetmessages: +msg302237
2017-09-15 06:31:04Oren Milmansetmessages: +msg302236
2017-09-15 06:10:27serhiy.storchakasetmessages: +msg302235
versions: + Python 2.7
2017-09-15 04:53:18Oren Milmansetmessages: +msg302231
2017-09-14 19:56:36serhiy.storchakasetmessages: +msg302203
2017-09-14 19:32:06serhiy.storchakasetmessages: +msg302200
versions: + Python 3.6
2017-09-14 19:30:38python-devsetpull_requests: +pull_request3575
2017-09-14 19:30:29serhiy.storchakasetmessages: +msg302199
2017-09-14 17:40:43Oren Milmansetkeywords: +patch
stage: needs patch -> patch review
pull_requests: +pull_request3570
2017-09-14 16:54:52serhiy.storchakasetstage: needs patch
2017-09-14 16:47:41vstinnersetnosy: +vstinner,serhiy.storchaka
2017-09-14 16:42:10Oren Milmancreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp