Skip to content

Commit 8263443

Browse files
author
neal.norwitz
committed
Use unicode
git-svn-id: http://svn.python.org/projects/python/branches/py3k@57459 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 5d55871 commit 8263443

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Modules/sha256module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,18 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused)
444444
unsigned char digest[SHA_DIGESTSIZE];
445445
SHAobject temp;
446446
PyObject *retval;
447-
char *hex_digest;
447+
Py_UNICODE *hex_digest;
448448
int i, j;
449449

450450
/* Get the raw (binary) digest value */
451451
SHAcopy(self, &temp);
452452
sha_final(digest, &temp);
453453

454454
/* Create a new string */
455-
retval = PyString_FromStringAndSize(NULL, self->digestsize * 2);
455+
retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2);
456456
if (!retval)
457457
return NULL;
458-
hex_digest = PyString_AsString(retval);
458+
hex_digest = PyUnicode_AS_UNICODE(retval);
459459
if (!hex_digest) {
460460
Py_DECREF(retval);
461461
return NULL;

Modules/sha512module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,18 +510,18 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
510510
unsigned char digest[SHA_DIGESTSIZE];
511511
SHAobject temp;
512512
PyObject *retval;
513-
char *hex_digest;
513+
Py_UNICODE *hex_digest;
514514
int i, j;
515515

516516
/* Get the raw (binary) digest value */
517517
SHAcopy(self, &temp);
518518
sha512_final(digest, &temp);
519519

520520
/* Create a new string */
521-
retval = PyString_FromStringAndSize(NULL, self->digestsize * 2);
521+
retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2);
522522
if (!retval)
523523
return NULL;
524-
hex_digest = PyString_AsString(retval);
524+
hex_digest = PyUnicode_AS_UNICODE(retval);
525525
if (!hex_digest) {
526526
Py_DECREF(retval);
527527
return NULL;

0 commit comments

Comments
 (0)