Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
896f4714
Kaydet (Commit)
896f4714
authored
Kas 22, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge branch 3.2
üst
5e8f8104
60b385e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
17 deletions
+22
-17
test_os.py
Lib/test/test_os.py
+9
-0
NEWS
Misc/NEWS
+2
-0
posixmodule.c
Modules/posixmodule.c
+11
-17
No files found.
Lib/test/test_os.py
Dosyayı görüntüle @
896f4714
...
...
@@ -423,6 +423,15 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
value_str
=
value
.
decode
(
sys
.
getfilesystemencoding
(),
'surrogateescape'
)
self
.
assertEqual
(
os
.
environ
[
'bytes'
],
value_str
)
def
test_unset_error
(
self
):
if
sys
.
platform
==
"win32"
:
# an environment variable is limited to 32,767 characters
key
=
'x'
*
50000
else
:
# "=" is not allowed in a variable name
key
=
'key='
self
.
assertRaises
(
OSError
,
os
.
environ
.
__delitem__
,
key
)
class
WalkTests
(
unittest
.
TestCase
):
"""Tests for os.walk()."""
...
...
Misc/NEWS
Dosyayı görüntüle @
896f4714
...
...
@@ -83,6 +83,8 @@ Core and Builtins
Library
-------
- Issue #13415: os.unsetenv() doesn't ignore errors anymore.
- Issue #13322: Fix BufferedWriter.write() to ensure that BlockingIOError is
raised when the wrapped raw file is non-blocking and the write would block.
Previous code assumed that the raw write() would raise BlockingIOError, but
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
896f4714
...
...
@@ -6106,6 +6106,12 @@ posix_putenv(PyObject *self, PyObject *args)
PyBytes_FromStringAndSize does not count that */
#ifdef MS_WINDOWS
len
=
wcslen
(
s1
)
+
wcslen
(
s2
)
+
2
;
if
(
_MAX_ENV
<
(
len
-
1
))
{
PyErr_Format
(
PyExc_ValueError
,
"the environment variable is longer than %u characters"
,
_MAX_ENV
);
goto
error
;
}
newstr
=
PyUnicode_FromUnicode
(
NULL
,
(
int
)
len
-
1
);
#else
len
=
PyBytes_GET_SIZE
(
os1
)
+
PyBytes_GET_SIZE
(
os2
)
+
2
;
...
...
@@ -6177,42 +6183,30 @@ Delete an environment variable.");
static
PyObject
*
posix_unsetenv
(
PyObject
*
self
,
PyObject
*
args
)
{
#ifdef MS_WINDOWS
char
*
s1
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:unsetenv"
,
&
s1
))
return
NULL
;
#else
PyObject
*
os1
;
char
*
s1
;
int
err
;
if
(
!
PyArg_ParseTuple
(
args
,
"O&:unsetenv"
,
PyUnicode_FSConverter
,
&
os1
))
return
NULL
;
s1
=
PyBytes_AsString
(
os1
);
#endif
unsetenv
(
s1
);
err
=
unsetenv
(
s1
);
if
(
err
)
return
posix_error
();
/* Remove the key from posix_putenv_garbage;
* this will cause it to be collected. This has to
* happen after the real unsetenv() call because the
* old value was still accessible until then.
*/
if
(
PyDict_DelItem
(
posix_putenv_garbage
,
#ifdef MS_WINDOWS
PyTuple_GET_ITEM
(
args
,
0
)
#else
os1
#endif
))
{
if
(
PyDict_DelItem
(
posix_putenv_garbage
,
os1
))
{
/* really not much we can do; just leak */
PyErr_Clear
();
}
#ifndef MS_WINDOWS
Py_DECREF
(
os1
);
#endif
Py_RETURN_NONE
;
}
#endif
/* unsetenv */
...
...
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