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
90933610
Kaydet (Commit)
90933610
authored
Haz 07, 1991
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
printobject now returns an error code
üst
dd010808
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
70 additions
and
86 deletions
+70
-86
fileobject.c
Objects/fileobject.c
+6
-3
floatobject.c
Objects/floatobject.c
+2
-1
intobject.c
Objects/intobject.c
+2
-1
listobject.c
Objects/listobject.c
+7
-6
longobject.c
Objects/longobject.c
+6
-9
methodobject.c
Objects/methodobject.c
+2
-1
moduleobject.c
Objects/moduleobject.c
+2
-1
object.c
Objects/object.c
+31
-57
bltinmodule.c
Python/bltinmodule.c
+8
-4
ceval.c
Python/ceval.c
+4
-3
No files found.
Objects/fileobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -117,17 +117,20 @@ file_dealloc(f)
free
((
char
*
)
f
);
}
static
void
static
int
file_print
(
f
,
fp
,
flags
)
fileobject
*
f
;
FILE
*
fp
;
int
flags
;
{
fprintf
(
fp
,
"<%s file "
,
f
->
f_fp
==
NULL
?
"closed"
:
"open"
);
printobject
(
f
->
f_name
,
fp
,
flags
);
if
(
printobject
(
f
->
f_name
,
fp
,
flags
)
!=
0
)
return
-
1
;
fprintf
(
fp
,
", mode "
);
printobject
(
f
->
f_mode
,
fp
,
flags
);
if
(
printobject
(
f
->
f_mode
,
fp
,
flags
)
!=
0
)
return
-
1
;
fprintf
(
fp
,
">"
);
return
0
;
}
static
object
*
...
...
Objects/floatobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -98,7 +98,7 @@ float_buf_repr(buf, v)
}
}
static
void
static
int
float_print
(
v
,
fp
,
flags
)
floatobject
*
v
;
FILE
*
fp
;
...
...
@@ -107,6 +107,7 @@ float_print(v, fp, flags)
char
buf
[
100
];
float_buf_repr
(
buf
,
v
);
fputs
(
buf
,
fp
);
return
0
;
}
static
object
*
...
...
Objects/intobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -120,13 +120,14 @@ getintvalue(op)
/* Methods */
static
void
static
int
int_print
(
v
,
fp
,
flags
)
intobject
*
v
;
FILE
*
fp
;
int
flags
;
{
fprintf
(
fp
,
"%ld"
,
v
->
ob_ival
);
return
0
;
}
static
object
*
...
...
Objects/listobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -185,7 +185,7 @@ list_dealloc(op)
free
((
ANY
*
)
op
);
}
static
void
static
int
list_print
(
op
,
fp
,
flags
)
listobject
*
op
;
FILE
*
fp
;
...
...
@@ -193,13 +193,14 @@ list_print(op, fp, flags)
{
int
i
;
fprintf
(
fp
,
"["
);
for
(
i
=
0
;
i
<
op
->
ob_size
&&
!
StopPrint
;
i
++
)
{
if
(
i
>
0
)
{
for
(
i
=
0
;
i
<
op
->
ob_size
;
i
++
)
{
if
(
i
>
0
)
fprintf
(
fp
,
", "
);
}
printobject
(
op
->
ob_item
[
i
],
fp
,
flags
)
;
if
(
printobject
(
op
->
ob_item
[
i
],
fp
,
flags
)
!=
0
)
return
-
1
;
}
fprintf
(
fp
,
"]"
);
return
0
;
}
object
*
...
...
@@ -302,7 +303,7 @@ list_concat(a, bb)
size
=
a
->
ob_size
+
b
->
ob_size
;
np
=
(
listobject
*
)
newlistobject
(
size
);
if
(
np
==
NULL
)
{
return
err_nomem
()
;
return
NULL
;
}
for
(
i
=
0
;
i
<
a
->
ob_size
;
i
++
)
{
object
*
v
=
a
->
ob_item
[
i
];
...
...
Objects/longobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -533,21 +533,18 @@ long_dealloc(v)
DEL
(
v
);
}
static
void
static
int
long_print
(
v
,
fp
,
flags
)
longobject
*
v
;
FILE
*
fp
;
int
flags
;
{
stringobject
*
str
=
long_format
(
v
,
10
);
if
(
str
==
NULL
)
{
err_clear
();
fprintf
(
fp
,
"[err]"
);
}
else
{
fprintf
(
fp
,
"%sL"
,
GETSTRINGVALUE
(
str
));
DECREF
(
str
);
}
if
(
str
==
NULL
)
return
-
1
;
fprintf
(
fp
,
"%sL"
,
GETSTRINGVALUE
(
str
));
DECREF
(
str
);
return
0
;
}
static
object
*
...
...
Objects/methodobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -85,7 +85,7 @@ meth_dealloc(m)
free
((
char
*
)
m
);
}
static
void
static
int
meth_print
(
m
,
fp
,
flags
)
methodobject
*
m
;
FILE
*
fp
;
...
...
@@ -96,6 +96,7 @@ meth_print(m, fp, flags)
else
fprintf
(
fp
,
"<built-in method '%s' of some %s object>"
,
m
->
m_name
,
m
->
m_self
->
ob_type
->
tp_name
);
return
0
;
}
static
object
*
...
...
Objects/moduleobject.c
Dosyayı görüntüle @
90933610
...
...
@@ -83,13 +83,14 @@ module_dealloc(m)
free
((
char
*
)
m
);
}
static
void
static
int
module_print
(
m
,
fp
,
flags
)
moduleobject
*
m
;
FILE
*
fp
;
int
flags
;
{
fprintf
(
fp
,
"<module '%s'>"
,
getstringvalue
(
m
->
md_name
));
return
0
;
}
static
object
*
...
...
Objects/object.c
Dosyayı görüntüle @
90933610
...
...
@@ -61,77 +61,49 @@ newvarobject(tp, size)
return
op
;
}
int
StopPrint
;
/* Flag to indicate printing must be stopped */
static
int
prlevel
;
void
int
printobject
(
op
,
fp
,
flags
)
object
*
op
;
FILE
*
fp
;
int
flags
;
{
/* Hacks to make printing a long or recursive object interruptible */
/* XXX Interrupts should leave a more permanent error */
prlevel
++
;
if
(
!
StopPrint
&&
intrcheck
())
{
fprintf
(
fp
,
"
\n
[print interrupted]
\n
"
);
StopPrint
=
1
;
if
(
intrcheck
())
{
err_set
(
KeyboardInterrupt
);
return
-
1
;
}
if
(
!
StopPrint
)
{
if
(
op
==
NULL
)
{
fprintf
(
fp
,
"<nil>"
);
}
else
{
if
(
op
->
ob_refcnt
<=
0
)
fprintf
(
fp
,
"(refcnt %d):"
,
op
->
ob_refcnt
);
if
(
op
->
ob_type
->
tp_print
==
NULL
)
{
fprintf
(
fp
,
"<%s object at %lx>"
,
op
->
ob_type
->
tp_name
,
(
long
)
op
);
}
else
{
(
*
op
->
ob_type
->
tp_print
)(
op
,
fp
,
flags
);
}
}
if
(
op
==
NULL
)
{
fprintf
(
fp
,
"<nil>"
);
}
prlevel
--
;
if
(
prlevel
==
0
)
StopPrint
=
0
;
else
{
if
(
op
->
ob_refcnt
<=
0
)
fprintf
(
fp
,
"(refcnt %d):"
,
op
->
ob_refcnt
);
if
(
op
->
ob_type
->
tp_print
==
NULL
)
fprintf
(
fp
,
"<%s object at %lx>"
,
op
->
ob_type
->
tp_name
,
(
long
)
op
);
else
return
(
*
op
->
ob_type
->
tp_print
)(
op
,
fp
,
flags
);
}
return
0
;
}
object
*
reprobject
(
v
)
object
*
v
;
{
object
*
w
=
NULL
;
/* Hacks to make converting a long or recursive object interruptible */
prlevel
++
;
if
(
!
StopPrint
&&
intrcheck
())
{
StopPrint
=
1
;
if
(
intrcheck
())
{
err_set
(
KeyboardInterrupt
);
return
NULL
;
}
if
(
!
StopPrint
)
{
if
(
v
==
NULL
)
{
w
=
newstringobject
(
"<NULL>"
);
}
else
if
(
v
->
ob_type
->
tp_repr
==
NULL
)
{
char
buf
[
100
];
sprintf
(
buf
,
"<%.80s object at %lx>"
,
v
->
ob_type
->
tp_name
,
(
long
)
v
);
w
=
newstringobject
(
buf
);
}
else
{
w
=
(
*
v
->
ob_type
->
tp_repr
)(
v
);
}
if
(
StopPrint
)
{
XDECREF
(
w
);
w
=
NULL
;
}
if
(
v
==
NULL
)
return
newstringobject
(
"<NULL>"
);
else
if
(
v
->
ob_type
->
tp_repr
==
NULL
)
{
char
buf
[
120
];
sprintf
(
buf
,
"<%.80s object at %lx>"
,
v
->
ob_type
->
tp_name
,
(
long
)
v
);
return
newstringobject
(
buf
);
}
prlevel
--
;
if
(
prlevel
==
0
)
StopPrint
=
0
;
return
w
;
else
return
(
*
v
->
ob_type
->
tp_repr
)(
v
);
}
int
...
...
@@ -191,13 +163,14 @@ There is (and should be!) no way to create other objects of this type,
so there is exactly one (which is indestructible, by the way).
*/
static
void
static
int
none_print
(
op
,
fp
,
flags
)
object
*
op
;
FILE
*
fp
;
int
flags
;
{
fprintf
(
fp
,
"None"
);
return
0
;
}
static
object
*
...
...
@@ -278,7 +251,8 @@ printrefs(fp)
fprintf
(
fp
,
"Remaining objects:
\n
"
);
for
(
op
=
refchain
.
_ob_next
;
op
!=
&
refchain
;
op
=
op
->
_ob_next
)
{
fprintf
(
fp
,
"[%d] "
,
op
->
ob_refcnt
);
printobject
(
op
,
fp
,
0
);
if
(
printobject
(
op
,
fp
,
0
)
!=
0
)
err_clear
();
putc
(
'\n'
,
fp
);
}
}
...
...
Python/bltinmodule.c
Dosyayı görüntüle @
90933610
...
...
@@ -192,8 +192,10 @@ builtin_input(self, v)
int
err
;
object
*
m
,
*
d
;
flushline
();
if
(
v
!=
NULL
)
printobject
(
v
,
out
,
PRINT_RAW
);
if
(
v
!=
NULL
)
{
if
(
printobject
(
v
,
out
,
PRINT_RAW
)
!=
0
)
return
NULL
;
}
m
=
add_module
(
"__main__"
);
d
=
getmoduledict
(
m
);
return
run_file
(
in
,
"<stdin>"
,
expr_input
,
d
,
d
);
...
...
@@ -450,8 +452,10 @@ builtin_raw_input(self, v)
{
FILE
*
out
=
sysgetfile
(
"stdout"
,
stdout
);
flushline
();
if
(
v
!=
NULL
)
printobject
(
v
,
out
,
PRINT_RAW
);
if
(
v
!=
NULL
)
{
if
(
printobject
(
v
,
out
,
PRINT_RAW
)
!=
0
)
return
NULL
;
}
return
filegetline
(
sysget
(
"stdin"
),
-
1
);
}
...
...
Python/ceval.c
Dosyayı görüntüle @
90933610
...
...
@@ -428,7 +428,7 @@ eval_code(co, globals, locals, arg)
if
(
v
!=
None
)
{
flushline
();
softspace
(
sysget
(
"stdout"
),
1
);
printobject
(
v
,
fp
,
0
);
err
=
printobject
(
v
,
fp
,
0
);
flushline
();
}
DECREF
(
v
);
...
...
@@ -447,7 +447,7 @@ eval_code(co, globals, locals, arg)
softspace
(
sysget
(
"stdout"
),
0
);
}
else
{
printobject
(
v
,
fp
,
0
);
err
=
printobject
(
v
,
fp
,
0
);
}
DECREF
(
v
);
break
;
...
...
@@ -933,7 +933,8 @@ prtrace(v, str)
char
*
str
;
{
printf
(
"%s "
,
str
);
printobject
(
v
,
stdout
,
0
);
if
(
printobject
(
v
,
stdout
,
0
)
!=
0
)
err_clear
();
/* Don't know what else to do */
printf
(
"
\n
"
);
}
#endif
...
...
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