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
06186519
Kaydet (Commit)
06186519
authored
Ock 07, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use new instancebinop interface
üst
6a00cd8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
ceval.c
Python/ceval.c
+18
-18
No files found.
Python/ceval.c
Dosyayı görüntüle @
06186519
...
@@ -68,7 +68,7 @@ static object *add PROTO((object *, object *));
...
@@ -68,7 +68,7 @@ static object *add PROTO((object *, object *));
static
object
*
sub
PROTO
((
object
*
,
object
*
));
static
object
*
sub
PROTO
((
object
*
,
object
*
));
static
object
*
mul
PROTO
((
object
*
,
object
*
));
static
object
*
mul
PROTO
((
object
*
,
object
*
));
static
object
*
divide
PROTO
((
object
*
,
object
*
));
static
object
*
divide
PROTO
((
object
*
,
object
*
));
static
object
*
rem
PROTO
((
object
*
,
object
*
));
static
object
*
mod
PROTO
((
object
*
,
object
*
));
static
object
*
neg
PROTO
((
object
*
));
static
object
*
neg
PROTO
((
object
*
));
static
object
*
pos
PROTO
((
object
*
));
static
object
*
pos
PROTO
((
object
*
));
static
object
*
not
PROTO
((
object
*
));
static
object
*
not
PROTO
((
object
*
));
...
@@ -571,7 +571,7 @@ eval_code(co, globals, locals, owner, arg)
...
@@ -571,7 +571,7 @@ eval_code(co, globals, locals, owner, arg)
case
BINARY_MODULO
:
case
BINARY_MODULO
:
w
=
POP
();
w
=
POP
();
v
=
POP
();
v
=
POP
();
x
=
rem
(
v
,
w
);
x
=
mod
(
v
,
w
);
DECREF
(
v
);
DECREF
(
v
);
DECREF
(
w
);
DECREF
(
w
);
PUSH
(
x
);
PUSH
(
x
);
...
@@ -1742,18 +1742,18 @@ flushline()
...
@@ -1742,18 +1742,18 @@ flushline()
}
}
#define BINOP(opname, ropname) \
#define BINOP(opname, ropname
, thisfunc
) \
do {
\
if (!is_instanceobject(v) && !is_instanceobject(w))
\
if (is_instanceobject(v) || is_instanceobject(w))
\
;
\
return instancebinop(v, w, opname, ropname);
\
else
\
} while (0
)
return instancebinop(v, w, opname, ropname, thisfunc
)
static
object
*
static
object
*
or
(
v
,
w
)
or
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__or__"
,
"__ror__"
);
BINOP
(
"__or__"
,
"__ror__"
,
or
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
...
@@ -1774,7 +1774,7 @@ static object *
...
@@ -1774,7 +1774,7 @@ static object *
xor
(
v
,
w
)
xor
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__xor__"
,
"__rxor__"
);
BINOP
(
"__xor__"
,
"__rxor__"
,
xor
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
...
@@ -1795,7 +1795,7 @@ static object *
...
@@ -1795,7 +1795,7 @@ static object *
and
(
v
,
w
)
and
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__and__"
,
"__rand__"
);
BINOP
(
"__and__"
,
"__rand__"
,
and
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
...
@@ -1816,7 +1816,7 @@ static object *
...
@@ -1816,7 +1816,7 @@ static object *
lshift
(
v
,
w
)
lshift
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__lshift__"
,
"__rlshift__"
);
BINOP
(
"__lshift__"
,
"__rlshift__"
,
lshift
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
...
@@ -1837,7 +1837,7 @@ static object *
...
@@ -1837,7 +1837,7 @@ static object *
rshift
(
v
,
w
)
rshift
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__rshift__"
,
"__rrshift__"
);
BINOP
(
"__rshift__"
,
"__rrshift__"
,
rshift
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
object
*
(
*
f
)
FPROTO
((
object
*
,
object
*
));
...
@@ -1858,7 +1858,7 @@ static object *
...
@@ -1858,7 +1858,7 @@ static object *
add
(
v
,
w
)
add
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__add__"
,
"__radd__"
);
BINOP
(
"__add__"
,
"__radd__"
,
add
);
if
(
v
->
ob_type
->
tp_as_sequence
!=
NULL
)
if
(
v
->
ob_type
->
tp_as_sequence
!=
NULL
)
return
(
*
v
->
ob_type
->
tp_as_sequence
->
sq_concat
)(
v
,
w
);
return
(
*
v
->
ob_type
->
tp_as_sequence
->
sq_concat
)(
v
,
w
);
else
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
else
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -1878,7 +1878,7 @@ static object *
...
@@ -1878,7 +1878,7 @@ static object *
sub
(
v
,
w
)
sub
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__sub__"
,
"__rsub__"
);
BINOP
(
"__sub__"
,
"__rsub__"
,
sub
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
if
(
coerce
(
&
v
,
&
w
)
!=
0
)
if
(
coerce
(
&
v
,
&
w
)
!=
0
)
...
@@ -1898,7 +1898,7 @@ mul(v, w)
...
@@ -1898,7 +1898,7 @@ mul(v, w)
{
{
typeobject
*
tp
;
typeobject
*
tp
;
tp
=
v
->
ob_type
;
tp
=
v
->
ob_type
;
BINOP
(
"__mul__"
,
"__rmul__"
);
BINOP
(
"__mul__"
,
"__rmul__"
,
mul
);
if
(
tp
->
tp_as_number
!=
NULL
&&
if
(
tp
->
tp_as_number
!=
NULL
&&
w
->
ob_type
->
tp_as_sequence
!=
NULL
&&
w
->
ob_type
->
tp_as_sequence
!=
NULL
&&
!
is_instanceobject
(
v
))
{
!
is_instanceobject
(
v
))
{
...
@@ -1942,7 +1942,7 @@ static object *
...
@@ -1942,7 +1942,7 @@ static object *
divide
(
v
,
w
)
divide
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
BINOP
(
"__div__"
,
"__rdiv__"
);
BINOP
(
"__div__"
,
"__rdiv__"
,
divide
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
if
(
coerce
(
&
v
,
&
w
)
!=
0
)
if
(
coerce
(
&
v
,
&
w
)
!=
0
)
...
@@ -1957,13 +1957,13 @@ divide(v, w)
...
@@ -1957,13 +1957,13 @@ divide(v, w)
}
}
static
object
*
static
object
*
rem
(
v
,
w
)
mod
(
v
,
w
)
object
*
v
,
*
w
;
object
*
v
,
*
w
;
{
{
if
(
is_stringobject
(
v
))
{
if
(
is_stringobject
(
v
))
{
return
formatstring
(
v
,
w
);
return
formatstring
(
v
,
w
);
}
}
BINOP
(
"__mod__"
,
"__rmod__"
);
BINOP
(
"__mod__"
,
"__rmod__"
,
mod
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
object
*
x
;
object
*
x
;
if
(
coerce
(
&
v
,
&
w
)
!=
0
)
if
(
coerce
(
&
v
,
&
w
)
!=
0
)
...
...
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