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
8645a5c8
Kaydet (Commit)
8645a5c8
authored
Ara 29, 2009
tarafından
Amaury Forgeot d'Arc
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#7413: Passing '\0' as the separator to datetime.datetime.isoformat()
used to drop the time part of the result.
üst
fa1ffb69
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
test_datetime.py
Lib/test/test_datetime.py
+1
-0
NEWS
Misc/NEWS
+3
-0
datetimemodule.c
Modules/datetimemodule.c
+14
-9
No files found.
Lib/test/test_datetime.py
Dosyayı görüntüle @
8645a5c8
...
...
@@ -1180,6 +1180,7 @@ class TestDateTime(TestDate):
self
.
assertEqual
(
t
.
isoformat
(),
"0002-03-02T04:05:01.000123"
)
self
.
assertEqual
(
t
.
isoformat
(
'T'
),
"0002-03-02T04:05:01.000123"
)
self
.
assertEqual
(
t
.
isoformat
(
' '
),
"0002-03-02 04:05:01.000123"
)
self
.
assertEqual
(
t
.
isoformat
(
'
\x00
'
),
"0002-03-02
\x00
04:05:01.000123"
)
# str is ISO format with the separator forced to a blank.
self
.
assertEqual
(
str
(
t
),
"0002-03-02 04:05:01.000123"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
8645a5c8
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 2?
Core and Builtins
-----------------
- Issue #7413: Passing '\0' as the separator to datetime.datetime.isoformat()
used to drop the time part of the result.
- Issue #1811: improve accuracy and cross-platform consistency for
true division of integers: the result of a/b is now correctly
rounded for ints a and b (at least on IEEE 754 platforms), and in
...
...
Modules/datetimemodule.c
Dosyayı görüntüle @
8645a5c8
...
...
@@ -1362,21 +1362,26 @@ isoformat_date(PyDateTime_Date *dt, char buffer[], int bufflen)
x
=
PyOS_snprintf
(
buffer
,
bufflen
,
"%04d-%02d-%02d"
,
GET_YEAR
(
dt
),
GET_MONTH
(
dt
),
GET_DAY
(
dt
));
assert
(
bufflen
>=
x
);
return
buffer
+
x
;
}
static
void
static
char
*
isoformat_time
(
PyDateTime_DateTime
*
dt
,
char
buffer
[],
int
bufflen
)
{
int
x
;
int
us
=
DATE_GET_MICROSECOND
(
dt
);
PyOS_snprintf
(
buffer
,
bufflen
,
"%02d:%02d:%02d"
,
/* 8 characters */
DATE_GET_HOUR
(
dt
),
DATE_GET_MINUTE
(
dt
),
DATE_GET_SECOND
(
dt
));
x
=
PyOS_snprintf
(
buffer
,
bufflen
,
"%02d:%02d:%02d"
,
DATE_GET_HOUR
(
dt
),
DATE_GET_MINUTE
(
dt
),
DATE_GET_SECOND
(
dt
));
assert
(
bufflen
>=
x
);
if
(
us
)
PyOS_snprintf
(
buffer
+
8
,
bufflen
-
8
,
".%06d"
,
us
);
x
+=
PyOS_snprintf
(
buffer
+
x
,
bufflen
-
x
,
".%06d"
,
us
);
assert
(
bufflen
>=
x
);
return
buffer
+
x
;
}
/* ---------------------------------------------------------------------------
...
...
@@ -4211,8 +4216,8 @@ datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
cp
=
isoformat_date
((
PyDateTime_Date
*
)
self
,
buffer
,
sizeof
(
buffer
));
assert
(
cp
!=
NULL
);
*
cp
++
=
sep
;
isoformat_time
(
self
,
cp
,
sizeof
(
buffer
)
-
(
cp
-
buffer
));
result
=
PyString_FromString
(
buffer
);
cp
=
isoformat_time
(
self
,
cp
,
sizeof
(
buffer
)
-
(
cp
-
buffer
));
result
=
PyString_FromString
AndSize
(
buffer
,
cp
-
buffer
);
if
(
result
==
NULL
||
!
HASTZINFO
(
self
))
return
result
;
...
...
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