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
0ad5ae02
Kaydet (Commit)
0ad5ae02
authored
Agu 19, 2008
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix a regression introduced by rev. 63792: ctypes function pointers
that are COM methods must have a boolean True value.
üst
4348a256
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
6 deletions
+35
-6
test_pointers.py
Lib/ctypes/test/test_pointers.py
+6
-1
NEWS
Misc/NEWS
+3
-0
_ctypes.c
Modules/_ctypes/_ctypes.c
+26
-5
No files found.
Lib/ctypes/test/test_pointers.py
Dosyayı görüntüle @
0ad5ae02
import
unittest
import
unittest
,
sys
from
ctypes
import
*
import
_ctypes_test
...
...
@@ -183,5 +183,10 @@ class PointersTestCase(unittest.TestCase):
self
.
failUnlessEqual
(
bool
(
CFUNCTYPE
(
None
)(
0
)),
False
)
self
.
failUnlessEqual
(
bool
(
CFUNCTYPE
(
None
)(
42
)),
True
)
# COM methods are boolean True:
if
sys
.
platform
==
"win32"
:
mth
=
WINFUNCTYPE
(
None
)(
42
,
"name"
,
(),
None
)
self
.
failUnlessEqual
(
bool
(
mth
),
True
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Misc/NEWS
Dosyayı görüntüle @
0ad5ae02
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.6 beta 3?
Core and Builtins
-----------------
- ctypes function pointers that are COM methods have a boolean True
value again.
- Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.
...
...
Modules/_ctypes/_ctypes.c
Dosyayı görüntüle @
0ad5ae02
...
...
@@ -3938,12 +3938,13 @@ CFuncPtr_repr(CFuncPtrObject *self)
}
static
int
Pointer_nonzero
(
CData
Object
*
self
)
CFuncPtr_nonzero
(
CFuncPtr
Object
*
self
)
{
return
*
(
void
**
)
self
->
b_ptr
!=
NULL
;
return
((
*
(
void
**
)
self
->
b_ptr
!=
NULL
)
||
(
self
->
index
!=
0
));
}
static
PyNumberMethods
Pointe
r_as_number
=
{
static
PyNumberMethods
CFuncPt
r_as_number
=
{
0
,
/* nb_add */
0
,
/* nb_subtract */
0
,
/* nb_multiply */
...
...
@@ -3954,7 +3955,7 @@ static PyNumberMethods Pointer_as_number = {
0
,
/* nb_negative */
0
,
/* nb_positive */
0
,
/* nb_absolute */
(
inquiry
)
Pointe
r_nonzero
,
/* nb_nonzero */
(
inquiry
)
CFuncPt
r_nonzero
,
/* nb_nonzero */
};
PyTypeObject
CFuncPtr_Type
=
{
...
...
@@ -3968,7 +3969,7 @@ PyTypeObject CFuncPtr_Type = {
0
,
/* tp_setattr */
0
,
/* tp_compare */
(
reprfunc
)
CFuncPtr_repr
,
/* tp_repr */
&
Pointe
r_as_number
,
/* tp_as_number */
&
CFuncPt
r_as_number
,
/* tp_as_number */
0
,
/* tp_as_sequence */
0
,
/* tp_as_mapping */
0
,
/* tp_hash */
...
...
@@ -5176,6 +5177,26 @@ static PyMappingMethods Pointer_as_mapping = {
Pointer_subscript
,
};
static
int
Pointer_nonzero
(
CDataObject
*
self
)
{
return
(
*
(
void
**
)
self
->
b_ptr
!=
NULL
);
}
static
PyNumberMethods
Pointer_as_number
=
{
0
,
/* nb_add */
0
,
/* nb_subtract */
0
,
/* nb_multiply */
0
,
/* nb_divide */
0
,
/* nb_remainder */
0
,
/* nb_divmod */
0
,
/* nb_power */
0
,
/* nb_negative */
0
,
/* nb_positive */
0
,
/* nb_absolute */
(
inquiry
)
Pointer_nonzero
,
/* nb_nonzero */
};
PyTypeObject
Pointer_Type
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"_ctypes._Pointer"
,
...
...
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