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
79912471
Kaydet (Commit)
79912471
authored
Tem 09, 2000
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ANSI-fication of the sources.
üst
a83b68a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
360 deletions
+135
-360
abstract.c
Objects/abstract.c
+55
-140
bufferobject.c
Objects/bufferobject.c
+24
-78
classobject.c
Objects/classobject.c
+56
-142
No files found.
Objects/abstract.c
Dosyayı görüntüle @
79912471
...
@@ -16,15 +16,14 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
...
@@ -16,15 +16,14 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Shorthands to return certain errors */
/* Shorthands to return certain errors */
static
PyObject
*
static
PyObject
*
type_error
(
msg
)
type_error
(
char
*
msg
)
char
*
msg
;
{
{
PyErr_SetString
(
PyExc_TypeError
,
msg
);
PyErr_SetString
(
PyExc_TypeError
,
msg
);
return
NULL
;
return
NULL
;
}
}
static
PyObject
*
static
PyObject
*
null_error
()
null_error
(
void
)
{
{
if
(
!
PyErr_Occurred
())
if
(
!
PyErr_Occurred
())
PyErr_SetString
(
PyExc_SystemError
,
PyErr_SetString
(
PyExc_SystemError
,
...
@@ -35,10 +34,7 @@ null_error()
...
@@ -35,10 +34,7 @@ null_error()
/* Operations on any object */
/* Operations on any object */
int
int
PyObject_Cmp
(
o1
,
o2
,
result
)
PyObject_Cmp
(
PyObject
*
o1
,
PyObject
*
o2
,
int
*
result
)
PyObject
*
o1
;
PyObject
*
o2
;
int
*
result
;
{
{
int
r
;
int
r
;
...
@@ -54,8 +50,7 @@ PyObject_Cmp(o1, o2, result)
...
@@ -54,8 +50,7 @@ PyObject_Cmp(o1, o2, result)
}
}
PyObject
*
PyObject
*
PyObject_Type
(
o
)
PyObject_Type
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyObject
*
v
;
PyObject
*
v
;
...
@@ -67,8 +62,7 @@ PyObject_Type(o)
...
@@ -67,8 +62,7 @@ PyObject_Type(o)
}
}
int
int
PyObject_Length
(
o
)
PyObject_Length
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -85,9 +79,7 @@ PyObject_Length(o)
...
@@ -85,9 +79,7 @@ PyObject_Length(o)
}
}
PyObject
*
PyObject
*
PyObject_GetItem
(
o
,
key
)
PyObject_GetItem
(
PyObject
*
o
,
PyObject
*
key
)
PyObject
*
o
;
PyObject
*
key
;
{
{
PyMappingMethods
*
m
;
PyMappingMethods
*
m
;
...
@@ -114,10 +106,7 @@ PyObject_GetItem(o, key)
...
@@ -114,10 +106,7 @@ PyObject_GetItem(o, key)
}
}
int
int
PyObject_SetItem
(
o
,
key
,
value
)
PyObject_SetItem
(
PyObject
*
o
,
PyObject
*
key
,
PyObject
*
value
)
PyObject
*
o
;
PyObject
*
key
;
PyObject
*
value
;
{
{
PyMappingMethods
*
m
;
PyMappingMethods
*
m
;
...
@@ -147,9 +136,7 @@ PyObject_SetItem(o, key, value)
...
@@ -147,9 +136,7 @@ PyObject_SetItem(o, key, value)
}
}
int
int
PyObject_DelItem
(
o
,
key
)
PyObject_DelItem
(
PyObject
*
o
,
PyObject
*
key
)
PyObject
*
o
;
PyObject
*
key
;
{
{
PyMappingMethods
*
m
;
PyMappingMethods
*
m
;
...
@@ -289,8 +276,7 @@ int PyObject_AsWriteBuffer(PyObject *obj,
...
@@ -289,8 +276,7 @@ int PyObject_AsWriteBuffer(PyObject *obj,
/* Operations on numbers */
/* Operations on numbers */
int
int
PyNumber_Check
(
o
)
PyNumber_Check
(
PyObject
*
o
)
PyObject
*
o
;
{
{
return
o
&&
o
->
ob_type
->
tp_as_number
;
return
o
&&
o
->
ob_type
->
tp_as_number
;
}
}
...
@@ -302,8 +288,7 @@ PyNumber_Check(o)
...
@@ -302,8 +288,7 @@ PyNumber_Check(o)
return PyInstance_DoBinOp(v, w, opname, ropname, thisfunc)
return PyInstance_DoBinOp(v, w, opname, ropname, thisfunc)
PyObject
*
PyObject
*
PyNumber_Or
(
v
,
w
)
PyNumber_Or
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
extern
int
PyNumber_Coerce
();
extern
int
PyNumber_Coerce
();
...
@@ -324,8 +309,7 @@ PyNumber_Or(v, w)
...
@@ -324,8 +309,7 @@ PyNumber_Or(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Xor
(
v
,
w
)
PyNumber_Xor
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
extern
int
PyNumber_Coerce
();
extern
int
PyNumber_Coerce
();
...
@@ -346,8 +330,7 @@ PyNumber_Xor(v, w)
...
@@ -346,8 +330,7 @@ PyNumber_Xor(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_And
(
v
,
w
)
PyNumber_And
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
BINOP
(
v
,
w
,
"__and__"
,
"__rand__"
,
PyNumber_And
);
BINOP
(
v
,
w
,
"__and__"
,
"__rand__"
,
PyNumber_And
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -366,8 +349,7 @@ PyNumber_And(v, w)
...
@@ -366,8 +349,7 @@ PyNumber_And(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Lshift
(
v
,
w
)
PyNumber_Lshift
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
BINOP
(
v
,
w
,
"__lshift__"
,
"__rlshift__"
,
PyNumber_Lshift
);
BINOP
(
v
,
w
,
"__lshift__"
,
"__rlshift__"
,
PyNumber_Lshift
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -386,8 +368,7 @@ PyNumber_Lshift(v, w)
...
@@ -386,8 +368,7 @@ PyNumber_Lshift(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Rshift
(
v
,
w
)
PyNumber_Rshift
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
BINOP
(
v
,
w
,
"__rshift__"
,
"__rrshift__"
,
PyNumber_Rshift
);
BINOP
(
v
,
w
,
"__rshift__"
,
"__rrshift__"
,
PyNumber_Rshift
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -406,8 +387,7 @@ PyNumber_Rshift(v, w)
...
@@ -406,8 +387,7 @@ PyNumber_Rshift(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Add
(
v
,
w
)
PyNumber_Add
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -431,8 +411,7 @@ PyNumber_Add(v, w)
...
@@ -431,8 +411,7 @@ PyNumber_Add(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Subtract
(
v
,
w
)
PyNumber_Subtract
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
BINOP
(
v
,
w
,
"__sub__"
,
"__rsub__"
,
PyNumber_Subtract
);
BINOP
(
v
,
w
,
"__sub__"
,
"__rsub__"
,
PyNumber_Subtract
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -451,8 +430,7 @@ PyNumber_Subtract(v, w)
...
@@ -451,8 +430,7 @@ PyNumber_Subtract(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Multiply
(
v
,
w
)
PyNumber_Multiply
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
PyTypeObject
*
tp
=
v
->
ob_type
;
PyTypeObject
*
tp
=
v
->
ob_type
;
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -509,8 +487,7 @@ PyNumber_Multiply(v, w)
...
@@ -509,8 +487,7 @@ PyNumber_Multiply(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Divide
(
v
,
w
)
PyNumber_Divide
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
BINOP
(
v
,
w
,
"__div__"
,
"__rdiv__"
,
PyNumber_Divide
);
BINOP
(
v
,
w
,
"__div__"
,
"__rdiv__"
,
PyNumber_Divide
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -529,8 +506,7 @@ PyNumber_Divide(v, w)
...
@@ -529,8 +506,7 @@ PyNumber_Divide(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Remainder
(
v
,
w
)
PyNumber_Remainder
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
if
(
PyString_Check
(
v
))
if
(
PyString_Check
(
v
))
return
PyString_Format
(
v
,
w
);
return
PyString_Format
(
v
,
w
);
...
@@ -553,8 +529,7 @@ PyNumber_Remainder(v, w)
...
@@ -553,8 +529,7 @@ PyNumber_Remainder(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Divmod
(
v
,
w
)
PyNumber_Divmod
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
BINOP
(
v
,
w
,
"__divmod__"
,
"__rdivmod__"
,
PyNumber_Divmod
);
BINOP
(
v
,
w
,
"__divmod__"
,
"__rdivmod__"
,
PyNumber_Divmod
);
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
if
(
v
->
ob_type
->
tp_as_number
!=
NULL
)
{
...
@@ -575,8 +550,7 @@ PyNumber_Divmod(v, w)
...
@@ -575,8 +550,7 @@ PyNumber_Divmod(v, w)
/* Power (binary or ternary) */
/* Power (binary or ternary) */
static
PyObject
*
static
PyObject
*
do_pow
(
v
,
w
)
do_pow
(
PyObject
*
v
,
PyObject
*
w
)
PyObject
*
v
,
*
w
;
{
{
PyObject
*
res
;
PyObject
*
res
;
PyObject
*
(
*
f
)(
PyObject
*
,
PyObject
*
,
PyObject
*
);
PyObject
*
(
*
f
)(
PyObject
*
,
PyObject
*
,
PyObject
*
);
...
@@ -599,8 +573,7 @@ do_pow(v, w)
...
@@ -599,8 +573,7 @@ do_pow(v, w)
}
}
PyObject
*
PyObject
*
PyNumber_Power
(
v
,
w
,
z
)
PyNumber_Power
(
PyObject
*
v
,
PyObject
*
w
,
PyObject
*
z
)
PyObject
*
v
,
*
w
,
*
z
;
{
{
PyObject
*
res
;
PyObject
*
res
;
PyObject
*
v1
,
*
z1
,
*
w2
,
*
z2
;
PyObject
*
v1
,
*
z1
,
*
w2
,
*
z2
;
...
@@ -646,8 +619,7 @@ PyNumber_Power(v, w, z)
...
@@ -646,8 +619,7 @@ PyNumber_Power(v, w, z)
/* Unary operators and functions */
/* Unary operators and functions */
PyObject
*
PyObject
*
PyNumber_Negative
(
o
)
PyNumber_Negative
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
...
@@ -661,8 +633,7 @@ PyNumber_Negative(o)
...
@@ -661,8 +633,7 @@ PyNumber_Negative(o)
}
}
PyObject
*
PyObject
*
PyNumber_Positive
(
o
)
PyNumber_Positive
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
...
@@ -676,8 +647,7 @@ PyNumber_Positive(o)
...
@@ -676,8 +647,7 @@ PyNumber_Positive(o)
}
}
PyObject
*
PyObject
*
PyNumber_Invert
(
o
)
PyNumber_Invert
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
...
@@ -691,8 +661,7 @@ PyNumber_Invert(o)
...
@@ -691,8 +661,7 @@ PyNumber_Invert(o)
}
}
PyObject
*
PyObject
*
PyNumber_Absolute
(
o
)
PyNumber_Absolute
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
...
@@ -707,9 +676,7 @@ PyNumber_Absolute(o)
...
@@ -707,9 +676,7 @@ PyNumber_Absolute(o)
/* Add a check for embedded NULL-bytes in the argument. */
/* Add a check for embedded NULL-bytes in the argument. */
static
PyObject
*
static
PyObject
*
int_from_string
(
s
,
len
)
int_from_string
(
const
char
*
s
,
int
len
)
const
char
*
s
;
int
len
;
{
{
char
*
end
;
char
*
end
;
PyObject
*
x
;
PyObject
*
x
;
...
@@ -727,8 +694,7 @@ int_from_string(s, len)
...
@@ -727,8 +694,7 @@ int_from_string(s, len)
}
}
PyObject
*
PyObject
*
PyNumber_Int
(
o
)
PyNumber_Int
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
const
char
*
buffer
;
const
char
*
buffer
;
...
@@ -758,9 +724,7 @@ PyNumber_Int(o)
...
@@ -758,9 +724,7 @@ PyNumber_Int(o)
/* Add a check for embedded NULL-bytes in the argument. */
/* Add a check for embedded NULL-bytes in the argument. */
static
PyObject
*
static
PyObject
*
long_from_string
(
s
,
len
)
long_from_string
(
const
char
*
s
,
int
len
)
const
char
*
s
;
int
len
;
{
{
char
*
end
;
char
*
end
;
PyObject
*
x
;
PyObject
*
x
;
...
@@ -778,8 +742,7 @@ long_from_string(s, len)
...
@@ -778,8 +742,7 @@ long_from_string(s, len)
}
}
PyObject
*
PyObject
*
PyNumber_Long
(
o
)
PyNumber_Long
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
const
char
*
buffer
;
const
char
*
buffer
;
...
@@ -813,8 +776,7 @@ PyNumber_Long(o)
...
@@ -813,8 +776,7 @@ PyNumber_Long(o)
}
}
PyObject
*
PyObject
*
PyNumber_Float
(
o
)
PyNumber_Float
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyNumberMethods
*
m
;
PyNumberMethods
*
m
;
...
@@ -835,15 +797,13 @@ PyNumber_Float(o)
...
@@ -835,15 +797,13 @@ PyNumber_Float(o)
/* Operations on sequences */
/* Operations on sequences */
int
int
PySequence_Check
(
s
)
PySequence_Check
(
PyObject
*
s
)
PyObject
*
s
;
{
{
return
s
!=
NULL
&&
s
->
ob_type
->
tp_as_sequence
;
return
s
!=
NULL
&&
s
->
ob_type
->
tp_as_sequence
;
}
}
int
int
PySequence_Length
(
s
)
PySequence_Length
(
PyObject
*
s
)
PyObject
*
s
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -861,9 +821,7 @@ PySequence_Length(s)
...
@@ -861,9 +821,7 @@ PySequence_Length(s)
}
}
PyObject
*
PyObject
*
PySequence_Concat
(
s
,
o
)
PySequence_Concat
(
PyObject
*
s
,
PyObject
*
o
)
PyObject
*
s
;
PyObject
*
o
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -878,9 +836,7 @@ PySequence_Concat(s, o)
...
@@ -878,9 +836,7 @@ PySequence_Concat(s, o)
}
}
PyObject
*
PyObject
*
PySequence_Repeat
(
o
,
count
)
PySequence_Repeat
(
PyObject
*
o
,
int
count
)
PyObject
*
o
;
int
count
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -895,9 +851,7 @@ PySequence_Repeat(o, count)
...
@@ -895,9 +851,7 @@ PySequence_Repeat(o, count)
}
}
PyObject
*
PyObject
*
PySequence_GetItem
(
s
,
i
)
PySequence_GetItem
(
PyObject
*
s
,
int
i
)
PyObject
*
s
;
int
i
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -921,10 +875,7 @@ PySequence_GetItem(s, i)
...
@@ -921,10 +875,7 @@ PySequence_GetItem(s, i)
}
}
PyObject
*
PyObject
*
PySequence_GetSlice
(
s
,
i1
,
i2
)
PySequence_GetSlice
(
PyObject
*
s
,
int
i1
,
int
i2
)
PyObject
*
s
;
int
i1
;
int
i2
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -950,10 +901,7 @@ PySequence_GetSlice(s, i1, i2)
...
@@ -950,10 +901,7 @@ PySequence_GetSlice(s, i1, i2)
}
}
int
int
PySequence_SetItem
(
s
,
i
,
o
)
PySequence_SetItem
(
PyObject
*
s
,
int
i
,
PyObject
*
o
)
PyObject
*
s
;
int
i
;
PyObject
*
o
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -980,9 +928,7 @@ PySequence_SetItem(s, i, o)
...
@@ -980,9 +928,7 @@ PySequence_SetItem(s, i, o)
}
}
int
int
PySequence_DelItem
(
s
,
i
)
PySequence_DelItem
(
PyObject
*
s
,
int
i
)
PyObject
*
s
;
int
i
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -1009,11 +955,7 @@ PySequence_DelItem(s, i)
...
@@ -1009,11 +955,7 @@ PySequence_DelItem(s, i)
}
}
int
int
PySequence_SetSlice
(
s
,
i1
,
i2
,
o
)
PySequence_SetSlice
(
PyObject
*
s
,
int
i1
,
int
i2
,
PyObject
*
o
)
PyObject
*
s
;
int
i1
;
int
i2
;
PyObject
*
o
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -1042,10 +984,7 @@ PySequence_SetSlice(s, i1, i2, o)
...
@@ -1042,10 +984,7 @@ PySequence_SetSlice(s, i1, i2, o)
}
}
int
int
PySequence_DelSlice
(
s
,
i1
,
i2
)
PySequence_DelSlice
(
PyObject
*
s
,
int
i1
,
int
i2
)
PyObject
*
s
;
int
i1
;
int
i2
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -1074,8 +1013,7 @@ PySequence_DelSlice(s, i1, i2)
...
@@ -1074,8 +1013,7 @@ PySequence_DelSlice(s, i1, i2)
}
}
PyObject
*
PyObject
*
PySequence_Tuple
(
v
)
PySequence_Tuple
(
PyObject
*
v
)
PyObject
*
v
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -1135,8 +1073,7 @@ PySequence_Tuple(v)
...
@@ -1135,8 +1073,7 @@ PySequence_Tuple(v)
}
}
PyObject
*
PyObject
*
PySequence_List
(
v
)
PySequence_List
(
PyObject
*
v
)
PyObject
*
v
;
{
{
PySequenceMethods
*
m
;
PySequenceMethods
*
m
;
...
@@ -1187,9 +1124,7 @@ PySequence_List(v)
...
@@ -1187,9 +1124,7 @@ PySequence_List(v)
}
}
PyObject
*
PyObject
*
PySequence_Fast
(
v
,
m
)
PySequence_Fast
(
PyObject
*
v
,
const
char
*
m
)
PyObject
*
v
;
const
char
*
m
;
{
{
if
(
v
==
NULL
)
if
(
v
==
NULL
)
return
null_error
();
return
null_error
();
...
@@ -1207,9 +1142,7 @@ PySequence_Fast(v, m)
...
@@ -1207,9 +1142,7 @@ PySequence_Fast(v, m)
}
}
int
int
PySequence_Count
(
s
,
o
)
PySequence_Count
(
PyObject
*
s
,
PyObject
*
o
)
PyObject
*
s
;
PyObject
*
o
;
{
{
int
l
,
i
,
n
,
cmp
,
err
;
int
l
,
i
,
n
,
cmp
,
err
;
PyObject
*
item
;
PyObject
*
item
;
...
@@ -1239,9 +1172,7 @@ PySequence_Count(s, o)
...
@@ -1239,9 +1172,7 @@ PySequence_Count(s, o)
}
}
int
int
PySequence_Contains
(
w
,
v
)
/* v in w */
PySequence_Contains
(
PyObject
*
w
,
PyObject
*
v
)
/* v in w */
PyObject
*
w
;
PyObject
*
v
;
{
{
int
i
,
cmp
;
int
i
,
cmp
;
PyObject
*
x
;
PyObject
*
x
;
...
@@ -1285,17 +1216,13 @@ PySequence_Contains(w, v) /* v in w */
...
@@ -1285,17 +1216,13 @@ PySequence_Contains(w, v) /* v in w */
/* Backwards compatibility */
/* Backwards compatibility */
#undef PySequence_In
#undef PySequence_In
int
int
PySequence_In
(
w
,
v
)
PySequence_In
(
PyObject
*
w
,
PyObject
*
v
)
PyObject
*
w
;
PyObject
*
v
;
{
{
return
PySequence_Contains
(
w
,
v
);
return
PySequence_Contains
(
w
,
v
);
}
}
int
int
PySequence_Index
(
s
,
o
)
PySequence_Index
(
PyObject
*
s
,
PyObject
*
o
)
PyObject
*
s
;
PyObject
*
o
;
{
{
int
l
,
i
,
cmp
,
err
;
int
l
,
i
,
cmp
,
err
;
PyObject
*
item
;
PyObject
*
item
;
...
@@ -1328,15 +1255,13 @@ PySequence_Index(s, o)
...
@@ -1328,15 +1255,13 @@ PySequence_Index(s, o)
/* Operations on mappings */
/* Operations on mappings */
int
int
PyMapping_Check
(
o
)
PyMapping_Check
(
PyObject
*
o
)
PyObject
*
o
;
{
{
return
o
&&
o
->
ob_type
->
tp_as_mapping
;
return
o
&&
o
->
ob_type
->
tp_as_mapping
;
}
}
int
int
PyMapping_Length
(
o
)
PyMapping_Length
(
PyObject
*
o
)
PyObject
*
o
;
{
{
PyMappingMethods
*
m
;
PyMappingMethods
*
m
;
...
@@ -1354,9 +1279,7 @@ PyMapping_Length(o)
...
@@ -1354,9 +1279,7 @@ PyMapping_Length(o)
}
}
PyObject
*
PyObject
*
PyMapping_GetItemString
(
o
,
key
)
PyMapping_GetItemString
(
PyObject
*
o
,
char
*
key
)
PyObject
*
o
;
char
*
key
;
{
{
PyObject
*
okey
,
*
r
;
PyObject
*
okey
,
*
r
;
...
@@ -1372,10 +1295,7 @@ PyMapping_GetItemString(o, key)
...
@@ -1372,10 +1295,7 @@ PyMapping_GetItemString(o, key)
}
}
int
int
PyMapping_SetItemString
(
o
,
key
,
value
)
PyMapping_SetItemString
(
PyObject
*
o
,
char
*
key
,
PyObject
*
value
)
PyObject
*
o
;
char
*
key
;
PyObject
*
value
;
{
{
PyObject
*
okey
;
PyObject
*
okey
;
int
r
;
int
r
;
...
@@ -1394,9 +1314,7 @@ PyMapping_SetItemString(o, key, value)
...
@@ -1394,9 +1314,7 @@ PyMapping_SetItemString(o, key, value)
}
}
int
int
PyMapping_HasKeyString
(
o
,
key
)
PyMapping_HasKeyString
(
PyObject
*
o
,
char
*
key
)
PyObject
*
o
;
char
*
key
;
{
{
PyObject
*
v
;
PyObject
*
v
;
...
@@ -1410,9 +1328,7 @@ PyMapping_HasKeyString(o, key)
...
@@ -1410,9 +1328,7 @@ PyMapping_HasKeyString(o, key)
}
}
int
int
PyMapping_HasKey
(
o
,
key
)
PyMapping_HasKey
(
PyObject
*
o
,
PyObject
*
key
)
PyObject
*
o
;
PyObject
*
key
;
{
{
PyObject
*
v
;
PyObject
*
v
;
...
@@ -1430,8 +1346,7 @@ PyMapping_HasKey(o, key)
...
@@ -1430,8 +1346,7 @@ PyMapping_HasKey(o, key)
/* XXX PyCallable_Check() is in object.c */
/* XXX PyCallable_Check() is in object.c */
PyObject
*
PyObject
*
PyObject_CallObject
(
o
,
a
)
PyObject_CallObject
(
PyObject
*
o
,
PyObject
*
a
)
PyObject
*
o
,
*
a
;
{
{
PyObject
*
r
;
PyObject
*
r
;
PyObject
*
args
=
a
;
PyObject
*
args
=
a
;
...
...
Objects/bufferobject.c
Dosyayı görüntüle @
79912471
...
@@ -26,11 +26,7 @@ typedef struct {
...
@@ -26,11 +26,7 @@ typedef struct {
static
PyObject
*
static
PyObject
*
_PyBuffer_FromMemory
(
base
,
ptr
,
size
,
readonly
)
_PyBuffer_FromMemory
(
PyObject
*
base
,
void
*
ptr
,
int
size
,
int
readonly
)
PyObject
*
base
;
void
*
ptr
;
int
size
;
int
readonly
;
{
{
PyBufferObject
*
b
;
PyBufferObject
*
b
;
...
@@ -57,12 +53,8 @@ _PyBuffer_FromMemory(base, ptr, size, readonly)
...
@@ -57,12 +53,8 @@ _PyBuffer_FromMemory(base, ptr, size, readonly)
}
}
static
PyObject
*
static
PyObject
*
_PyBuffer_FromObject
(
base
,
offset
,
size
,
proc
,
readonly
)
_PyBuffer_FromObject
(
PyObject
*
base
,
int
offset
,
int
size
,
PyObject
*
base
;
getreadbufferproc
proc
,
int
readonly
)
int
offset
;
int
size
;
getreadbufferproc
proc
;
int
readonly
;
{
{
PyBufferProcs
*
pb
=
base
->
ob_type
->
tp_as_buffer
;
PyBufferProcs
*
pb
=
base
->
ob_type
->
tp_as_buffer
;
void
*
p
;
void
*
p
;
...
@@ -100,10 +92,7 @@ _PyBuffer_FromObject(base, offset, size, proc, readonly)
...
@@ -100,10 +92,7 @@ _PyBuffer_FromObject(base, offset, size, proc, readonly)
PyObject
*
PyObject
*
PyBuffer_FromObject
(
base
,
offset
,
size
)
PyBuffer_FromObject
(
PyObject
*
base
,
int
offset
,
int
size
)
PyObject
*
base
;
int
offset
;
int
size
;
{
{
PyBufferProcs
*
pb
=
base
->
ob_type
->
tp_as_buffer
;
PyBufferProcs
*
pb
=
base
->
ob_type
->
tp_as_buffer
;
...
@@ -120,10 +109,7 @@ PyBuffer_FromObject(base, offset, size)
...
@@ -120,10 +109,7 @@ PyBuffer_FromObject(base, offset, size)
}
}
PyObject
*
PyObject
*
PyBuffer_FromReadWriteObject
(
base
,
offset
,
size
)
PyBuffer_FromReadWriteObject
(
PyObject
*
base
,
int
offset
,
int
size
)
PyObject
*
base
;
int
offset
;
int
size
;
{
{
PyBufferProcs
*
pb
=
base
->
ob_type
->
tp_as_buffer
;
PyBufferProcs
*
pb
=
base
->
ob_type
->
tp_as_buffer
;
...
@@ -141,24 +127,19 @@ PyBuffer_FromReadWriteObject(base, offset, size)
...
@@ -141,24 +127,19 @@ PyBuffer_FromReadWriteObject(base, offset, size)
}
}
PyObject
*
PyObject
*
PyBuffer_FromMemory
(
ptr
,
size
)
PyBuffer_FromMemory
(
void
*
ptr
,
int
size
)
void
*
ptr
;
int
size
;
{
{
return
_PyBuffer_FromMemory
(
NULL
,
ptr
,
size
,
1
);
return
_PyBuffer_FromMemory
(
NULL
,
ptr
,
size
,
1
);
}
}
PyObject
*
PyObject
*
PyBuffer_FromReadWriteMemory
(
ptr
,
size
)
PyBuffer_FromReadWriteMemory
(
void
*
ptr
,
int
size
)
void
*
ptr
;
int
size
;
{
{
return
_PyBuffer_FromMemory
(
NULL
,
ptr
,
size
,
0
);
return
_PyBuffer_FromMemory
(
NULL
,
ptr
,
size
,
0
);
}
}
PyObject
*
PyObject
*
PyBuffer_New
(
size
)
PyBuffer_New
(
int
size
)
int
size
;
{
{
PyBufferObject
*
b
;
PyBufferObject
*
b
;
...
@@ -187,17 +168,14 @@ PyBuffer_New(size)
...
@@ -187,17 +168,14 @@ PyBuffer_New(size)
/* Methods */
/* Methods */
static
void
static
void
buffer_dealloc
(
self
)
buffer_dealloc
(
PyBufferObject
*
self
)
PyBufferObject
*
self
;
{
{
Py_XDECREF
(
self
->
b_base
);
Py_XDECREF
(
self
->
b_base
);
PyObject_DEL
(
self
);
PyObject_DEL
(
self
);
}
}
static
int
static
int
buffer_compare
(
self
,
other
)
buffer_compare
(
PyBufferObject
*
self
,
PyBufferObject
*
other
)
PyBufferObject
*
self
;
PyBufferObject
*
other
;
{
{
int
len_self
=
self
->
b_size
;
int
len_self
=
self
->
b_size
;
int
len_other
=
other
->
b_size
;
int
len_other
=
other
->
b_size
;
...
@@ -212,8 +190,7 @@ buffer_compare(self, other)
...
@@ -212,8 +190,7 @@ buffer_compare(self, other)
}
}
static
PyObject
*
static
PyObject
*
buffer_repr
(
self
)
buffer_repr
(
PyBufferObject
*
self
)
PyBufferObject
*
self
;
{
{
char
buf
[
300
];
char
buf
[
300
];
char
*
status
=
self
->
b_readonly
?
"read-only"
:
"read-write"
;
char
*
status
=
self
->
b_readonly
?
"read-only"
:
"read-write"
;
...
@@ -240,8 +217,7 @@ buffer_repr(self)
...
@@ -240,8 +217,7 @@ buffer_repr(self)
}
}
static
long
static
long
buffer_hash
(
self
)
buffer_hash
(
PyBufferObject
*
self
)
PyBufferObject
*
self
;
{
{
register
int
len
;
register
int
len
;
register
unsigned
char
*
p
;
register
unsigned
char
*
p
;
...
@@ -274,8 +250,7 @@ buffer_hash(self)
...
@@ -274,8 +250,7 @@ buffer_hash(self)
}
}
static
PyObject
*
static
PyObject
*
buffer_str
(
self
)
buffer_str
(
PyBufferObject
*
self
)
PyBufferObject
*
self
;
{
{
return
PyString_FromStringAndSize
(
self
->
b_ptr
,
self
->
b_size
);
return
PyString_FromStringAndSize
(
self
->
b_ptr
,
self
->
b_size
);
}
}
...
@@ -283,16 +258,13 @@ buffer_str(self)
...
@@ -283,16 +258,13 @@ buffer_str(self)
/* Sequence methods */
/* Sequence methods */
static
int
static
int
buffer_length
(
self
)
buffer_length
(
PyBufferObject
*
self
)
PyBufferObject
*
self
;
{
{
return
self
->
b_size
;
return
self
->
b_size
;
}
}
static
PyObject
*
static
PyObject
*
buffer_concat
(
self
,
other
)
buffer_concat
(
PyBufferObject
*
self
,
PyObject
*
other
)
PyBufferObject
*
self
;
PyObject
*
other
;
{
{
PyBufferProcs
*
pb
=
other
->
ob_type
->
tp_as_buffer
;
PyBufferProcs
*
pb
=
other
->
ob_type
->
tp_as_buffer
;
char
*
p1
;
char
*
p1
;
...
@@ -344,9 +316,7 @@ buffer_concat(self, other)
...
@@ -344,9 +316,7 @@ buffer_concat(self, other)
}
}
static
PyObject
*
static
PyObject
*
buffer_repeat
(
self
,
count
)
buffer_repeat
(
PyBufferObject
*
self
,
int
count
)
PyBufferObject
*
self
;
int
count
;
{
{
PyObject
*
ob
;
PyObject
*
ob
;
register
char
*
p
;
register
char
*
p
;
...
@@ -373,9 +343,7 @@ buffer_repeat(self, count)
...
@@ -373,9 +343,7 @@ buffer_repeat(self, count)
}
}
static
PyObject
*
static
PyObject
*
buffer_item
(
self
,
idx
)
buffer_item
(
PyBufferObject
*
self
,
int
idx
)
PyBufferObject
*
self
;
int
idx
;
{
{
if
(
idx
<
0
||
idx
>=
self
->
b_size
)
if
(
idx
<
0
||
idx
>=
self
->
b_size
)
{
{
...
@@ -386,10 +354,7 @@ buffer_item(self, idx)
...
@@ -386,10 +354,7 @@ buffer_item(self, idx)
}
}
static
PyObject
*
static
PyObject
*
buffer_slice
(
self
,
left
,
right
)
buffer_slice
(
PyBufferObject
*
self
,
int
left
,
int
right
)
PyBufferObject
*
self
;
int
left
;
int
right
;
{
{
if
(
left
<
0
)
if
(
left
<
0
)
left
=
0
;
left
=
0
;
...
@@ -410,10 +375,7 @@ buffer_slice(self, left, right)
...
@@ -410,10 +375,7 @@ buffer_slice(self, left, right)
}
}
static
int
static
int
buffer_ass_item
(
self
,
idx
,
other
)
buffer_ass_item
(
PyBufferObject
*
self
,
int
idx
,
PyObject
*
other
)
PyBufferObject
*
self
;
int
idx
;
PyObject
*
other
;
{
{
PyBufferProcs
*
pb
;
PyBufferProcs
*
pb
;
void
*
p
;
void
*
p
;
...
@@ -460,11 +422,7 @@ buffer_ass_item(self, idx, other)
...
@@ -460,11 +422,7 @@ buffer_ass_item(self, idx, other)
}
}
static
int
static
int
buffer_ass_slice
(
self
,
left
,
right
,
other
)
buffer_ass_slice
(
PyBufferObject
*
self
,
int
left
,
int
right
,
PyObject
*
other
)
PyBufferObject
*
self
;
int
left
;
int
right
;
PyObject
*
other
;
{
{
PyBufferProcs
*
pb
;
PyBufferProcs
*
pb
;
void
*
p
;
void
*
p
;
...
@@ -521,10 +479,7 @@ buffer_ass_slice(self, left, right, other)
...
@@ -521,10 +479,7 @@ buffer_ass_slice(self, left, right, other)
/* Buffer methods */
/* Buffer methods */
static
int
static
int
buffer_getreadbuf
(
self
,
idx
,
pp
)
buffer_getreadbuf
(
PyBufferObject
*
self
,
int
idx
,
void
**
pp
)
PyBufferObject
*
self
;
int
idx
;
void
**
pp
;
{
{
if
(
idx
!=
0
)
{
if
(
idx
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
PyErr_SetString
(
PyExc_SystemError
,
...
@@ -536,10 +491,7 @@ buffer_getreadbuf(self, idx, pp)
...
@@ -536,10 +491,7 @@ buffer_getreadbuf(self, idx, pp)
}
}
static
int
static
int
buffer_getwritebuf
(
self
,
idx
,
pp
)
buffer_getwritebuf
(
PyBufferObject
*
self
,
int
idx
,
void
**
pp
)
PyBufferObject
*
self
;
int
idx
;
void
**
pp
;
{
{
if
(
self
->
b_readonly
)
if
(
self
->
b_readonly
)
{
{
...
@@ -550,9 +502,7 @@ buffer_getwritebuf(self, idx, pp)
...
@@ -550,9 +502,7 @@ buffer_getwritebuf(self, idx, pp)
}
}
static
int
static
int
buffer_getsegcount
(
self
,
lenp
)
buffer_getsegcount
(
PyBufferObject
*
self
,
int
*
lenp
)
PyBufferObject
*
self
;
int
*
lenp
;
{
{
if
(
lenp
)
if
(
lenp
)
*
lenp
=
self
->
b_size
;
*
lenp
=
self
->
b_size
;
...
@@ -560,10 +510,7 @@ buffer_getsegcount(self, lenp)
...
@@ -560,10 +510,7 @@ buffer_getsegcount(self, lenp)
}
}
static
int
static
int
buffer_getcharbuf
(
self
,
idx
,
pp
)
buffer_getcharbuf
(
PyBufferObject
*
self
,
int
idx
,
const
char
**
pp
)
PyBufferObject
*
self
;
int
idx
;
const
char
**
pp
;
{
{
if
(
idx
!=
0
)
{
if
(
idx
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
PyErr_SetString
(
PyExc_SystemError
,
...
@@ -616,4 +563,3 @@ PyTypeObject PyBuffer_Type = {
...
@@ -616,4 +563,3 @@ PyTypeObject PyBuffer_Type = {
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
0
,
/*tp_doc*/
0
,
/*tp_doc*/
};
};
Objects/classobject.c
Dosyayı görüntüle @
79912471
...
@@ -21,11 +21,10 @@ static PyObject *instance_getattr2(PyInstanceObject *, PyObject *);
...
@@ -21,11 +21,10 @@ static PyObject *instance_getattr2(PyInstanceObject *, PyObject *);
static
PyObject
*
getattrstr
,
*
setattrstr
,
*
delattrstr
;
static
PyObject
*
getattrstr
,
*
setattrstr
,
*
delattrstr
;
PyObject
*
PyObject
*
PyClass_New
(
bases
,
dict
,
name
)
PyClass_New
(
PyObject
*
bases
,
PyObject
*
dict
,
PyObject
*
name
)
PyObject
*
bases
;
/* NULL or tuple of classobjects! */
/* bases is NULL or tuple of classobjects! */
PyObject
*
dict
;
PyObject
*
name
;
{
{
PyClassObject
*
op
,
*
dummy
;
PyClassObject
*
op
,
*
dummy
;
static
PyObject
*
docstr
,
*
modstr
,
*
namestr
;
static
PyObject
*
docstr
,
*
modstr
,
*
namestr
;
...
@@ -118,8 +117,7 @@ PyClass_New(bases, dict, name)
...
@@ -118,8 +117,7 @@ PyClass_New(bases, dict, name)
/* Class methods */
/* Class methods */
static
void
static
void
class_dealloc
(
op
)
class_dealloc
(
PyClassObject
*
op
)
PyClassObject
*
op
;
{
{
PyObject_GC_Fini
(
op
);
PyObject_GC_Fini
(
op
);
Py_DECREF
(
op
->
cl_bases
);
Py_DECREF
(
op
->
cl_bases
);
...
@@ -133,10 +131,7 @@ class_dealloc(op)
...
@@ -133,10 +131,7 @@ class_dealloc(op)
}
}
static
PyObject
*
static
PyObject
*
class_lookup
(
cp
,
name
,
pclass
)
class_lookup
(
PyClassObject
*
cp
,
PyObject
*
name
,
PyClassObject
**
pclass
)
PyClassObject
*
cp
;
PyObject
*
name
;
PyClassObject
**
pclass
;
{
{
int
i
,
n
;
int
i
,
n
;
PyObject
*
value
=
PyDict_GetItem
(
cp
->
cl_dict
,
name
);
PyObject
*
value
=
PyDict_GetItem
(
cp
->
cl_dict
,
name
);
...
@@ -157,9 +152,7 @@ class_lookup(cp, name, pclass)
...
@@ -157,9 +152,7 @@ class_lookup(cp, name, pclass)
}
}
static
PyObject
*
static
PyObject
*
class_getattr
(
op
,
name
)
class_getattr
(
register
PyClassObject
*
op
,
PyObject
*
name
)
register
PyClassObject
*
op
;
PyObject
*
name
;
{
{
register
PyObject
*
v
;
register
PyObject
*
v
;
register
char
*
sname
=
PyString_AsString
(
name
);
register
char
*
sname
=
PyString_AsString
(
name
);
...
@@ -203,9 +196,7 @@ class_getattr(op, name)
...
@@ -203,9 +196,7 @@ class_getattr(op, name)
}
}
static
void
static
void
set_slot
(
slot
,
v
)
set_slot
(
PyObject
**
slot
,
PyObject
*
v
)
PyObject
**
slot
;
PyObject
*
v
;
{
{
PyObject
*
temp
=
*
slot
;
PyObject
*
temp
=
*
slot
;
Py_XINCREF
(
v
);
Py_XINCREF
(
v
);
...
@@ -214,8 +205,7 @@ set_slot(slot, v)
...
@@ -214,8 +205,7 @@ set_slot(slot, v)
}
}
static
void
static
void
set_attr_slots
(
c
)
set_attr_slots
(
PyClassObject
*
c
)
PyClassObject
*
c
;
{
{
PyClassObject
*
dummy
;
PyClassObject
*
dummy
;
...
@@ -225,9 +215,7 @@ set_attr_slots(c)
...
@@ -225,9 +215,7 @@ set_attr_slots(c)
}
}
static
char
*
static
char
*
set_dict
(
c
,
v
)
set_dict
(
PyClassObject
*
c
,
PyObject
*
v
)
PyClassObject
*
c
;
PyObject
*
v
;
{
{
if
(
v
==
NULL
||
!
PyDict_Check
(
v
))
if
(
v
==
NULL
||
!
PyDict_Check
(
v
))
return
"__dict__ must be a dictionary object"
;
return
"__dict__ must be a dictionary object"
;
...
@@ -237,9 +225,7 @@ set_dict(c, v)
...
@@ -237,9 +225,7 @@ set_dict(c, v)
}
}
static
char
*
static
char
*
set_bases
(
c
,
v
)
set_bases
(
PyClassObject
*
c
,
PyObject
*
v
)
PyClassObject
*
c
;
PyObject
*
v
;
{
{
int
i
,
n
;
int
i
,
n
;
...
@@ -259,9 +245,7 @@ set_bases(c, v)
...
@@ -259,9 +245,7 @@ set_bases(c, v)
}
}
static
char
*
static
char
*
set_name
(
c
,
v
)
set_name
(
PyClassObject
*
c
,
PyObject
*
v
)
PyClassObject
*
c
;
PyObject
*
v
;
{
{
if
(
v
==
NULL
||
!
PyString_Check
(
v
))
if
(
v
==
NULL
||
!
PyString_Check
(
v
))
return
"__name__ must be a string object"
;
return
"__name__ must be a string object"
;
...
@@ -272,10 +256,7 @@ set_name(c, v)
...
@@ -272,10 +256,7 @@ set_name(c, v)
}
}
static
int
static
int
class_setattr
(
op
,
name
,
v
)
class_setattr
(
PyClassObject
*
op
,
PyObject
*
name
,
PyObject
*
v
)
PyClassObject
*
op
;
PyObject
*
name
;
PyObject
*
v
;
{
{
char
*
sname
;
char
*
sname
;
if
(
PyEval_GetRestricted
())
{
if
(
PyEval_GetRestricted
())
{
...
@@ -322,8 +303,7 @@ class_setattr(op, name, v)
...
@@ -322,8 +303,7 @@ class_setattr(op, name, v)
}
}
static
PyObject
*
static
PyObject
*
class_repr
(
op
)
class_repr
(
PyClassObject
*
op
)
PyClassObject
*
op
;
{
{
PyObject
*
mod
=
PyDict_GetItemString
(
op
->
cl_dict
,
"__module__"
);
PyObject
*
mod
=
PyDict_GetItemString
(
op
->
cl_dict
,
"__module__"
);
char
buf
[
140
];
char
buf
[
140
];
...
@@ -342,8 +322,7 @@ class_repr(op)
...
@@ -342,8 +322,7 @@ class_repr(op)
}
}
static
PyObject
*
static
PyObject
*
class_str
(
op
)
class_str
(
PyClassObject
*
op
)
PyClassObject
*
op
;
{
{
PyObject
*
mod
=
PyDict_GetItemString
(
op
->
cl_dict
,
"__module__"
);
PyObject
*
mod
=
PyDict_GetItemString
(
op
->
cl_dict
,
"__module__"
);
PyObject
*
name
=
op
->
cl_name
;
PyObject
*
name
=
op
->
cl_name
;
...
@@ -433,9 +412,7 @@ PyTypeObject PyClass_Type = {
...
@@ -433,9 +412,7 @@ PyTypeObject PyClass_Type = {
};
};
int
int
PyClass_IsSubclass
(
class
,
base
)
PyClass_IsSubclass
(
PyObject
*
class
,
PyObject
*
base
)
PyObject
*
class
;
PyObject
*
base
;
{
{
int
i
,
n
;
int
i
,
n
;
PyClassObject
*
cp
;
PyClassObject
*
cp
;
...
@@ -456,10 +433,7 @@ PyClass_IsSubclass(class, base)
...
@@ -456,10 +433,7 @@ PyClass_IsSubclass(class, base)
/* Instance objects */
/* Instance objects */
PyObject
*
PyObject
*
PyInstance_New
(
class
,
arg
,
kw
)
PyInstance_New
(
PyObject
*
class
,
PyObject
*
arg
,
PyObject
*
kw
)
PyObject
*
class
;
PyObject
*
arg
;
PyObject
*
kw
;
{
{
register
PyInstanceObject
*
inst
;
register
PyInstanceObject
*
inst
;
PyObject
*
init
;
PyObject
*
init
;
...
@@ -517,8 +491,7 @@ PyInstance_New(class, arg, kw)
...
@@ -517,8 +491,7 @@ PyInstance_New(class, arg, kw)
/* Instance methods */
/* Instance methods */
static
void
static
void
instance_dealloc
(
inst
)
instance_dealloc
(
register
PyInstanceObject
*
inst
)
register
PyInstanceObject
*
inst
;
{
{
PyObject
*
error_type
,
*
error_value
,
*
error_traceback
;
PyObject
*
error_type
,
*
error_value
,
*
error_traceback
;
PyObject
*
del
;
PyObject
*
del
;
...
@@ -597,9 +570,7 @@ instance_dealloc(inst)
...
@@ -597,9 +570,7 @@ instance_dealloc(inst)
}
}
static
PyObject
*
static
PyObject
*
instance_getattr1
(
inst
,
name
)
instance_getattr1
(
register
PyInstanceObject
*
inst
,
PyObject
*
name
)
register
PyInstanceObject
*
inst
;
PyObject
*
name
;
{
{
register
PyObject
*
v
;
register
PyObject
*
v
;
register
char
*
sname
=
PyString_AsString
(
name
);
register
char
*
sname
=
PyString_AsString
(
name
);
...
@@ -627,9 +598,7 @@ instance_getattr1(inst, name)
...
@@ -627,9 +598,7 @@ instance_getattr1(inst, name)
}
}
static
PyObject
*
static
PyObject
*
instance_getattr2
(
inst
,
name
)
instance_getattr2
(
register
PyInstanceObject
*
inst
,
PyObject
*
name
)
register
PyInstanceObject
*
inst
;
PyObject
*
name
;
{
{
register
PyObject
*
v
;
register
PyObject
*
v
;
PyClassObject
*
class
;
PyClassObject
*
class
;
...
@@ -664,9 +633,7 @@ instance_getattr2(inst, name)
...
@@ -664,9 +633,7 @@ instance_getattr2(inst, name)
}
}
static
PyObject
*
static
PyObject
*
instance_getattr
(
inst
,
name
)
instance_getattr
(
register
PyInstanceObject
*
inst
,
PyObject
*
name
)
register
PyInstanceObject
*
inst
;
PyObject
*
name
;
{
{
register
PyObject
*
func
,
*
res
;
register
PyObject
*
func
,
*
res
;
res
=
instance_getattr1
(
inst
,
name
);
res
=
instance_getattr1
(
inst
,
name
);
...
@@ -683,10 +650,7 @@ instance_getattr(inst, name)
...
@@ -683,10 +650,7 @@ instance_getattr(inst, name)
}
}
static
int
static
int
instance_setattr1
(
inst
,
name
,
v
)
instance_setattr1
(
PyInstanceObject
*
inst
,
PyObject
*
name
,
PyObject
*
v
)
PyInstanceObject
*
inst
;
PyObject
*
name
;
PyObject
*
v
;
{
{
if
(
v
==
NULL
)
{
if
(
v
==
NULL
)
{
int
rv
=
PyDict_DelItem
(
inst
->
in_dict
,
name
);
int
rv
=
PyDict_DelItem
(
inst
->
in_dict
,
name
);
...
@@ -700,10 +664,7 @@ instance_setattr1(inst, name, v)
...
@@ -700,10 +664,7 @@ instance_setattr1(inst, name, v)
}
}
static
int
static
int
instance_setattr
(
inst
,
name
,
v
)
instance_setattr
(
PyInstanceObject
*
inst
,
PyObject
*
name
,
PyObject
*
v
)
PyInstanceObject
*
inst
;
PyObject
*
name
;
PyObject
*
v
;
{
{
PyObject
*
func
,
*
args
,
*
res
,
*
tmp
;
PyObject
*
func
,
*
args
,
*
res
,
*
tmp
;
char
*
sname
=
PyString_AsString
(
name
);
char
*
sname
=
PyString_AsString
(
name
);
...
@@ -767,8 +728,7 @@ instance_setattr(inst, name, v)
...
@@ -767,8 +728,7 @@ instance_setattr(inst, name, v)
}
}
static
PyObject
*
static
PyObject
*
instance_repr
(
inst
)
instance_repr
(
PyInstanceObject
*
inst
)
PyInstanceObject
*
inst
;
{
{
PyObject
*
func
;
PyObject
*
func
;
PyObject
*
res
;
PyObject
*
res
;
...
@@ -803,16 +763,14 @@ instance_repr(inst)
...
@@ -803,16 +763,14 @@ instance_repr(inst)
}
}
static
PyObject
*
static
PyObject
*
instance_compare1
(
inst
,
other
)
instance_compare1
(
PyObject
*
inst
,
PyObject
*
other
)
PyObject
*
inst
,
*
other
;
{
{
return
PyInstance_DoBinOp
(
inst
,
other
,
"__cmp__"
,
"__rcmp__"
,
return
PyInstance_DoBinOp
(
inst
,
other
,
"__cmp__"
,
"__rcmp__"
,
instance_compare1
);
instance_compare1
);
}
}
static
int
static
int
instance_compare
(
inst
,
other
)
instance_compare
(
PyObject
*
inst
,
PyObject
*
other
)
PyObject
*
inst
,
*
other
;
{
{
PyObject
*
result
;
PyObject
*
result
;
long
outcome
;
long
outcome
;
...
@@ -835,8 +793,7 @@ instance_compare(inst, other)
...
@@ -835,8 +793,7 @@ instance_compare(inst, other)
}
}
static
long
static
long
instance_hash
(
inst
)
instance_hash
(
PyInstanceObject
*
inst
)
PyInstanceObject
*
inst
;
{
{
PyObject
*
func
;
PyObject
*
func
;
PyObject
*
res
;
PyObject
*
res
;
...
@@ -898,8 +855,7 @@ instance_traverse(PyInstanceObject *o, visitproc visit, void *arg)
...
@@ -898,8 +855,7 @@ instance_traverse(PyInstanceObject *o, visitproc visit, void *arg)
static
PyObject
*
getitemstr
,
*
setitemstr
,
*
delitemstr
,
*
lenstr
;
static
PyObject
*
getitemstr
,
*
setitemstr
,
*
delitemstr
,
*
lenstr
;
static
int
static
int
instance_length
(
inst
)
instance_length
(
PyInstanceObject
*
inst
)
PyInstanceObject
*
inst
;
{
{
PyObject
*
func
;
PyObject
*
func
;
PyObject
*
res
;
PyObject
*
res
;
...
@@ -930,9 +886,7 @@ instance_length(inst)
...
@@ -930,9 +886,7 @@ instance_length(inst)
}
}
static
PyObject
*
static
PyObject
*
instance_subscript
(
inst
,
key
)
instance_subscript
(
PyInstanceObject
*
inst
,
PyObject
*
key
)
PyInstanceObject
*
inst
;
PyObject
*
key
;
{
{
PyObject
*
func
;
PyObject
*
func
;
PyObject
*
arg
;
PyObject
*
arg
;
...
@@ -955,10 +909,7 @@ instance_subscript(inst, key)
...
@@ -955,10 +909,7 @@ instance_subscript(inst, key)
}
}
static
int
static
int
instance_ass_subscript
(
inst
,
key
,
value
)
instance_ass_subscript
(
PyInstanceObject
*
inst
,
PyObject
*
key
,
PyObject
*
value
)
PyInstanceObject
*
inst
;
PyObject
*
key
;
PyObject
*
value
;
{
{
PyObject
*
func
;
PyObject
*
func
;
PyObject
*
arg
;
PyObject
*
arg
;
...
@@ -1000,9 +951,7 @@ static PyMappingMethods instance_as_mapping = {
...
@@ -1000,9 +951,7 @@ static PyMappingMethods instance_as_mapping = {
};
};
static
PyObject
*
static
PyObject
*
instance_item
(
inst
,
i
)
instance_item
(
PyInstanceObject
*
inst
,
int
i
)
PyInstanceObject
*
inst
;
int
i
;
{
{
PyObject
*
func
,
*
arg
,
*
res
;
PyObject
*
func
,
*
arg
,
*
res
;
...
@@ -1023,9 +972,7 @@ instance_item(inst, i)
...
@@ -1023,9 +972,7 @@ instance_item(inst, i)
}
}
static
PyObject
*
static
PyObject
*
instance_slice
(
inst
,
i
,
j
)
instance_slice
(
PyInstanceObject
*
inst
,
int
i
,
int
j
)
PyInstanceObject
*
inst
;
int
i
,
j
;
{
{
PyObject
*
func
,
*
arg
,
*
res
;
PyObject
*
func
,
*
arg
,
*
res
;
static
PyObject
*
getslicestr
;
static
PyObject
*
getslicestr
;
...
@@ -1047,10 +994,7 @@ instance_slice(inst, i, j)
...
@@ -1047,10 +994,7 @@ instance_slice(inst, i, j)
}
}
static
int
static
int
instance_ass_item
(
inst
,
i
,
item
)
instance_ass_item
(
PyInstanceObject
*
inst
,
int
i
,
PyObject
*
item
)
PyInstanceObject
*
inst
;
int
i
;
PyObject
*
item
;
{
{
PyObject
*
func
,
*
arg
,
*
res
;
PyObject
*
func
,
*
arg
,
*
res
;
...
@@ -1084,10 +1028,7 @@ instance_ass_item(inst, i, item)
...
@@ -1084,10 +1028,7 @@ instance_ass_item(inst, i, item)
}
}
static
int
static
int
instance_ass_slice
(
inst
,
i
,
j
,
value
)
instance_ass_slice
(
PyInstanceObject
*
inst
,
int
i
,
int
j
,
PyObject
*
value
)
PyInstanceObject
*
inst
;
int
i
,
j
;
PyObject
*
value
;
{
{
PyObject
*
func
,
*
arg
,
*
res
;
PyObject
*
func
,
*
arg
,
*
res
;
static
PyObject
*
setslicestr
,
*
delslicestr
;
static
PyObject
*
setslicestr
,
*
delslicestr
;
...
@@ -1176,7 +1117,8 @@ static int instance_contains(PyInstanceObject *inst, PyObject *member)
...
@@ -1176,7 +1117,8 @@ static int instance_contains(PyInstanceObject *inst, PyObject *member)
return
ret
;
return
ret
;
}
}
static
PySequenceMethods
instance_as_sequence
=
{
static
PySequenceMethods
instance_as_sequence
=
{
(
inquiry
)
instance_length
,
/*sq_length*/
(
inquiry
)
instance_length
,
/*sq_length*/
0
,
/*sq_concat*/
0
,
/*sq_concat*/
0
,
/*sq_repeat*/
0
,
/*sq_repeat*/
...
@@ -1188,9 +1130,7 @@ static PySequenceMethods instance_as_sequence = {
...
@@ -1188,9 +1130,7 @@ static PySequenceMethods instance_as_sequence = {
};
};
static
PyObject
*
static
PyObject
*
generic_unary_op
(
self
,
methodname
)
generic_unary_op
(
PyInstanceObject
*
self
,
PyObject
*
methodname
)
PyInstanceObject
*
self
;
PyObject
*
methodname
;
{
{
PyObject
*
func
,
*
res
;
PyObject
*
func
,
*
res
;
...
@@ -1203,19 +1143,16 @@ generic_unary_op(self, methodname)
...
@@ -1203,19 +1143,16 @@ generic_unary_op(self, methodname)
/* Forward */
/* Forward */
static
int
halfbinop
(
PyObject
*
,
PyObject
*
,
char
*
,
PyObject
**
,
static
int
PyObject
*
(
*
)(
PyObject
*
,
PyObject
*
),
int
);
halfbinop
(
PyObject
*
,
PyObject
*
,
char
*
,
PyObject
**
,
PyObject
*
(
*
)(
PyObject
*
,
PyObject
*
),
int
);
/* Implement a binary operator involving at least one class instance. */
/* Implement a binary operator involving at least one class instance. */
PyObject
*
PyObject
*
PyInstance_DoBinOp
(
v
,
w
,
opname
,
ropname
,
thisfunc
)
PyInstance_DoBinOp
(
PyObject
*
v
,
PyObject
*
w
,
char
*
opname
,
char
*
ropname
,
PyObject
*
v
;
PyObject
*
(
*
thisfunc
)(
PyObject
*
,
PyObject
*
))
PyObject
*
w
;
char
*
opname
;
char
*
ropname
;
PyObject
*
(
*
thisfunc
)(
PyObject
*
,
PyObject
*
);
{
{
char
buf
[
256
];
char
buf
[
256
];
PyObject
*
result
=
NULL
;
PyObject
*
result
=
NULL
;
...
@@ -1244,13 +1181,8 @@ PyInstance_DoBinOp(v, w, opname, ropname, thisfunc)
...
@@ -1244,13 +1181,8 @@ PyInstance_DoBinOp(v, w, opname, ropname, thisfunc)
static
PyObject
*
coerce_obj
;
static
PyObject
*
coerce_obj
;
static
int
static
int
halfbinop
(
v
,
w
,
opname
,
r_result
,
thisfunc
,
swapped
)
halfbinop
(
PyObject
*
v
,
PyObject
*
w
,
char
*
opname
,
PyObject
**
r_result
,
PyObject
*
v
;
PyObject
*
(
*
thisfunc
)(
PyObject
*
,
PyObject
*
),
int
swapped
)
PyObject
*
w
;
char
*
opname
;
PyObject
**
r_result
;
PyObject
*
(
*
thisfunc
)(
PyObject
*
,
PyObject
*
);
int
swapped
;
{
{
PyObject
*
func
;
PyObject
*
func
;
PyObject
*
args
;
PyObject
*
args
;
...
@@ -1326,9 +1258,7 @@ halfbinop(v, w, opname, r_result, thisfunc, swapped)
...
@@ -1326,9 +1258,7 @@ halfbinop(v, w, opname, r_result, thisfunc, swapped)
}
}
static
int
static
int
instance_coerce
(
pv
,
pw
)
instance_coerce
(
PyObject
**
pv
,
PyObject
**
pw
)
PyObject
**
pv
;
PyObject
**
pw
;
{
{
PyObject
*
v
=
*
pv
;
PyObject
*
v
=
*
pv
;
PyObject
*
w
=
*
pw
;
PyObject
*
w
=
*
pw
;
...
@@ -1395,8 +1325,7 @@ UNARY(instance_pos, "__pos__")
...
@@ -1395,8 +1325,7 @@ UNARY(instance_pos, "__pos__")
UNARY
(
instance_abs
,
"__abs__"
)
UNARY
(
instance_abs
,
"__abs__"
)
static
int
static
int
instance_nonzero
(
self
)
instance_nonzero
(
PyInstanceObject
*
self
)
PyInstanceObject
*
self
;
{
{
PyObject
*
func
,
*
res
;
PyObject
*
func
,
*
res
;
long
outcome
;
long
outcome
;
...
@@ -1444,10 +1373,7 @@ UNARY(instance_hex, "__hex__")
...
@@ -1444,10 +1373,7 @@ UNARY(instance_hex, "__hex__")
/* This version is for ternary calls only (z != None) */
/* This version is for ternary calls only (z != None) */
static
PyObject
*
static
PyObject
*
instance_pow
(
v
,
w
,
z
)
instance_pow
(
PyObject
*
v
,
PyObject
*
w
,
PyObject
*
z
)
PyObject
*
v
;
PyObject
*
w
;
PyObject
*
z
;
{
{
/* XXX Doesn't do coercions... */
/* XXX Doesn't do coercions... */
PyObject
*
func
;
PyObject
*
func
;
...
@@ -1533,10 +1459,7 @@ PyTypeObject PyInstance_Type = {
...
@@ -1533,10 +1459,7 @@ PyTypeObject PyInstance_Type = {
static
PyMethodObject
*
free_list
;
static
PyMethodObject
*
free_list
;
PyObject
*
PyObject
*
PyMethod_New
(
func
,
self
,
class
)
PyMethod_New
(
PyObject
*
func
,
PyObject
*
self
,
PyObject
*
class
)
PyObject
*
func
;
PyObject
*
self
;
PyObject
*
class
;
{
{
register
PyMethodObject
*
im
;
register
PyMethodObject
*
im
;
if
(
!
PyCallable_Check
(
func
))
{
if
(
!
PyCallable_Check
(
func
))
{
...
@@ -1564,8 +1487,7 @@ PyMethod_New(func, self, class)
...
@@ -1564,8 +1487,7 @@ PyMethod_New(func, self, class)
}
}
PyObject
*
PyObject
*
PyMethod_Function
(
im
)
PyMethod_Function
(
register
PyObject
*
im
)
register
PyObject
*
im
;
{
{
if
(
!
PyMethod_Check
(
im
))
{
if
(
!
PyMethod_Check
(
im
))
{
PyErr_BadInternalCall
();
PyErr_BadInternalCall
();
...
@@ -1575,8 +1497,7 @@ PyMethod_Function(im)
...
@@ -1575,8 +1497,7 @@ PyMethod_Function(im)
}
}
PyObject
*
PyObject
*
PyMethod_Self
(
im
)
PyMethod_Self
(
register
PyObject
*
im
)
register
PyObject
*
im
;
{
{
if
(
!
PyMethod_Check
(
im
))
{
if
(
!
PyMethod_Check
(
im
))
{
PyErr_BadInternalCall
();
PyErr_BadInternalCall
();
...
@@ -1586,8 +1507,7 @@ PyMethod_Self(im)
...
@@ -1586,8 +1507,7 @@ PyMethod_Self(im)
}
}
PyObject
*
PyObject
*
PyMethod_Class
(
im
)
PyMethod_Class
(
register
PyObject
*
im
)
register
PyObject
*
im
;
{
{
if
(
!
PyMethod_Check
(
im
))
{
if
(
!
PyMethod_Check
(
im
))
{
PyErr_BadInternalCall
();
PyErr_BadInternalCall
();
...
@@ -1611,9 +1531,7 @@ static struct memberlist instancemethod_memberlist[] = {
...
@@ -1611,9 +1531,7 @@ static struct memberlist instancemethod_memberlist[] = {
};
};
static
PyObject
*
static
PyObject
*
instancemethod_getattr
(
im
,
name
)
instancemethod_getattr
(
register
PyMethodObject
*
im
,
PyObject
*
name
)
register
PyMethodObject
*
im
;
PyObject
*
name
;
{
{
char
*
sname
=
PyString_AsString
(
name
);
char
*
sname
=
PyString_AsString
(
name
);
if
(
sname
[
0
]
==
'_'
)
{
if
(
sname
[
0
]
==
'_'
)
{
...
@@ -1632,8 +1550,7 @@ instancemethod_getattr(im, name)
...
@@ -1632,8 +1550,7 @@ instancemethod_getattr(im, name)
}
}
static
void
static
void
instancemethod_dealloc
(
im
)
instancemethod_dealloc
(
register
PyMethodObject
*
im
)
register
PyMethodObject
*
im
;
{
{
PyObject_GC_Fini
(
im
);
PyObject_GC_Fini
(
im
);
Py_DECREF
(
im
->
im_func
);
Py_DECREF
(
im
->
im_func
);
...
@@ -1644,8 +1561,7 @@ instancemethod_dealloc(im)
...
@@ -1644,8 +1561,7 @@ instancemethod_dealloc(im)
}
}
static
int
static
int
instancemethod_compare
(
a
,
b
)
instancemethod_compare
(
PyMethodObject
*
a
,
PyMethodObject
*
b
)
PyMethodObject
*
a
,
*
b
;
{
{
if
(
a
->
im_self
!=
b
->
im_self
)
if
(
a
->
im_self
!=
b
->
im_self
)
return
(
a
->
im_self
<
b
->
im_self
)
?
-
1
:
1
;
return
(
a
->
im_self
<
b
->
im_self
)
?
-
1
:
1
;
...
@@ -1653,8 +1569,7 @@ instancemethod_compare(a, b)
...
@@ -1653,8 +1569,7 @@ instancemethod_compare(a, b)
}
}
static
PyObject
*
static
PyObject
*
instancemethod_repr
(
a
)
instancemethod_repr
(
PyMethodObject
*
a
)
PyMethodObject
*
a
;
{
{
char
buf
[
240
];
char
buf
[
240
];
PyInstanceObject
*
self
=
(
PyInstanceObject
*
)(
a
->
im_self
);
PyInstanceObject
*
self
=
(
PyInstanceObject
*
)(
a
->
im_self
);
...
@@ -1696,8 +1611,7 @@ instancemethod_repr(a)
...
@@ -1696,8 +1611,7 @@ instancemethod_repr(a)
}
}
static
long
static
long
instancemethod_hash
(
a
)
instancemethod_hash
(
PyMethodObject
*
a
)
PyMethodObject
*
a
;
{
{
long
x
,
y
;
long
x
,
y
;
if
(
a
->
im_self
==
NULL
)
if
(
a
->
im_self
==
NULL
)
...
@@ -1763,7 +1677,7 @@ PyTypeObject PyMethod_Type = {
...
@@ -1763,7 +1677,7 @@ PyTypeObject PyMethod_Type = {
/* Clear out the free list */
/* Clear out the free list */
void
void
PyMethod_Fini
()
PyMethod_Fini
(
void
)
{
{
while
(
free_list
)
{
while
(
free_list
)
{
PyMethodObject
*
im
=
free_list
;
PyMethodObject
*
im
=
free_list
;
...
...
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