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
ee58fa48
Kaydet (Commit)
ee58fa48
authored
Agu 19, 2008
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#3560: cleanup C memoryview API
üst
fd036451
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
18 deletions
+30
-18
memoryobject.h
Include/memoryobject.h
+19
-13
NEWS
Misc/NEWS
+6
-0
_json.c
Modules/_json.c
+1
-1
memoryobject.c
Objects/memoryobject.c
+3
-3
unicodeobject.c
Objects/unicodeobject.c
+1
-1
No files found.
Include/memoryobject.h
Dosyayı görüntüle @
ee58fa48
/* Memory object interface */
/* Memory view object. In Python this is available as "memoryview". */
#ifndef Py_MEMORYOBJECT_H
#define Py_MEMORYOBJECT_H
...
...
@@ -7,19 +6,15 @@
extern
"C"
{
#endif
typedef
struct
{
PyObject_HEAD
PyObject
*
base
;
Py_buffer
view
;
}
PyMemoryViewObject
;
PyAPI_DATA
(
PyTypeObject
)
PyMemoryView_Type
;
#define PyMemory_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
#define PyMemoryView(op) (((PyMemoryViewObject *)(op))->view)
#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
/* Get a pointer to the underlying Py_buffer of a memoryview object. */
#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
/* Get a pointer to the PyObject from which originates a memoryview object. */
#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
#define Py_END_OF_MEMORY (-1)
PyAPI_FUNC
(
PyObject
*
)
PyMemoryView_GetContiguous
(
PyObject
*
base
,
int
buffertype
,
...
...
@@ -58,10 +53,21 @@ PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
PyAPI_FUNC
(
PyObject
*
)
PyMemoryView_FromObject
(
PyObject
*
base
);
PyAPI_FUNC
(
PyObject
*
)
PyMemoryView_From
Memory
(
Py_buffer
*
info
);
PyAPI_FUNC
(
PyObject
*
)
PyMemoryView_From
Buffer
(
Py_buffer
*
info
);
/* create new if bufptr is NULL
will be a new bytesobject in base */
/* The struct is declared here so that macros can work, but it shouldn't
be considered public. Don't access those fields directly, use the macros
and functions instead! */
typedef
struct
{
PyObject_HEAD
PyObject
*
base
;
Py_buffer
view
;
}
PyMemoryViewObject
;
#ifdef __cplusplus
}
#endif
...
...
Misc/NEWS
Dosyayı görüntüle @
ee58fa48
...
...
@@ -12,6 +12,12 @@ What's new in Python 3.0b3?
Core and Builtins
-----------------
- Issue #3560: clean up the new C PyMemoryView API so that naming is
internally consistent; add macros PyMemoryView_GET_BASE() and
PyMemoryView_GET_BUFFER() to access useful properties of a memory views
without relying on a particular implementation; remove the ill-named
PyMemoryView() function (PyMemoryView_GET_BUFFER() can be used instead).
- Issue #1819: function calls with several named parameters are now on
average 35% faster (as measured by pybench).
...
...
Modules/_json.c
Dosyayı görüntüle @
ee58fa48
...
...
@@ -264,7 +264,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict)
if
(
PyBuffer_FillInfo
(
&
info
,
NULL
,
&
buf
[
end
],
next
-
end
,
1
,
0
)
<
0
)
{
goto
bail
;
}
strchunk
=
PyMemoryView_From
Memory
(
&
info
);
strchunk
=
PyMemoryView_From
Buffer
(
&
info
);
if
(
strchunk
==
NULL
)
{
goto
bail
;
}
...
...
Objects/memoryobject.c
Dosyayı görüntüle @
ee58fa48
...
...
@@ -29,7 +29,7 @@ PyDoc_STRVAR(memory_doc,
Create a new memoryview object which references the given object."
);
PyObject
*
PyMemoryView_From
Memory
(
Py_buffer
*
info
)
PyMemoryView_From
Buffer
(
Py_buffer
*
info
)
{
PyMemoryViewObject
*
mview
;
...
...
@@ -231,7 +231,7 @@ PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char fort)
mem
=
PyObject_New
(
PyMemoryViewObject
,
&
PyMemoryView_Type
);
if
(
mem
==
NULL
)
return
NULL
;
view
=
&
PyMemoryView
(
mem
)
;
view
=
&
mem
->
view
;
flags
=
PyBUF_FULL_RO
;
switch
(
buffertype
)
{
case
PyBUF_WRITE
:
...
...
@@ -534,7 +534,7 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
/* XXX: This needs to be fixed so it
actually returns a sub-view
*/
return
PyMemoryView_From
Memory
(
&
newview
);
return
PyMemoryView_From
Buffer
(
&
newview
);
}
}
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
ee58fa48
...
...
@@ -1200,7 +1200,7 @@ PyObject *PyUnicode_Decode(const char *s,
buffer
=
NULL
;
if
(
PyBuffer_FillInfo
(
&
info
,
NULL
,
(
void
*
)
s
,
size
,
1
,
PyBUF_SIMPLE
)
<
0
)
goto
onError
;
buffer = PyMemoryView_From
Memory
(&info);
buffer
=
PyMemoryView_From
Buffer
(
&
info
);
if
(
buffer
==
NULL
)
goto
onError
;
unicode
=
PyCodec_Decode
(
buffer
,
encoding
,
errors
);
...
...
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