mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-111841: Fix os.putenv() and os.unsetenv() with embedded NUL on Windows (GH-111842) (GH-111967)
(cherry picked from commit 0b06d2482d
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
7b55a955bc
commit
cd3e2d3a6c
4 changed files with 19 additions and 9 deletions
|
@ -1011,20 +1011,20 @@ class PosixTester(unittest.TestCase):
|
|||
self.assertEqual(type(k), item_type)
|
||||
self.assertEqual(type(v), item_type)
|
||||
|
||||
@unittest.skipUnless(os.name == 'posix', "see bug gh-111841")
|
||||
def test_putenv(self):
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv('FRUIT\0VEGETABLE', 'cabbage')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv(b'FRUIT\0VEGETABLE', b'cabbage')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv('FRUIT', 'orange\0VEGETABLE=cabbage')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv(b'FRUIT', b'orange\0VEGETABLE=cabbage')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv('FRUIT=ORANGE', 'lemon')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv(b'FRUIT=ORANGE', b'lemon')
|
||||
if os.name == 'posix':
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv(b'FRUIT\0VEGETABLE', b'cabbage')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv(b'FRUIT', b'orange\0VEGETABLE=cabbage')
|
||||
with self.assertRaises(ValueError):
|
||||
os.putenv(b'FRUIT=ORANGE', b'lemon')
|
||||
|
||||
@unittest.skipUnless(hasattr(posix, 'getcwd'), 'test needs posix.getcwd()')
|
||||
def test_getcwd_long_pathnames(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue