Issue1287
Created on 2007-10-16 17:55 by niemeyer, last changed 2007-10-26 18:31 by georg.brandl.
|
msg56500 - (view) |
Author: Gustavo Niemeyer (niemeyer) |
Date: 2007-10-16 17:55 |
|
>>> import os
>>> os.system("echo $ASD")
0
>>> os.environ["ASD"] = "asd"
>>> os.system("echo $ASD")
asd
0
>>> os.environ.pop("ASD")
'asd'
>>> os.system("echo $ASD")
asd
0
|
|
msg56505 - (view) |
Author: Raghuram Devarakonda (draghuram) |
Date: 2007-10-16 19:07 |
|
The following patch solves the problem (with the latest from trunk). I
only tested on Linux. I couldn't reproduce the problem with latest py3k
(again, on Linux).
===================================================================
--- Lib/os.py (revision 58221)
+++ Lib/os.py (working copy)
@@ -446,6 +446,9 @@
def __delitem__(self, key):
unsetenv(key)
del self.data[key.upper()]
+ def pop(self, key):
+ unsetenv(key)
+ return UserDict.IterableUserDict.pop(self, key)
def clear(self):
for key in self.data.keys():
unsetenv(key)
@@ -513,6 +516,9 @@
del self.data[key]
def copy(self):
return dict(self)
+ def pop(self, key):
+ unsetenv(key)
+ return UserDict.IterableUserDict.pop(self, key)
environ = _Environ(environ)
|
|
msg56731 - (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2007-10-24 21:41 |
|
Fixed in r58651 for 2.6.
|
|
msg56745 - (view) |
Author: Raghuram Devarakonda (draghuram) |
Date: 2007-10-25 13:54 |
|
After reading the change, I think one more small change may be required.
Index: Lib/os.py
===================================================================
--- Lib/os.py (revision 58654)
+++ Lib/os.py (working copy)
@@ -452,7 +452,7 @@
del self.data[key]
def pop(self, key, *args):
unsetenv(key)
- return self.data.pop(key, *args)
+ return self.data.pop(key.upper(), *args)
def has_key(self, key):
return key.upper() in self.data
def __contains__(self, key):
|
|
msg56807 - (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2007-10-26 18:31 |
|
You're right, fixed that in r58675.
|
|
| Date |
User |
Action |
Args |
| 2007-10-26 18:31:03 | georg.brandl | set | messages:
+ msg56807 |
| 2007-10-25 13:54:58 | draghuram | set | messages:
+ msg56745 |
| 2007-10-24 21:41:24 | georg.brandl | set | status: open -> closed nosy:
+ georg.brandl resolution: fixed messages:
+ msg56731 |
| 2007-10-16 19:07:05 | draghuram | set | nosy:
+ draghuram messages:
+ msg56505 |
| 2007-10-16 17:55:48 | niemeyer | set | messages:
+ msg56500 |
| 2007-10-16 17:55:10 | niemeyer | create | |
|