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
bce56a6c
Kaydet (Commit)
bce56a6c
authored
May 10, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix some miscellaneous places that incorrectly insisted on str8.
üst
3b116a31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
27 deletions
+34
-27
_csv.c
Modules/_csv.c
+12
-12
datetimemodule.c
Modules/datetimemodule.c
+13
-9
posixmodule.c
Modules/posixmodule.c
+9
-6
No files found.
Modules/_csv.c
Dosyayı görüntüle @
bce56a6c
...
@@ -235,19 +235,19 @@ _set_char(const char *name, char *target, PyObject *src, char dflt)
...
@@ -235,19 +235,19 @@ _set_char(const char *name, char *target, PyObject *src, char dflt)
if
(
src
==
NULL
)
if
(
src
==
NULL
)
*
target
=
dflt
;
*
target
=
dflt
;
else
{
else
{
if
(
src
==
Py_None
||
PyString_Size
(
src
)
==
0
)
*
target
=
'\0'
;
*
target
=
'\0'
;
if
(
src
!=
Py_None
)
{
else
if
(
!
PyString_Check
(
src
)
||
PyString_Size
(
src
)
!=
1
)
{
const
char
*
buf
;
PyErr_Format
(
PyExc_TypeError
,
Py_ssize_t
len
;
"
\"
%s
\"
must be an 1-character string"
,
if
(
PyObject_AsCharBuffer
(
src
,
&
buf
,
&
len
)
<
0
||
name
);
len
>
1
)
{
return
-
1
;
PyErr_Format
(
PyExc_TypeError
,
}
"
\"
%s
\"
must be an 1-character string"
,
else
{
name
);
char
*
s
=
PyString_AsString
(
src
);
if
(
s
==
NULL
)
return
-
1
;
return
-
1
;
*
target
=
s
[
0
];
}
if
(
len
>
0
)
*
target
=
buf
[
0
];
}
}
}
}
return
0
;
return
0
;
...
...
Modules/datetimemodule.c
Dosyayı görüntüle @
bce56a6c
...
@@ -1144,7 +1144,8 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1144,7 +1144,8 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
PyObject
*
zreplacement
=
NULL
;
/* py string, replacement for %z */
PyObject
*
zreplacement
=
NULL
;
/* py string, replacement for %z */
PyObject
*
Zreplacement
=
NULL
;
/* py string, replacement for %Z */
PyObject
*
Zreplacement
=
NULL
;
/* py string, replacement for %Z */
char
*
pin
;
/* pointer to next char in input format */
const
char
*
pin
;
/* pointer to next char in input format */
Py_ssize_t
flen
;
/* length of input format */
char
ch
;
/* next char in input format */
char
ch
;
/* next char in input format */
PyObject
*
newfmt
=
NULL
;
/* py string, the output format */
PyObject
*
newfmt
=
NULL
;
/* py string, the output format */
...
@@ -1153,11 +1154,15 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1153,11 +1154,15 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
exclusive of trailing \0 */
exclusive of trailing \0 */
int
usednew
;
/* number bytes used so far in output format buffer */
int
usednew
;
/* number bytes used so far in output format buffer */
c
har
*
ptoappend
;
/* pointer to string to append to output buffer */
c
onst
char
*
ptoappend
;
/* pointer to string to append to output buffer */
int
ntoappend
;
/* # of bytes to append to output buffer */
int
ntoappend
;
/* # of bytes to append to output buffer */
assert
(
object
&&
format
&&
timetuple
);
assert
(
object
&&
format
&&
timetuple
);
assert
(
PyString_Check
(
format
));
assert
(
PyString_Check
(
format
)
||
PyUnicode_Check
(
format
));
/* Convert the input format to a C string and size */
if
(
PyObject_AsCharBuffer
(
format
,
&
pin
,
&
flen
)
<
0
)
return
NULL
;
/* Give up if the year is before 1900.
/* Give up if the year is before 1900.
* Python strftime() plays games with the year, and different
* Python strftime() plays games with the year, and different
...
@@ -1188,13 +1193,12 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1188,13 +1193,12 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
* a new format. Since computing the replacements for those codes
* a new format. Since computing the replacements for those codes
* is expensive, don't unless they're actually used.
* is expensive, don't unless they're actually used.
*/
*/
totalnew
=
PyString_Size
(
format
)
+
1
;
/* realistic if no %z/%Z */
totalnew
=
flen
+
1
;
/* realistic if no %z/%Z */
newfmt
=
PyString_FromStringAndSize
(
NULL
,
totalnew
);
newfmt
=
PyString_FromStringAndSize
(
NULL
,
totalnew
);
if
(
newfmt
==
NULL
)
goto
Done
;
if
(
newfmt
==
NULL
)
goto
Done
;
pnew
=
PyString_AsString
(
newfmt
);
pnew
=
PyString_AsString
(
newfmt
);
usednew
=
0
;
usednew
=
0
;
pin
=
PyString_AsString
(
format
);
while
((
ch
=
*
pin
++
)
!=
'\0'
)
{
while
((
ch
=
*
pin
++
)
!=
'\0'
)
{
if
(
ch
!=
'%'
)
{
if
(
ch
!=
'%'
)
{
ptoappend
=
pin
-
1
;
ptoappend
=
pin
-
1
;
...
@@ -2441,8 +2445,8 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
...
@@ -2441,8 +2445,8 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
PyObject
*
tuple
;
PyObject
*
tuple
;
static
char
*
keywords
[]
=
{
"format"
,
NULL
};
static
char
*
keywords
[]
=
{
"format"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"
O!
:strftime"
,
keywords
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"
S
:strftime"
,
keywords
,
&
PyString_Type
,
&
format
))
&
format
))
return
NULL
;
return
NULL
;
tuple
=
PyObject_CallMethod
((
PyObject
*
)
self
,
"timetuple"
,
"()"
);
tuple
=
PyObject_CallMethod
((
PyObject
*
)
self
,
"timetuple"
,
"()"
);
...
@@ -3174,8 +3178,8 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw)
...
@@ -3174,8 +3178,8 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw)
PyObject
*
tuple
;
PyObject
*
tuple
;
static
char
*
keywords
[]
=
{
"format"
,
NULL
};
static
char
*
keywords
[]
=
{
"format"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"
O!
:strftime"
,
keywords
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"
S
:strftime"
,
keywords
,
&
PyString_Type
,
&
format
))
&
format
))
return
NULL
;
return
NULL
;
/* Python's strftime does insane things with the year part of the
/* Python's strftime does insane things with the year part of the
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
bce56a6c
...
@@ -6966,13 +6966,19 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
...
@@ -6966,13 +6966,19 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
*
valuep
=
PyInt_AS_LONG
(
arg
);
*
valuep
=
PyInt_AS_LONG
(
arg
);
return
1
;
return
1
;
}
}
if
(
PyString_Check
(
arg
))
{
else
{
/* look up the value in the table using a binary search */
/* look up the value in the table using a binary search */
size_t
lo
=
0
;
size_t
lo
=
0
;
size_t
mid
;
size_t
mid
;
size_t
hi
=
tablesize
;
size_t
hi
=
tablesize
;
int
cmp
;
int
cmp
;
char
*
confname
=
PyString_AS_STRING
(
arg
);
const
char
*
confname
;
Py_ssize_t
namelen
;
if
(
PyObject_AsCharBuffer
(
arg
,
&
confname
,
&
namelen
)
<
0
)
{
PyErr_SetString
(
PyExc_TypeError
,
"configuration names must be strings or integers"
);
return
0
;
}
while
(
lo
<
hi
)
{
while
(
lo
<
hi
)
{
mid
=
(
lo
+
hi
)
/
2
;
mid
=
(
lo
+
hi
)
/
2
;
cmp
=
strcmp
(
confname
,
table
[
mid
].
name
);
cmp
=
strcmp
(
confname
,
table
[
mid
].
name
);
...
@@ -6986,11 +6992,8 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
...
@@ -6986,11 +6992,8 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
}
}
}
}
PyErr_SetString
(
PyExc_ValueError
,
"unrecognized configuration name"
);
PyErr_SetString
(
PyExc_ValueError
,
"unrecognized configuration name"
);
return
0
;
}
}
else
PyErr_SetString
(
PyExc_TypeError
,
"configuration names must be strings or integers"
);
return
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