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
b803c517
Kaydet (Commit)
b803c517
authored
Agu 20, 2007
tarafından
Travis E. Oliphant
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix memory leak in arraymodule.c and respond to a few comments by nnorwitz.
üst
30d1c51a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
23 deletions
+19
-23
object.h
Include/object.h
+3
-2
arraymodule.c
Modules/arraymodule.c
+16
-20
bufferobject.c
Objects/bufferobject.c
+0
-1
No files found.
Include/object.h
Dosyayı görüntüle @
b803c517
...
@@ -145,9 +145,10 @@ typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
...
@@ -145,9 +145,10 @@ typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
typedef
struct
bufferinfo
{
typedef
struct
bufferinfo
{
void
*
buf
;
void
*
buf
;
Py_ssize_t
len
;
Py_ssize_t
len
;
Py_ssize_t
itemsize
;
Py_ssize_t
itemsize
;
/* This is Py_ssize_t so it can be
pointed to by strides in simple case.*/
int
readonly
;
int
readonly
;
int
ndim
;
/* XXX(nnorwitz): should be Py_ssize_t??? */
int
ndim
;
char
*
format
;
char
*
format
;
Py_ssize_t
*
shape
;
Py_ssize_t
*
shape
;
Py_ssize_t
*
strides
;
Py_ssize_t
*
strides
;
...
...
Modules/arraymodule.c
Dosyayı görüntüle @
b803c517
...
@@ -26,7 +26,7 @@ struct arraydescr {
...
@@ -26,7 +26,7 @@ struct arraydescr {
int
itemsize
;
int
itemsize
;
PyObject
*
(
*
getitem
)(
struct
arrayobject
*
,
Py_ssize_t
);
PyObject
*
(
*
getitem
)(
struct
arrayobject
*
,
Py_ssize_t
);
int
(
*
setitem
)(
struct
arrayobject
*
,
Py_ssize_t
,
PyObject
*
);
int
(
*
setitem
)(
struct
arrayobject
*
,
Py_ssize_t
,
PyObject
*
);
c
onst
c
har
*
formats
;
char
*
formats
;
};
};
typedef
struct
arrayobject
{
typedef
struct
arrayobject
{
...
@@ -42,8 +42,10 @@ static PyTypeObject Arraytype;
...
@@ -42,8 +42,10 @@ static PyTypeObject Arraytype;
#ifdef Py_UNICODE_WIDE
#ifdef Py_UNICODE_WIDE
#define PyArr_UNI 'w'
#define PyArr_UNI 'w'
#define PyArr_UNISTR "w"
#else
#else
#define PyArr_UNI 'u'
#define PyArr_UNI 'u'
#define PyArr_UNISTR "u"
#endif
#endif
#define array_Check(op) PyObject_TypeCheck(op, &Arraytype)
#define array_Check(op) PyObject_TypeCheck(op, &Arraytype)
...
@@ -387,18 +389,18 @@ d_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
...
@@ -387,18 +389,18 @@ d_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
/* Description of types */
/* Description of types */
static
struct
arraydescr
descriptors
[]
=
{
static
struct
arraydescr
descriptors
[]
=
{
{
'b'
,
sizeof
(
char
),
b_getitem
,
b_setitem
},
{
'b'
,
sizeof
(
char
),
b_getitem
,
b_setitem
,
"b"
},
{
'B'
,
sizeof
(
char
),
BB_getitem
,
BB_setitem
},
{
'B'
,
sizeof
(
char
),
BB_getitem
,
BB_setitem
,
"B"
},
{
PyArr_UNI
,
sizeof
(
Py_UNICODE
),
u_getitem
,
u_setitem
},
{
PyArr_UNI
,
sizeof
(
Py_UNICODE
),
u_getitem
,
u_setitem
,
PyArr_UNISTR
},
{
'h'
,
sizeof
(
short
),
h_getitem
,
h_setitem
},
{
'h'
,
sizeof
(
short
),
h_getitem
,
h_setitem
,
"h"
},
{
'H'
,
sizeof
(
short
),
HH_getitem
,
HH_setitem
},
{
'H'
,
sizeof
(
short
),
HH_getitem
,
HH_setitem
,
"H"
},
{
'i'
,
sizeof
(
int
),
i_getitem
,
i_setitem
},
{
'i'
,
sizeof
(
int
),
i_getitem
,
i_setitem
,
"i"
},
{
'I'
,
sizeof
(
int
),
II_getitem
,
II_setitem
},
{
'I'
,
sizeof
(
int
),
II_getitem
,
II_setitem
,
"I"
},
{
'l'
,
sizeof
(
long
),
l_getitem
,
l_setitem
},
{
'l'
,
sizeof
(
long
),
l_getitem
,
l_setitem
,
"l"
},
{
'L'
,
sizeof
(
long
),
LL_getitem
,
LL_setitem
},
{
'L'
,
sizeof
(
long
),
LL_getitem
,
LL_setitem
,
"L"
},
{
'f'
,
sizeof
(
float
),
f_getitem
,
f_setitem
},
{
'f'
,
sizeof
(
float
),
f_getitem
,
f_setitem
,
"f"
},
{
'd'
,
sizeof
(
double
),
d_getitem
,
d_setitem
},
{
'd'
,
sizeof
(
double
),
d_getitem
,
d_setitem
,
"d"
},
{
'\0'
,
0
,
0
,
0
}
/* Sentinel */
{
'\0'
,
0
,
0
,
0
,
0
}
/* Sentinel */
};
};
/****************************************************************************
/****************************************************************************
...
@@ -1770,12 +1772,7 @@ array_buffer_getbuf(arrayobject *self, PyBuffer *view, int flags)
...
@@ -1770,12 +1772,7 @@ array_buffer_getbuf(arrayobject *self, PyBuffer *view, int flags)
view
->
format
=
NULL
;
view
->
format
=
NULL
;
view
->
internal
=
NULL
;
view
->
internal
=
NULL
;
if
((
flags
&
PyBUF_FORMAT
)
==
PyBUF_FORMAT
)
{
if
((
flags
&
PyBUF_FORMAT
)
==
PyBUF_FORMAT
)
{
view
->
internal
=
malloc
(
3
);
view
->
format
=
self
->
ob_descr
->
formats
;
/* XXX(nnorwitz): need to check for malloc failure.
Should probably use PyObject_Malloc. */
view
->
format
=
view
->
internal
;
view
->
format
[
0
]
=
(
char
)(
self
->
ob_descr
->
typecode
);
view
->
format
[
1
]
=
'\0'
;
}
}
finish:
finish:
...
@@ -1786,7 +1783,6 @@ array_buffer_getbuf(arrayobject *self, PyBuffer *view, int flags)
...
@@ -1786,7 +1783,6 @@ array_buffer_getbuf(arrayobject *self, PyBuffer *view, int flags)
static
void
static
void
array_buffer_relbuf
(
arrayobject
*
self
,
PyBuffer
*
view
)
array_buffer_relbuf
(
arrayobject
*
self
,
PyBuffer
*
view
)
{
{
free
(
view
->
internal
);
self
->
ob_exports
--
;
self
->
ob_exports
--
;
}
}
...
...
Objects/bufferobject.c
Dosyayı görüntüle @
b803c517
...
@@ -64,7 +64,6 @@ buffer_releasebuf(PyBufferObject *self, PyBuffer *view)
...
@@ -64,7 +64,6 @@ buffer_releasebuf(PyBufferObject *self, PyBuffer *view)
(
*
bp
->
bf_releasebuffer
)(
self
->
b_base
,
view
);
(
*
bp
->
bf_releasebuffer
)(
self
->
b_base
,
view
);
}
}
}
}
/* XXX(nnorwitz): do we need to release view here? it leaks. */
}
}
static
PyObject
*
static
PyObject
*
...
...
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