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
16168477
Commit
16168477
authored
Aug 15, 2000
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
binascii_unhexlify(): Better error message, courtesy effbot.
parent
97ca66fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Modules/binascii.c
Modules/binascii.c
+5
-5
No files found.
Modules/binascii.c
View file @
16168477
...
@@ -944,12 +944,12 @@ binascii_unhexlify(PyObject *self, PyObject *args)
...
@@ -944,12 +944,12 @@ binascii_unhexlify(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"s#:a2b_hex"
,
&
argbuf
,
&
arglen
))
if
(
!
PyArg_ParseTuple
(
args
,
"s#:a2b_hex"
,
&
argbuf
,
&
arglen
))
return
NULL
;
return
NULL
;
/* XXX What should we do about
odd-lengthed strings? Should we ad
d
/* XXX What should we do about
strings with an odd length? Shoul
d
*
an implicit leading zero, or a trailing zero? For now, raise an
*
we add an implicit leading zero, or a trailing zero? For now,
* exception.
*
raise an
exception.
*/
*/
if
(
arglen
%
2
)
{
if
(
arglen
%
2
)
{
PyErr_SetString
(
PyExc_TypeError
,
"
odd lengthed
string"
);
PyErr_SetString
(
PyExc_TypeError
,
"
Odd-length
string"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -965,7 +965,7 @@ binascii_unhexlify(PyObject *self, PyObject *args)
...
@@ -965,7 +965,7 @@ binascii_unhexlify(PyObject *self, PyObject *args)
int
bot
=
to_int
(
Py_CHARMASK
(
argbuf
[
i
+
1
]));
int
bot
=
to_int
(
Py_CHARMASK
(
argbuf
[
i
+
1
]));
if
(
top
==
-
1
||
bot
==
-
1
)
{
if
(
top
==
-
1
||
bot
==
-
1
)
{
PyErr_SetString
(
PyExc_TypeError
,
PyErr_SetString
(
PyExc_TypeError
,
"
n
on-hexadecimal digit found"
);
"
N
on-hexadecimal digit found"
);
goto
finally
;
goto
finally
;
}
}
retbuf
[
j
++
]
=
(
top
<<
4
)
+
bot
;
retbuf
[
j
++
]
=
(
top
<<
4
)
+
bot
;
...
...
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