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
2db046dc
Kaydet (Commit)
2db046dc
authored
Tem 22, 2009
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6151: Make PyDescr_COMMON conform to standard C.
üst
cf76e1ac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
23 deletions
+31
-23
descrobject.h
Include/descrobject.h
+8
-6
NEWS
Misc/NEWS
+7
-1
descrobject.c
Objects/descrobject.c
+15
-15
typeobject.c
Objects/typeobject.c
+1
-1
No files found.
Include/descrobject.h
Dosyayı görüntüle @
2db046dc
...
...
@@ -37,15 +37,17 @@ struct wrapperbase {
/* Various kinds of descriptor objects */
#define PyDescr_COMMON \
PyObject_HEAD \
PyTypeObject *d_type; \
PyObject *d_name
typedef
struct
{
PyDescr_COMMON
;
PyObject_HEAD
PyTypeObject
*
d_type
;
PyObject
*
d_name
;
}
PyDescrObject
;
#define PyDescr_COMMON PyDescrObject d_common
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
typedef
struct
{
PyDescr_COMMON
;
PyMethodDef
*
d_method
;
...
...
Misc/NEWS
Dosyayı görüntüle @
2db046dc
...
...
@@ -36,7 +36,12 @@ Core and Builtins
C-API
-----
- Issue #6405: Remove duplicatet type declarations in descrobject.h.
- Issue #6151: Made PyDescr_COMMON conform to standard C (like PyObject_HEAD
in PEP 3123). The PyDescr_TYPE and PyDescr_NAME macros should be
should used for accessing the d_type and d_name members of structures
using PyDescr_COMMON.
- Issue #6405: Remove duplicate type declarations in descrobject.h.
- The code flags for old __future__ features are now available again.
...
...
@@ -49,6 +54,7 @@ C-API
- Issue #1419652: Change the first argument to PyImport_AppendInittab() to
``const char *`` as the string is stored beyond the call.
Library
-------
...
...
Objects/descrobject.c
Dosyayı görüntüle @
2db046dc
...
...
@@ -92,7 +92,7 @@ classmethod_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type)
"descriptor '%V' for type '%s' "
"needs either an object or a type"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
);
PyDescr_TYPE
(
descr
)
->
tp_name
);
return
NULL
;
}
}
...
...
@@ -101,16 +101,16 @@ classmethod_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type)
"descriptor '%V' for type '%s' "
"needs a type, not a '%s' as arg 2"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
,
PyDescr_TYPE
(
descr
)
->
tp_name
,
type
->
ob_type
->
tp_name
);
return
NULL
;
}
if
(
!
PyType_IsSubtype
((
PyTypeObject
*
)
type
,
descr
->
d_type
))
{
if
(
!
PyType_IsSubtype
((
PyTypeObject
*
)
type
,
PyDescr_TYPE
(
descr
)
))
{
PyErr_Format
(
PyExc_TypeError
,
"descriptor '%V' for type '%s' "
"doesn't apply to type '%s'"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
,
PyDescr_TYPE
(
descr
)
->
tp_name
,
((
PyTypeObject
*
)
type
)
->
tp_name
);
return
NULL
;
}
...
...
@@ -149,7 +149,7 @@ getset_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type)
PyErr_Format
(
PyExc_AttributeError
,
"attribute '%V' of '%.100s' objects is not readable"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
);
PyDescr_TYPE
(
descr
)
->
tp_name
);
return
NULL
;
}
...
...
@@ -204,7 +204,7 @@ getset_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
PyErr_Format
(
PyExc_AttributeError
,
"attribute '%V' of '%.100s' objects is not writable"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
);
PyDescr_TYPE
(
descr
)
->
tp_name
);
return
-
1
;
}
...
...
@@ -222,17 +222,17 @@ methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds)
"descriptor '%V' of '%.100s' "
"object needs an argument"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
);
PyDescr_TYPE
(
descr
)
->
tp_name
);
return
NULL
;
}
self
=
PyTuple_GET_ITEM
(
args
,
0
);
if
(
!
PyObject_IsInstance
(
self
,
(
PyObject
*
)
(
descr
->
d_type
)))
{
if
(
!
PyObject_IsInstance
(
self
,
(
PyObject
*
)
PyDescr_TYPE
(
descr
)))
{
PyErr_Format
(
PyExc_TypeError
,
"descriptor '%V' "
"requires a '%.100s' object "
"but received a '%.100s'"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
,
PyDescr_TYPE
(
descr
)
->
tp_name
,
self
->
ob_type
->
tp_name
);
return
NULL
;
}
...
...
@@ -257,7 +257,7 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
{
PyObject
*
func
,
*
result
;
func
=
PyCFunction_New
(
descr
->
d_method
,
(
PyObject
*
)
descr
->
d_type
);
func
=
PyCFunction_New
(
descr
->
d_method
,
(
PyObject
*
)
PyDescr_TYPE
(
descr
)
);
if
(
func
==
NULL
)
return
NULL
;
...
...
@@ -280,17 +280,17 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
"descriptor '%V' of '%.100s' "
"object needs an argument"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
);
PyDescr_TYPE
(
descr
)
->
tp_name
);
return
NULL
;
}
self
=
PyTuple_GET_ITEM
(
args
,
0
);
if
(
!
PyObject_IsInstance
(
self
,
(
PyObject
*
)
(
descr
->
d_type
)))
{
if
(
!
PyObject_IsInstance
(
self
,
(
PyObject
*
)
PyDescr_TYPE
(
descr
)))
{
PyErr_Format
(
PyExc_TypeError
,
"descriptor '%V' "
"requires a '%.100s' object "
"but received a '%.100s'"
,
descr_name
((
PyDescrObject
*
)
descr
),
"?"
,
descr
->
d_type
->
tp_name
,
PyDescr_TYPE
(
descr
)
->
tp_name
,
self
->
ob_type
->
tp_name
);
return
NULL
;
}
...
...
@@ -949,7 +949,7 @@ static PyMemberDef wrapper_members[] = {
static
PyObject
*
wrapper_objclass
(
wrapperobject
*
wp
)
{
PyObject
*
c
=
(
PyObject
*
)
wp
->
descr
->
d_type
;
PyObject
*
c
=
(
PyObject
*
)
PyDescr_TYPE
(
wp
->
descr
)
;
Py_INCREF
(
c
);
return
c
;
...
...
@@ -1059,7 +1059,7 @@ PyWrapper_New(PyObject *d, PyObject *self)
assert
(
PyObject_TypeCheck
(
d
,
&
PyWrapperDescr_Type
));
descr
=
(
PyWrapperDescrObject
*
)
d
;
assert
(
PyObject_IsInstance
(
self
,
(
PyObject
*
)
(
descr
->
d_type
)));
assert
(
PyObject_IsInstance
(
self
,
(
PyObject
*
)
PyDescr_TYPE
(
descr
)));
wp
=
PyObject_GC_New
(
wrapperobject
,
&
wrappertype
);
if
(
wp
!=
NULL
)
{
...
...
Objects/typeobject.c
Dosyayı görüntüle @
2db046dc
...
...
@@ -5648,7 +5648,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
generic
=
p
->
function
;
d
=
(
PyWrapperDescrObject
*
)
descr
;
if
(
d
->
d_base
->
wrapper
==
p
->
wrapper
&&
PyType_IsSubtype
(
type
,
d
->
d_type
))
PyType_IsSubtype
(
type
,
PyDescr_TYPE
(
d
)
))
{
if
(
specific
==
NULL
||
specific
==
d
->
d_wrapped
)
...
...
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