Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
eda12ecc
Commit
eda12ecc
authored
Aug 24, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch by Ero Carrera to get rid of PyString in timemodule.c.
parent
28bbe425
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
Modules/timemodule.c
Modules/timemodule.c
+10
-3
No files found.
Modules/timemodule.c
View file @
eda12ecc
...
...
@@ -377,13 +377,17 @@ time_strftime(PyObject *self, PyObject *args)
PyObject
*
tup
=
NULL
;
struct
tm
buf
;
const
char
*
fmt
;
PyObject
*
format
;
size_t
fmtlen
,
buflen
;
char
*
outbuf
=
0
;
size_t
i
;
memset
((
void
*
)
&
buf
,
'\0'
,
sizeof
(
buf
));
if
(
!
PyArg_ParseTuple
(
args
,
"s|O:strftime"
,
&
fmt
,
&
tup
))
/* Will always expect a unicode string to be passed as format.
Given that there's no str type anymore in py3k this seems safe.
*/
if
(
!
PyArg_ParseTuple
(
args
,
"U|O:strftime"
,
&
format
,
&
tup
))
return
NULL
;
if
(
tup
==
NULL
)
{
...
...
@@ -458,6 +462,9 @@ time_strftime(PyObject *self, PyObject *args)
return
NULL
;
}
/* Convert the unicode string to an ascii one */
fmt
=
PyUnicode_AsString
(
format
);
fmtlen
=
strlen
(
fmt
);
/* I hate these functions that presume you know how big the output
...
...
@@ -535,7 +542,7 @@ time_asctime(PyObject *self, PyObject *args)
p
=
asctime
(
&
buf
);
if
(
p
[
24
]
==
'\n'
)
p
[
24
]
=
'\0'
;
return
Py
String
_FromString
(
p
);
return
Py
Unicode
_FromString
(
p
);
}
PyDoc_STRVAR
(
asctime_doc
,
...
...
@@ -571,7 +578,7 @@ time_ctime(PyObject *self, PyObject *args)
}
if
(
p
[
24
]
==
'\n'
)
p
[
24
]
=
'\0'
;
return
Py
String
_FromString
(
p
);
return
Py
Unicode
_FromString
(
p
);
}
PyDoc_STRVAR
(
ctime_doc
,
...
...
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