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
d918e4e0
Commit
d918e4e0
authored
Apr 07, 2008
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #2388: Fix gcc warnings when compiling with --enable-unicode=ucs4.
parent
295814e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
6 deletions
+25
-6
Objects/stringlib/formatter.h
Objects/stringlib/formatter.h
+13
-2
Objects/stringlib/string_format.h
Objects/stringlib/string_format.h
+11
-3
Objects/unicodeobject.c
Objects/unicodeobject.c
+1
-1
No files found.
Objects/stringlib/formatter.h
View file @
d918e4e0
...
...
@@ -785,8 +785,19 @@ FORMAT_STRING(PyObject* value, PyObject* args)
break
;
default:
/* unknown */
PyErr_Format
(
PyExc_ValueError
,
"Unknown conversion type %c"
,
format
.
type
);
#if STRINGLIB_IS_UNICODE
/* If STRINGLIB_CHAR is Py_UNICODE, %c might be out-of-range,
hence the two cases. If it is char, gcc complains that the
condition below is always true, hence the ifdef. */
if
(
format
.
type
>
32
&&
format
.
type
<
128
)
#endif
PyErr_Format
(
PyExc_ValueError
,
"Unknown conversion type %c"
,
(
char
)
format
.
type
);
#if STRINGLIB_IS_UNICODE
else
PyErr_Format
(
PyExc_ValueError
,
"Unknown conversion type '
\\
x%x'"
,
(
unsigned
int
)
format
.
type
);
#endif
goto
done
;
}
...
...
Objects/stringlib/string_format.h
View file @
d918e4e0
...
...
@@ -740,9 +740,17 @@ do_conversion(PyObject *obj, STRINGLIB_CHAR conversion)
case
's'
:
return
STRINGLIB_TOSTR
(
obj
);
default:
PyErr_Format
(
PyExc_ValueError
,
"Unknown converion specifier %c"
,
conversion
);
if
(
conversion
>
32
&&
conversion
<
127
)
{
/* It's the ASCII subrange; casting to char is safe
(assuming the execution character set is an ASCII
superset). */
PyErr_Format
(
PyExc_ValueError
,
"Unknown conversion specifier %c"
,
(
char
)
conversion
);
}
else
PyErr_Format
(
PyExc_ValueError
,
"Unknown conversion specifier
\\
x%x"
,
(
unsigned
int
)
conversion
);
return
NULL
;
}
}
...
...
Objects/unicodeobject.c
View file @
d918e4e0
...
...
@@ -8644,7 +8644,7 @@ PyObject *PyUnicode_Format(PyObject *format,
if
(
!
isnumok
)
{
PyErr_Format
(
PyExc_TypeError
,
"%%%c format: a number is required, "
"not %.200s"
,
c
,
Py_TYPE
(
v
)
->
tp_name
);
"not %.200s"
,
(
char
)
c
,
Py_TYPE
(
v
)
->
tp_name
);
goto
onError
;
}
if
(
flags
&
F_ZERO
)
...
...
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