Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
165f26c3
Commit
165f26c3
authored
Feb 17, 2005
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using items() in environ.update(). Fixes #1124513.
Will backport to 2.4.
parent
8b44fb78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
Lib/os.py
Lib/os.py
+18
-8
Lib/test/test_os.py
Lib/test/test_os.py
+1
-1
No files found.
Lib/os.py
View file @
165f26c3
...
...
@@ -445,12 +445,17 @@ else:
def
update
(
self
,
dict
=
None
,
**
kwargs
):
if
dict
:
try
:
items
=
dict
.
item
s
()
keys
=
dict
.
key
s
()
except
AttributeError
:
# List of (key, value)
items
=
dict
for
k
,
v
in
items
:
for
k
,
v
in
dict
:
self
[
k
]
=
v
else
:
# got keys
# cannot use items(), since mappings
# may not have them.
for
k
in
keys
:
self
[
k
]
=
dict
[
k
]
if
kwargs
:
self
.
update
(
kwargs
)
def
copy
(
self
):
...
...
@@ -467,12 +472,17 @@ else:
def
update
(
self
,
dict
=
None
,
**
kwargs
):
if
dict
:
try
:
items
=
dict
.
item
s
()
keys
=
dict
.
key
s
()
except
AttributeError
:
# List of (key, value)
items
=
dict
for
k
,
v
in
items
:
for
k
,
v
in
dict
:
self
[
k
]
=
v
else
:
# got keys
# cannot use items(), since mappings
# may not have them.
for
k
in
keys
:
self
[
k
]
=
dict
[
k
]
if
kwargs
:
self
.
update
(
kwargs
)
try
:
...
...
Lib/test/test_os.py
View file @
165f26c3
...
...
@@ -227,7 +227,7 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
os
.
environ
.
update
(
self
.
__save
)
# Bug 1110478
def
test_update
(
self
):
def
test_update
2
(
self
):
if
os
.
path
.
exists
(
"/bin/sh"
):
os
.
environ
.
update
(
HELLO
=
"World"
)
value
=
os
.
popen
(
"/bin/sh -c 'echo $HELLO'"
).
read
().
strip
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment