-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop using assert() inappropriately. Fixes #1981
This patch also enables the Python optimizer (-OO) and hash randomization (-R) within the setup-test-sh script, just so those alternate code-paths get used and tested. Added .pyo files to .gitignore and `make clean`.
- Loading branch information
1 parent
4659df2
commit b460b44
Showing
24 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.pyc | ||
*.pyo | ||
*~ | ||
*.po | ||
*.debhelper | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -820,11 +820,12 @@ def _test_login_and_proto(self, email, settings): | |
|
||
if settings['protocol'].startswith('smtp'): | ||
try: | ||
assert(SendMail(self.session, None, | ||
[(email, | ||
[email, '[email protected]'], None, | ||
[event])], | ||
test_only=True, test_route=settings)) | ||
safe_assert( | ||
SendMail(self.session, None, | ||
[(email, | ||
[email, '[email protected]'], None, | ||
[event])], | ||
test_only=True, test_route=settings)) | ||
return True, True | ||
except (IOError, OSError, AssertionError, SendMailError): | ||
pass | ||
|
@@ -1161,7 +1162,7 @@ def setup_command(self, session): | |
|
||
if route_id: | ||
route = self.session.config.routes[route_id] | ||
assert(route) | ||
safe_assert(route) | ||
else: | ||
route = {} | ||
for k in CONFIG_RULES['routes'][1]: | ||
|
@@ -1178,16 +1179,17 @@ def setup_command(self, session): | |
if not fromaddr or '@' not in fromaddr: | ||
fromaddr = '%s@%s' % (route.get('username', 'test'), | ||
route.get('host', 'example.com')) | ||
assert(fromaddr) | ||
safe_assert(fromaddr) | ||
|
||
error_info = {'error': _('Unknown error')} | ||
try: | ||
assert(SendMail(self.session, None, | ||
[(fromaddr, | ||
[fromaddr, '[email protected]'], | ||
None, | ||
[self.event])], | ||
test_only=True, test_route=route)) | ||
safe_assert( | ||
SendMail(self.session, None, | ||
[(fromaddr, | ||
[fromaddr, '[email protected]'], | ||
None, | ||
[self.event])], | ||
test_only=True, test_route=route)) | ||
return self._success(_('Route is working'), | ||
result=route) | ||
except OSError: | ||
|
@@ -1241,7 +1243,7 @@ def auto_configure_tor(self, session, hostport=None): | |
with ConnBroker.context(need=need_tor) as context: | ||
motd = urlopen(MOTD_URL_TOR_ONLY_NO_MARS, | ||
data=None, timeout=10).read() | ||
assert(motd.strip().endswith('}')) | ||
safe_assert(motd.strip().endswith('}')) | ||
session.config.sys.proxy.protocol = 'tor' | ||
message = _('Successfully configured and enabled Tor!') | ||
except (IOError, AssertionError): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.