Skip to content

Commit

Permalink
Merge pull request #678 from t184256/ordered-dict-fix
Browse files Browse the repository at this point in the history
fixup ordered_dict for Python 3.9
  • Loading branch information
tomato42 committed Aug 24, 2020
2 parents 7fe42c0 + cbc6384 commit cd8190d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
47 changes: 46 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
- python: 3.8
dist: xenial
sudo: true
- python: 3.9-dev
dist: xenial
sudo: true
- python: nightly
dist: xenial
sudo: true
# ANALYSIS_DEP=false EXTRACT_DEP=true
- python: 2.6
env: EXTRACT_DEP=true
Expand All @@ -52,6 +58,14 @@ jobs:
dist: xenial
sudo: true
env: EXTRACT_DEP=true
- python: 3.9-dev
dist: xenial
sudo: true
env: EXTRACT_DEP=true
- python: nightly
dist: xenial
sudo: true
env: EXTRACT_DEP=true
# ANALYSIS_DEP=true EXTRACT_DEP=false
- python: 3.6
env: ANALYSIS_DEP=true
Expand All @@ -63,6 +77,14 @@ jobs:
dist: xenial
sudo: true
env: ANALYSIS_DEP=true
- python: 3.9-dev
dist: xenial
sudo: true
env: ANALYSIS_DEP=true
- python: nightly
dist: xenial
sudo: true
env: ANALYSIS_DEP=true
# ANALYSIS_DEP=EXTRACT_DEP=true
- python: 3.6
env: ANALYSIS_DEP=true EXTRACT_DEP=true
Expand All @@ -74,6 +96,22 @@ jobs:
dist: xenial
sudo: true
env: ANALYSIS_DEP=true EXTRACT_DEP=true CC_REPORT=true
- python: 3.9-dev
dist: xenial
sudo: true
env: ANALYSIS_DEP=true EXTRACT_DEP=true CC_REPORT=true
- python: nightly
dist: xenial
sudo: true
env: ANALYSIS_DEP=true EXTRACT_DEP=true CC_REPORT=true
allow_failures:
# lazy-object-proxy fails to build
- python: nightly
# scipy fails to build
- python: 3.9-dev
env: ANALYSIS_DEP=true
- python: 3.9-dev
env: ANALYSIS_DEP=true EXTRACT_DEP=true CC_REPORT=true

branches:
only:
Expand Down Expand Up @@ -129,11 +167,18 @@ script:
# check if all scripts are included in the json files
- python tests/verify-scripts-json.py tests/tlslite-ng-random-subset.json tests/tlslite-ng.json
# the HTTP header includes python version, since "2.7.15" is longer than "2.6.9", the reply itself is longer too
# more generally, it should be `1845 + len(sys.version.split()[0])`,
# as http.server uses `sys_version = "Python/" + sys.version.split()[0]`
# https://github.com/python/cpython/blob/2c050e52f1ccf5db03819e4ed70690521d67e9fa/Lib/http/server.py#L253
- |
if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then
export REPLY_SIZE=1850
elif [[ $TRAVIS_PYTHON_VERSION == '3.9-dev' ]]; then
export REPLY_SIZE=1853 # Server: SimpleHTTP/0.6 Python/3.9.0rc1+
elif [[ $TRAVIS_PYTHON_VERSION == 'nightly' ]]; then
export REPLY_SIZE=1852 # Server: SimpleHTTP/0.6 Python/3.10.0a0
else
export REPLY_SIZE=1849
export REPLY_SIZE=1849 # Server: SimpleHTTP/0.6 Python/3.7.6
fi
- travis_wait 30 python tests/scripts_retention.py tests/tlslite-ng-random-subset.json `which tls.py` $REPLY_SIZE
# pylint doesn't work on 2.6: https://bitbucket.org/logilab/pylint/issue/390/py26-compatiblity-broken
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.PHONY : default
PYTHON=$(or $(shell which python3),$(shell which python))
EXPECTED_SIZE=$(shell $(PYTHON) -c 'import sys; print(1845 + len(sys.version.split()[0]))')
default:
@echo "To install run \"./setup.py install\" or \"make install\""
@echo "To test sanity of code run \"make test\""
Expand Down Expand Up @@ -34,4 +35,4 @@ test: docs

test-scripts:
"$(PYTHON)" tests/verify-scripts-json.py tests/tlslite-ng.json tests/tlslite-ng-random-subset.json
"$(PYTHON)" tests/scripts_retention.py tests/tlslite-ng.json ../tlslite-ng/scripts/tls.py 1850
"$(PYTHON)" tests/scripts_retention.py tests/tlslite-ng.json ../tlslite-ng/scripts/tls.py $(EXPECTED_SIZE)
7 changes: 5 additions & 2 deletions tlsfuzzer/utils/ordered_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from thread import get_ident as _get_ident
except ImportError:
try:
from dummy_thread import get_ident as _get_ident
from _thread import get_ident as _get_ident
except ImportError:
from _dummy_thread import get_ident as _get_ident
try:
from dummy_thread import get_ident as _get_ident
except ImportError:
from _dummy_thread import get_ident as _get_ident

try:
from _abcoll import KeysView, ValuesView, ItemsView
Expand Down

0 comments on commit cd8190d

Please sign in to comment.