[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #23071 [Core Tor/Tor]: test_hs_ntor.sh fails with recent pysha3
#23071: test_hs_ntor.sh fails with recent pysha3
-----------------------------+------------------------------------
Reporter: nickm | Owner: nickm
Type: defect | Status: needs_review
Priority: Medium | Milestone: Tor: 0.3.1.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: python tests hs | Actual Points: .1
Parent ID: | Points: .1
Reviewer: asn | Sponsor: SponsorR
-----------------------------+------------------------------------
Comment (by asn):
Hmm, the code is now:
{{{
try:
import sha3
except ImportError:
# In python 3.6, the sha3 functions are in hashlib whether we
# import sha3 or not.
pass
try:
# Pull the sha3 functions in.
from hashlib import sha3_256, shake_256
shake_squeeze = shake_256.digest
except ImportError:
if hasattr(sha3, "SHA3256"):
}}}
I think there is a problem here: If the `sha3` import fails, and the `from
hashlib...` import fails, then the `if hasattr(sha3, "SHA3256"):` will
also fail since sha3 is undefined. That's when we should return 77, right?
How about the following patch on top of your patch?
{{{
- if hasattr(sha3, "SHA3256"):
+ if "sha3" in sys.modules and hasattr(sha3, "SHA3256"):
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23071#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs