Show More
@@ -653,24 +653,24 static int sha1hash(char hash[20], const | |||||
653 | PyObject *shaobj, *hashobj; |
|
653 | PyObject *shaobj, *hashobj; | |
654 |
|
654 | |||
655 | if (shafunc == NULL) { |
|
655 | if (shafunc == NULL) { | |
656 |
PyObject * |
|
656 | PyObject *hashlib, *name = PyString_FromString("hashlib"); | |
657 |
|
657 | |||
658 | if (name == NULL) |
|
658 | if (name == NULL) | |
659 | return -1; |
|
659 | return -1; | |
660 |
|
660 | |||
661 |
|
|
661 | hashlib = PyImport_Import(name); | |
662 | Py_DECREF(name); |
|
662 | Py_DECREF(name); | |
663 |
|
663 | |||
664 |
if ( |
|
664 | if (hashlib == NULL) { | |
665 |
PyErr_SetString(PyExc_ImportError, " |
|
665 | PyErr_SetString(PyExc_ImportError, "hashlib"); | |
666 | return -1; |
|
666 | return -1; | |
667 | } |
|
667 | } | |
668 |
shafunc = PyObject_GetAttrString( |
|
668 | shafunc = PyObject_GetAttrString(hashlib, "sha1"); | |
669 |
Py_DECREF( |
|
669 | Py_DECREF(hashlib); | |
670 |
|
670 | |||
671 | if (shafunc == NULL) { |
|
671 | if (shafunc == NULL) { | |
672 | PyErr_SetString(PyExc_AttributeError, |
|
672 | PyErr_SetString(PyExc_AttributeError, | |
673 |
"module ' |
|
673 | "module 'hashlib' has no " | |
674 | "attribute 'sha1'"); |
|
674 | "attribute 'sha1'"); | |
675 | return -1; |
|
675 | return -1; | |
676 | } |
|
676 | } |
General Comments 0
You need to be logged in to leave comments.
Login now