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
b808c5cf
Kaydet (Commit)
b808c5cf
authored
Kas 24, 2002
tarafından
Neil Schemenauer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplify use of NB_BINOP and NB_TERNOP by making them do the pointer
dereference rather than the caller.
üst
e6b49025
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
abstract.c
Objects/abstract.c
+15
-15
No files found.
Objects/abstract.c
Dosyayı görüntüle @
b808c5cf
...
@@ -318,9 +318,9 @@ PyNumber_Check(PyObject *o)
...
@@ -318,9 +318,9 @@ PyNumber_Check(PyObject *o)
#define NB_SLOT(x) offsetof(PyNumberMethods, x)
#define NB_SLOT(x) offsetof(PyNumberMethods, x)
#define NB_BINOP(nb_methods, slot) \
#define NB_BINOP(nb_methods, slot) \
(
(binaryfunc*)(& ((char*)nb_methods)[slot]
))
(
*(binaryfunc*)(& ((char*)nb_methods)[slot]
))
#define NB_TERNOP(nb_methods, slot) \
#define NB_TERNOP(nb_methods, slot) \
(
(ternaryfunc*)(& ((char*)nb_methods)[slot]
))
(
*(ternaryfunc*)(& ((char*)nb_methods)[slot]
))
/*
/*
Calling scheme used for binary operations:
Calling scheme used for binary operations:
...
@@ -352,10 +352,10 @@ binary_op1(PyObject *v, PyObject *w, const int op_slot)
...
@@ -352,10 +352,10 @@ binary_op1(PyObject *v, PyObject *w, const int op_slot)
binaryfunc
slotw
=
NULL
;
binaryfunc
slotw
=
NULL
;
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
&&
NEW_STYLE_NUMBER
(
v
))
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
&&
NEW_STYLE_NUMBER
(
v
))
slotv
=
*
NB_BINOP
(
v
->
ob_type
->
tp_as_number
,
op_slot
);
slotv
=
NB_BINOP
(
v
->
ob_type
->
tp_as_number
,
op_slot
);
if
(
w
->
ob_type
!=
v
->
ob_type
&&
if
(
w
->
ob_type
!=
v
->
ob_type
&&
w
->
ob_type
->
tp_as_number
!=
NULL
&&
NEW_STYLE_NUMBER
(
w
))
{
w
->
ob_type
->
tp_as_number
!=
NULL
&&
NEW_STYLE_NUMBER
(
w
))
{
slotw
=
*
NB_BINOP
(
w
->
ob_type
->
tp_as_number
,
op_slot
);
slotw
=
NB_BINOP
(
w
->
ob_type
->
tp_as_number
,
op_slot
);
if
(
slotw
==
slotv
)
if
(
slotw
==
slotv
)
slotw
=
NULL
;
slotw
=
NULL
;
}
}
...
@@ -387,7 +387,7 @@ binary_op1(PyObject *v, PyObject *w, const int op_slot)
...
@@ -387,7 +387,7 @@ binary_op1(PyObject *v, PyObject *w, const int op_slot)
PyNumberMethods
*
mv
=
v
->
ob_type
->
tp_as_number
;
PyNumberMethods
*
mv
=
v
->
ob_type
->
tp_as_number
;
if
(
mv
)
{
if
(
mv
)
{
binaryfunc
slot
;
binaryfunc
slot
;
slot
=
*
NB_BINOP
(
mv
,
op_slot
);
slot
=
NB_BINOP
(
mv
,
op_slot
);
if
(
slot
)
{
if
(
slot
)
{
PyObject
*
x
=
slot
(
v
,
w
);
PyObject
*
x
=
slot
(
v
,
w
);
Py_DECREF
(
v
);
Py_DECREF
(
v
);
...
@@ -466,10 +466,10 @@ ternary_op(PyObject *v,
...
@@ -466,10 +466,10 @@ ternary_op(PyObject *v,
mv
=
v
->
ob_type
->
tp_as_number
;
mv
=
v
->
ob_type
->
tp_as_number
;
mw
=
w
->
ob_type
->
tp_as_number
;
mw
=
w
->
ob_type
->
tp_as_number
;
if
(
mv
!=
NULL
&&
NEW_STYLE_NUMBER
(
v
))
if
(
mv
!=
NULL
&&
NEW_STYLE_NUMBER
(
v
))
slotv
=
*
NB_TERNOP
(
mv
,
op_slot
);
slotv
=
NB_TERNOP
(
mv
,
op_slot
);
if
(
w
->
ob_type
!=
v
->
ob_type
&&
if
(
w
->
ob_type
!=
v
->
ob_type
&&
mv
!=
NULL
&&
NEW_STYLE_NUMBER
(
w
))
{
mv
!=
NULL
&&
NEW_STYLE_NUMBER
(
w
))
{
slotw
=
*
NB_TERNOP
(
mw
,
op_slot
);
slotw
=
NB_TERNOP
(
mw
,
op_slot
);
if
(
slotw
==
slotv
)
if
(
slotw
==
slotv
)
slotw
=
NULL
;
slotw
=
NULL
;
}
}
...
@@ -494,7 +494,7 @@ ternary_op(PyObject *v,
...
@@ -494,7 +494,7 @@ ternary_op(PyObject *v,
}
}
mz
=
z
->
ob_type
->
tp_as_number
;
mz
=
z
->
ob_type
->
tp_as_number
;
if
(
mz
!=
NULL
&&
NEW_STYLE_NUMBER
(
z
))
{
if
(
mz
!=
NULL
&&
NEW_STYLE_NUMBER
(
z
))
{
slotz
=
*
NB_TERNOP
(
mz
,
op_slot
);
slotz
=
NB_TERNOP
(
mz
,
op_slot
);
if
(
slotz
==
slotv
||
slotz
==
slotw
)
if
(
slotz
==
slotv
||
slotz
==
slotw
)
slotz
=
NULL
;
slotz
=
NULL
;
if
(
slotz
)
{
if
(
slotz
)
{
...
@@ -519,8 +519,8 @@ ternary_op(PyObject *v,
...
@@ -519,8 +519,8 @@ ternary_op(PyObject *v,
treated as absent argument and not coerced. */
treated as absent argument and not coerced. */
if
(
z
==
Py_None
)
{
if
(
z
==
Py_None
)
{
if
(
v
->
ob_type
->
tp_as_number
)
{
if
(
v
->
ob_type
->
tp_as_number
)
{
slotz
=
*
NB_TERNOP
(
v
->
ob_type
->
tp_as_number
,
slotz
=
NB_TERNOP
(
v
->
ob_type
->
tp_as_number
,
op_slot
);
op_slot
);
if
(
slotz
)
if
(
slotz
)
x
=
slotz
(
v
,
w
,
z
);
x
=
slotz
(
v
,
w
,
z
);
else
else
...
@@ -542,8 +542,8 @@ ternary_op(PyObject *v,
...
@@ -542,8 +542,8 @@ ternary_op(PyObject *v,
goto
error1
;
goto
error1
;
if
(
v1
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v1
->
ob_type
->
tp_as_number
!=
NULL
)
{
slotv
=
*
NB_TERNOP
(
v1
->
ob_type
->
tp_as_number
,
slotv
=
NB_TERNOP
(
v1
->
ob_type
->
tp_as_number
,
op_slot
);
op_slot
);
if
(
slotv
)
if
(
slotv
)
x
=
slotv
(
v1
,
w2
,
z2
);
x
=
slotv
(
v1
,
w2
,
z2
);
else
else
...
@@ -673,9 +673,9 @@ binary_iop(PyObject *v, PyObject *w, const int iop_slot, const int op_slot,
...
@@ -673,9 +673,9 @@ binary_iop(PyObject *v, PyObject *w, const int iop_slot, const int op_slot,
{
{
PyNumberMethods
*
mv
=
v
->
ob_type
->
tp_as_number
;
PyNumberMethods
*
mv
=
v
->
ob_type
->
tp_as_number
;
if
(
mv
!=
NULL
&&
HASINPLACE
(
v
))
{
if
(
mv
!=
NULL
&&
HASINPLACE
(
v
))
{
binaryfunc
*
slot
=
NB_BINOP
(
mv
,
iop_slot
);
binaryfunc
slot
=
NB_BINOP
(
mv
,
iop_slot
);
if
(
*
slot
)
{
if
(
slot
)
{
PyObject
*
x
=
(
*
slot
)(
v
,
w
);
PyObject
*
x
=
(
slot
)(
v
,
w
);
if
(
x
!=
Py_NotImplemented
)
{
if
(
x
!=
Py_NotImplemented
)
{
return
x
;
return
x
;
}
}
...
...
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