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
5bffa79c
Kaydet (Commit)
5bffa79c
authored
Şub 24, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
a buffer struct having a NULL data pointer.
üst
1ce92dc2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
0 deletions
+21
-0
test_capi.py
Lib/test/test_capi.py
+2
-0
NEWS
Misc/NEWS
+3
-0
_testcapimodule.c
Modules/_testcapimodule.c
+11
-0
memoryobject.c
Objects/memoryobject.c
+5
-0
No files found.
Lib/test/test_capi.py
Dosyayı görüntüle @
5bffa79c
...
@@ -50,6 +50,8 @@ class CAPITest(unittest.TestCase):
...
@@ -50,6 +50,8 @@ class CAPITest(unittest.TestCase):
b
'Fatal Python error:'
b
'Fatal Python error:'
b
' PyThreadState_Get: no current thread'
)
b
' PyThreadState_Get: no current thread'
)
def
test_memoryview_from_NULL_pointer
(
self
):
self
.
assertRaises
(
ValueError
,
_testcapi
.
make_memoryview_from_NULL_pointer
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
class
TestPendingCalls
(
unittest
.
TestCase
):
class
TestPendingCalls
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
5bffa79c
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
a buffer struct having a NULL data pointer.
- Issue #11272: On Windows, input() strips '
\
r
' (and not only '
\
n
'), and
- Issue #11272: On Windows, input() strips '
\
r
' (and not only '
\
n
'), and
sys.stdin uses universal newline (replace '
\
r
\
n
' by '
\
n
').
sys.stdin uses universal newline (replace '
\
r
\
n
' by '
\
n
').
...
...
Modules/_testcapimodule.c
Dosyayı görüntüle @
5bffa79c
...
@@ -2231,6 +2231,15 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs)
...
@@ -2231,6 +2231,15 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs)
return
PyErr_NewExceptionWithDoc
(
name
,
doc
,
base
,
dict
);
return
PyErr_NewExceptionWithDoc
(
name
,
doc
,
base
,
dict
);
}
}
static
PyObject
*
make_memoryview_from_NULL_pointer
(
PyObject
*
self
)
{
Py_buffer
info
;
if
(
PyBuffer_FillInfo
(
&
info
,
NULL
,
NULL
,
1
,
1
,
PyBUF_FULL_RO
)
<
0
)
return
NULL
;
return
PyMemoryView_FromBuffer
(
&
info
);
}
/* Test that the fatal error from not having a current thread doesn't
/* Test that the fatal error from not having a current thread doesn't
cause an infinite loop. Run via Lib/test/test_capi.py */
cause an infinite loop. Run via Lib/test/test_capi.py */
static
PyObject
*
static
PyObject
*
...
@@ -2326,6 +2335,8 @@ static PyMethodDef TestMethods[] = {
...
@@ -2326,6 +2335,8 @@ static PyMethodDef TestMethods[] = {
{
"code_newempty"
,
code_newempty
,
METH_VARARGS
},
{
"code_newempty"
,
code_newempty
,
METH_VARARGS
},
{
"make_exception_with_doc"
,
(
PyCFunction
)
make_exception_with_doc
,
{
"make_exception_with_doc"
,
(
PyCFunction
)
make_exception_with_doc
,
METH_VARARGS
|
METH_KEYWORDS
},
METH_VARARGS
|
METH_KEYWORDS
},
{
"make_memoryview_from_NULL_pointer"
,
(
PyCFunction
)
make_memoryview_from_NULL_pointer
,
METH_NOARGS
},
{
"crash_no_current_thread"
,
(
PyCFunction
)
crash_no_current_thread
,
METH_NOARGS
},
{
"crash_no_current_thread"
,
(
PyCFunction
)
crash_no_current_thread
,
METH_NOARGS
},
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
...
...
Objects/memoryobject.c
Dosyayı görüntüle @
5bffa79c
...
@@ -75,6 +75,11 @@ PyMemoryView_FromBuffer(Py_buffer *info)
...
@@ -75,6 +75,11 @@ PyMemoryView_FromBuffer(Py_buffer *info)
{
{
PyMemoryViewObject
*
mview
;
PyMemoryViewObject
*
mview
;
if
(
info
->
buf
==
NULL
)
{
PyErr_SetString
(
PyExc_ValueError
,
"cannot make memory view from a buffer with a NULL data pointer"
);
return
NULL
;
}
mview
=
(
PyMemoryViewObject
*
)
mview
=
(
PyMemoryViewObject
*
)
PyObject_GC_New
(
PyMemoryViewObject
,
&
PyMemoryView_Type
);
PyObject_GC_New
(
PyMemoryViewObject
,
&
PyMemoryView_Type
);
if
(
mview
==
NULL
)
if
(
mview
==
NULL
)
...
...
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