summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2022-01-30 17:13:02 +0100
committerGitHub <noreply@github.com>2022-01-30 11:13:02 -0500
commit07f19b6350bfa2c293b11ba781394052ee333a54 (patch)
tree2d57e39de5bc861c60ff2eea21a40efa754c503f
parentee3a7c245a0dc931f27b85b1cee430c61807182d (diff)
downloadpyopenssl-07f19b6350bfa2c293b11ba781394052ee333a54.tar.gz
Remove superfluous isinstance() call (#1087)
- hex() returns always str - don’t redefine variable
-rw-r--r--src/OpenSSL/crypto.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index c3ac618..ff23062 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -1299,15 +1299,14 @@ class X509(object):
raise TypeError("serial must be an integer")
hex_serial = hex(serial)[2:]
- if not isinstance(hex_serial, bytes):
- hex_serial = hex_serial.encode("ascii")
+ hex_serial_bytes = hex_serial.encode("ascii")
bignum_serial = _ffi.new("BIGNUM**")
# BN_hex2bn stores the result in &bignum. Unless it doesn't feel like
# it. If bignum is still NULL after this call, then the return value
# is actually the result. I hope. -exarkun
- small_serial = _lib.BN_hex2bn(bignum_serial, hex_serial)
+ small_serial = _lib.BN_hex2bn(bignum_serial, hex_serial_bytes)
if bignum_serial[0] == _ffi.NULL:
set_result = _lib.ASN1_INTEGER_set(