From 6ee4c027ff1501a7fe68f03ba94846ef614137b2 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 5 May 2019 10:15:26 +0100 Subject: New upstream version 1.4.0 --- .bumpversion.cfg | 10 +++++++- .cookiecutterrc | 46 +++++++++++++++++++++--------------- .coveragerc | 10 ++++---- .travis.yml | 53 ++++++++++++++---------------------------- AUTHORS.rst | 3 ++- CHANGELOG.rst | 8 +++++++ CONTRIBUTING.rst | 2 +- LICENSE | 4 +++- MANIFEST.in | 2 -- PKG-INFO | 41 +++++++++++++++++++------------- README.rst | 50 +++++++++++---------------------------- appveyor.yml | 40 ++++++++++++++++--------------- ci/appveyor-bootstrap.py | 21 +++++++---------- ci/appveyor-with-compiler.cmd | 39 +++++++------------------------ ci/bootstrap.py | 7 +++--- ci/templates/.travis.yml | 47 ++++++++++++++----------------------- ci/templates/appveyor.yml | 16 ++++++------- docs/conf.py | 4 ++-- setup.cfg | 14 ++++------- setup.py | 23 +++++++++++++----- src/tblib.egg-info/PKG-INFO | 41 +++++++++++++++++++------------- src/tblib.egg-info/SOURCES.txt | 3 ++- src/tblib/__init__.py | 13 +++++++---- tests/badsyntax.py | 1 + tests/test_issue30.py | 24 +++++++++++++++++++ tox.ini | 52 +++++++++++++++++++---------------------- 26 files changed, 285 insertions(+), 289 deletions(-) create mode 100644 tests/test_issue30.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c534b3c..8b40540 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,13 +1,21 @@ [bumpversion] -current_version = 1.3.2 +current_version = 1.4.0 commit = True tag = True [bumpversion:file:setup.py] +search = version='{current_version}' +replace = version='{new_version}' [bumpversion:file:README.rst] +search = v{current_version}. +replace = v{new_version}. [bumpversion:file:docs/conf.py] +search = version = release = '{current_version}' +replace = version = release = '{new_version}' [bumpversion:file:src/tblib/__init__.py] +search = __version__ = '{current_version}' +replace = __version__ = '{new_version}' diff --git a/.cookiecutterrc b/.cookiecutterrc index 04e27da..ce3c52b 100644 --- a/.cookiecutterrc +++ b/.cookiecutterrc @@ -1,34 +1,42 @@ # Generated by cookiepatcher, a small shim around cookiecutter (pip install cookiepatcher) cookiecutter: - appveyor: 'yes' - c_extension_cython: 'no' - c_extension_optional: 'no' - c_extension_support: 'no' - codacy: 'yes' - codeclimate: 'yes' - codecov: 'yes' - command_line_interface: 'no' + _extensions: + - jinja2_time.TimeExtension + _template: cookiecutter-pylibrary + appveyor: yes + c_extension_function: '-' + c_extension_module: '-' + c_extension_optional: no + c_extension_support: no + codacy: no + codeclimate: no + codecov: yes + command_line_interface: no command_line_interface_bin_name: '-' - coveralls: 'yes' + coveralls: yes distribution_name: tblib email: contact@ionelmc.ro full_name: Ionel Cristian Mărieș github_username: ionelmc - landscape: 'yes' + landscape: no + license: BSD 2-Clause License + linter: flake8 package_name: tblib project_name: tblib project_short_description: Traceback serialization library. - release_date: '2016-03-08' + release_date: '2017-04-09' repo_name: python-tblib - requiresio: 'yes' - scrutinizer: 'yes' - sphinx_doctest: 'no' + requiresio: yes + scrutinizer: no + sphinx_docs: yes + sphinx_doctest: no sphinx_theme: sphinx-py3doc-enhanced-theme - test_matrix_configurator: 'no' - test_matrix_separate_coverage: 'no' + test_matrix_configurator: no + test_matrix_separate_coverage: no test_runner: pytest - travis: 'yes' - version: 1.3.0 + travis: yes + version: 1.3.2 website: http://blog.ionelmc.ro - year: 2013-2017 + year_from: '2013' + year_to: '2019' diff --git a/.coveragerc b/.coveragerc index 9ff6d24..2f29a3a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,11 +1,13 @@ [paths] source = - src/tblib - */site-packages/tblib + src + */site-packages [run] -branch = True -source = tblib +branch = true +source = + tblib + tests parallel = true [report] diff --git a/.travis.yml b/.travis.yml index c91785b..171d58f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,36 @@ language: python -sudo: false -cache: pip +dist: xenial env: global: - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - SEGFAULT_SIGNALS=all - matrix: - - TOXENV=check - - TOXENV=docs matrix: include: - - python: 2.7 + - python: '3.6' env: - - TOXENV=py27,report,coveralls,codecov - - python: 3.3 + - TOXENV=check + - python: '3.6' + env: + - TOXENV=docs + - python: '2.7' env: - - TOXENV=py33,report,coveralls,codecov - - python: 3.4 + - TOXENV=py27,report,coveralls,codecov + - python: '3.4' env: - TOXENV=py34,report,coveralls,codecov - - python: 3.5 + - python: '3.5' env: - TOXENV=py35,report,coveralls,codecov - - python: 3.6 + - python: '3.6' env: - TOXENV=py36,report,coveralls,codecov - - python: pypy + - python: '3.7' + env: + - TOXENV=py37,report,coveralls,codecov + - python: 'pypy2.7-6.0' env: - TOXENV=pypy,report,coveralls,codecov - - python: pypy3 + - python: 'pypy3.5-6.0' env: - TOXENV=pypy3,report,coveralls,codecov before_install: @@ -36,32 +38,11 @@ before_install: - uname -a - lsb_release -a install: - - pip install -U tox virtualenv + - pip install tox - virtualenv --version - easy_install --version - pip --version - tox --version - - | - set -ex - if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then - (cd $HOME - wget https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-5.7.1-linux_x86_64-portable.tar.bz2 - tar xf pypy-5.7.1-linux_x86_64-portable.tar.bz2 - pypy-5.7.1-linux_x86_64-portable/bin/pypy -m ensurepip - pypy-5.7.1-linux_x86_64-portable/bin/pypy -m pip install -U virtualenv) - export PATH=$HOME/pypy-5.7.1-linux_x86_64-portable/bin/:$PATH - export TOXPYTHON=$HOME/pypy-5.7.1-linux_x86_64-portable/bin/pypy - fi - if [[ $TRAVIS_PYTHON_VERSION == 'pypy3' ]]; then - (cd $HOME - wget https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.5-5.7.1-beta-linux_x86_64-portable.tar.bz2 - tar xf pypy3.5-5.7.1-beta-linux_x86_64-portable.tar.bz2 - pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/pypy3 -m ensurepip - pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/pypy3 -m pip install -U virtualenv) - export PATH=$HOME/pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/:$PATH - export TOXPYTHON=$HOME/pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/pypy3 - fi - set +x script: - tox -v after_failure: diff --git a/AUTHORS.rst b/AUTHORS.rst index 59052f3..a11e80c 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,4 +1,3 @@ - Authors ======= @@ -7,3 +6,5 @@ Authors * Beckjake - https://github.com/beckjake * DRayX - https://github.com/DRayX * Jason Madden - https://github.com/jamadden +* Jon Dufresne - https://github.com/jdufresne/ +* Elliott Sales de Andrade - https://github.com/QuLogic diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 031987c..ea857c3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,14 @@ Changelog ========= +1.4.0 (2019-05-02) +~~~~~~~~~~~~~~~~~~ + +* Remove support for end of life Python 3.3. +* Fixed tests for Python 3.7. Contributed by Elliott Sales de Andrade in + `#36 `_. +* Fixed compatibility issue with Twised (``twisted.python.failure.Failure`` expected a ``co_code`` attribute). + 1.3.2 (2017-04-09) ~~~~~~~~~~~~~~~~~~ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a4d4ef1..229e5cd 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -83,7 +83,7 @@ Tips To run a subset of tests:: - tox -e envname -- py.test -k test_myfeature + tox -e envname -- pytest -k test_myfeature To run all the test environments in *parallel* (you need to ``pip install detox``):: diff --git a/LICENSE b/LICENSE index 6bd6621..863f780 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,6 @@ -Copyright (c) 2013-2017, Ionel Cristian Mărieș +BSD 2-Clause License + +Copyright (c) 2013-2019, Ionel Cristian Mărieș All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the diff --git a/MANIFEST.in b/MANIFEST.in index 92351c4..3ae9b54 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,4 @@ graft docs -graft examples graft src graft ci graft tests @@ -8,7 +7,6 @@ include .bumpversion.cfg include .coveragerc include .cookiecutterrc include .editorconfig -include .isort.cfg include AUTHORS.rst include CHANGELOG.rst diff --git a/PKG-INFO b/PKG-INFO index efef9cd..e7e6fc9 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,11 +1,14 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: tblib -Version: 1.3.2 +Version: 1.4.0 Summary: Traceback serialization library. Home-page: https://github.com/ionelmc/python-tblib Author: Ionel Cristian Mărieș Author-email: contact@ionelmc.ro -License: BSD +License: BSD 2-Clause License +Project-URL: Documentation, https://python-tblib.readthedocs.io/ +Project-URL: Changelog, https://python-tblib.readthedocs.io/en/latest/changelog.html +Project-URL: Issue Tracker, https://github.com/ionelmc/python-tblib/issues Description: ======== Overview ======== @@ -94,13 +97,13 @@ Description: ======== :: >>> pickle.loads(s1) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) >>> pickle.loads(s2) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) >>> pickle.loads(s3) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) Raising ~~~~~~~ @@ -435,18 +438,14 @@ Description: ======== raise Exception('fail') Exception: fail - How's this useful ? Imagine you're using multiprocessing like this:: + How's this useful? Imagine you're using multiprocessing like this:: + # Note that Python 3.4 and later will show the remote traceback (but as a string sadly) so we skip testing this. >>> import traceback >>> from multiprocessing import Pool >>> from examples import func_a - >>> if sys.version_info[:2] >= (3, 4): - ... import multiprocessing.pool - ... # Undo the fix for http://bugs.python.org/issue13831 so that we can see the effects of our change. - ... # because Python 3.4 will show the remote traceback (but as a string sadly) - ... multiprocessing.pool.ExceptionWithTraceback = lambda e, t: e - >>> pool = Pool() - >>> try: + >>> pool = Pool() # doctest: +SKIP + >>> try: # doctest: +SKIP ... for i in pool.map(func_a, range(5)): ... print(i) ... except: @@ -461,7 +460,7 @@ Description: ======== ... Exception: Guessing time ! - >>> pool.terminate() + >>> pool.terminate() # doctest: +SKIP Not very useful is it? Let's sort this out:: @@ -579,6 +578,14 @@ Description: ======== Changelog ========= + 1.4.0 (2019-05-02) + ~~~~~~~~~~~~~~~~~~ + + * Remove support for end of life Python 3.3. + * Fixed tests for Python 3.7. Contributed by Elliott Sales de Andrade in + `#36 `_. + * Fixed compatibility issue with Twised (``twisted.python.failure.Failure`` expected a ``co_code`` attribute). + 1.3.2 (2017-04-09) ~~~~~~~~~~~~~~~~~~ @@ -616,6 +623,7 @@ Description: ======== * Added ``to_dict`` method and ``from_dict`` classmethod on Tracebacks. Contributed by beckjake in `#5 `_. +Keywords: traceback,debugging,exceptions Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers @@ -626,10 +634,11 @@ Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Utilities +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* diff --git a/README.rst b/README.rst index a4838e7..48f23d2 100644 --- a/README.rst +++ b/README.rst @@ -12,11 +12,9 @@ Overview * - tests - | |travis| |appveyor| |requires| | |coveralls| |codecov| - | |landscape| |scrutinizer| |codacy| |codeclimate| * - package - | |version| |wheel| |supported-versions| |supported-implementations| | |commits-since| - .. |docs| image:: https://readthedocs.org/projects/python-tblib/badge/?style=flat :target: https://readthedocs.org/projects/python-tblib :alt: Documentation Status @@ -41,41 +39,25 @@ Overview :alt: Coverage Status :target: https://codecov.io/github/ionelmc/python-tblib -.. |landscape| image:: https://landscape.io/github/ionelmc/python-tblib/master/landscape.svg?style=flat - :target: https://landscape.io/github/ionelmc/python-tblib/master - :alt: Code Quality Status - -.. |codacy| image:: https://img.shields.io/codacy/a8f7891727784601931d715097b703ee.svg?style=flat - :target: https://www.codacy.com/app/ionelmc/python-tblib - :alt: Codacy Code Quality Status - -.. |codeclimate| image:: https://codeclimate.com/github/ionelmc/python-tblib/badges/gpa.svg - :target: https://codeclimate.com/github/ionelmc/python-tblib - :alt: CodeClimate Quality Status - .. |version| image:: https://img.shields.io/pypi/v/tblib.svg :alt: PyPI Package latest release - :target: https://pypi.python.org/pypi/tblib + :target: https://pypi.org/project/tblib -.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-tblib/v1.3.2.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-tblib/v1.4.0.svg :alt: Commits since latest release - :target: https://github.com/ionelmc/python-tblib/compare/v1.3.2...master + :target: https://github.com/ionelmc/python-tblib/compare/v1.4.0...master .. |wheel| image:: https://img.shields.io/pypi/wheel/tblib.svg :alt: PyPI Wheel - :target: https://pypi.python.org/pypi/tblib + :target: https://pypi.org/project/tblib .. |supported-versions| image:: https://img.shields.io/pypi/pyversions/tblib.svg :alt: Supported versions - :target: https://pypi.python.org/pypi/tblib + :target: https://pypi.org/project/tblib .. |supported-implementations| image:: https://img.shields.io/pypi/implementation/tblib.svg :alt: Supported implementations - :target: https://pypi.python.org/pypi/tblib - -.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/python-tblib/master.svg - :alt: Scrutinizer Status - :target: https://scrutinizer-ci.com/g/ionelmc/python-tblib/ + :target: https://pypi.org/project/tblib .. end-badges @@ -162,13 +144,13 @@ Unpickling :: >>> pickle.loads(s1) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) >>> pickle.loads(s2) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) >>> pickle.loads(s3) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) Raising ~~~~~~~ @@ -503,18 +485,14 @@ tblib.decorators.return_error raise Exception('fail') Exception: fail -How's this useful ? Imagine you're using multiprocessing like this:: +How's this useful? Imagine you're using multiprocessing like this:: + # Note that Python 3.4 and later will show the remote traceback (but as a string sadly) so we skip testing this. >>> import traceback >>> from multiprocessing import Pool >>> from examples import func_a - >>> if sys.version_info[:2] >= (3, 4): - ... import multiprocessing.pool - ... # Undo the fix for http://bugs.python.org/issue13831 so that we can see the effects of our change. - ... # because Python 3.4 will show the remote traceback (but as a string sadly) - ... multiprocessing.pool.ExceptionWithTraceback = lambda e, t: e - >>> pool = Pool() - >>> try: + >>> pool = Pool() # doctest: +SKIP + >>> try: # doctest: +SKIP ... for i in pool.map(func_a, range(5)): ... print(i) ... except: @@ -529,7 +507,7 @@ How's this useful ? Imagine you're using multiprocessing like this:: ... Exception: Guessing time ! - >>> pool.terminate() + >>> pool.terminate() # doctest: +SKIP Not very useful is it? Let's sort this out:: diff --git a/appveyor.yml b/appveyor.yml index 776475e..dce598c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,60 +7,62 @@ environment: WITH_COMPILER: 'cmd /E:ON /V:ON /C .\ci\appveyor-with-compiler.cmd' matrix: - TOXENV: check - PYTHON_HOME: C:\Python27 - PYTHON_VERSION: '2.7' + TOXPYTHON: C:\Python36\python.exe + PYTHON_HOME: C:\Python36 + PYTHON_VERSION: '3.6' PYTHON_ARCH: '32' - - - TOXENV: 'py27,codecov' + - TOXENV: 'py27,report,codecov' TOXPYTHON: C:\Python27\python.exe PYTHON_HOME: C:\Python27 PYTHON_VERSION: '2.7' PYTHON_ARCH: '32' - - - TOXENV: 'py27,codecov' + - TOXENV: 'py27,report,codecov' TOXPYTHON: C:\Python27-x64\python.exe WINDOWS_SDK_VERSION: v7.0 PYTHON_HOME: C:\Python27-x64 PYTHON_VERSION: '2.7' PYTHON_ARCH: '64' - - - TOXENV: 'py34,codecov' + - TOXENV: 'py34,report,codecov' TOXPYTHON: C:\Python34\python.exe PYTHON_HOME: C:\Python34 PYTHON_VERSION: '3.4' PYTHON_ARCH: '32' - - - TOXENV: 'py34,codecov' + - TOXENV: 'py34,report,codecov' TOXPYTHON: C:\Python34-x64\python.exe WINDOWS_SDK_VERSION: v7.1 PYTHON_HOME: C:\Python34-x64 PYTHON_VERSION: '3.4' PYTHON_ARCH: '64' - - - TOXENV: 'py35,codecov' + - TOXENV: 'py35,report,codecov' TOXPYTHON: C:\Python35\python.exe PYTHON_HOME: C:\Python35 PYTHON_VERSION: '3.5' PYTHON_ARCH: '32' - - - TOXENV: 'py35,codecov' + - TOXENV: 'py35,report,codecov' TOXPYTHON: C:\Python35-x64\python.exe PYTHON_HOME: C:\Python35-x64 PYTHON_VERSION: '3.5' PYTHON_ARCH: '64' - - - TOXENV: 'py36,codecov' + - TOXENV: 'py36,report,codecov' TOXPYTHON: C:\Python36\python.exe PYTHON_HOME: C:\Python36 PYTHON_VERSION: '3.6' PYTHON_ARCH: '32' - - - TOXENV: 'py36,codecov' + - TOXENV: 'py36,report,codecov' TOXPYTHON: C:\Python36-x64\python.exe PYTHON_HOME: C:\Python36-x64 PYTHON_VERSION: '3.6' PYTHON_ARCH: '64' - + - TOXENV: 'py37,report,codecov' + TOXPYTHON: C:\Python37\python.exe + PYTHON_HOME: C:\Python37 + PYTHON_VERSION: '3.7' + PYTHON_ARCH: '32' + - TOXENV: 'py37,report,codecov' + TOXPYTHON: C:\Python37-x64\python.exe + PYTHON_HOME: C:\Python37-x64 + PYTHON_VERSION: '3.7' + PYTHON_ARCH: '64' init: - ps: echo $env:TOXENV - ps: ls C:\Python* diff --git a/ci/appveyor-bootstrap.py b/ci/appveyor-bootstrap.py index d4d09dc..dd76230 100644 --- a/ci/appveyor-bootstrap.py +++ b/ci/appveyor-bootstrap.py @@ -18,24 +18,19 @@ BASE_URL = "https://www.python.org/ftp/python/" GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" GET_PIP_PATH = "C:\get-pip.py" URLS = { - ("2.7", "64"): BASE_URL + "2.7.10/python-2.7.13.amd64.msi", - ("2.7", "32"): BASE_URL + "2.7.10/python-2.7.13.msi", - # NOTE: no .msi installer for 3.3.6 - ("3.3", "64"): BASE_URL + "3.3.3/python-3.3.5.amd64.msi", - ("3.3", "32"): BASE_URL + "3.3.3/python-3.3.5.msi", - ("3.4", "64"): BASE_URL + "3.4.3/python-3.4.6.amd64.msi", - ("3.4", "32"): BASE_URL + "3.4.3/python-3.4.6.msi", - ("3.5", "64"): BASE_URL + "3.5.0/python-3.5.3-amd64.exe", - ("3.5", "32"): BASE_URL + "3.5.0/python-3.5.3.exe", - ("3.6", "64"): BASE_URL + "3.6.0/python-3.6.0-amd64.exe", - ("3.6", "32"): BASE_URL + "3.6.0/python-3.6.0.exe", + ("2.7", "64"): BASE_URL + "2.7.13/python-2.7.13.amd64.msi", + ("2.7", "32"): BASE_URL + "2.7.13/python-2.7.13.msi", + ("3.4", "64"): BASE_URL + "3.4.4/python-3.4.4.amd64.msi", + ("3.4", "32"): BASE_URL + "3.4.4/python-3.4.4.msi", + ("3.5", "64"): BASE_URL + "3.5.4/python-3.5.4-amd64.exe", + ("3.5", "32"): BASE_URL + "3.5.4/python-3.5.4.exe", + ("3.6", "64"): BASE_URL + "3.6.2/python-3.6.2-amd64.exe", + ("3.6", "32"): BASE_URL + "3.6.2/python-3.6.2.exe", } INSTALL_CMD = { # Commands are allowed to fail only if they are not the last command. Eg: uninstall (/x) allowed to fail. "2.7": [["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"], ["msiexec.exe", "/L*+!", "install.log", "/qn", "/i", "{path}", "TARGETDIR={home}"]], - "3.3": [["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"], - ["msiexec.exe", "/L*+!", "install.log", "/qn", "/i", "{path}", "TARGETDIR={home}"]], "3.4": [["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"], ["msiexec.exe", "/L*+!", "install.log", "/qn", "/i", "{path}", "TARGETDIR={home}"]], "3.5": [["{path}", "/quiet", "TargetDir={home}"]], diff --git a/ci/appveyor-with-compiler.cmd b/ci/appveyor-with-compiler.cmd index 7f82a02..289585f 100644 --- a/ci/appveyor-with-compiler.cmd +++ b/ci/appveyor-with-compiler.cmd @@ -1,39 +1,17 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds do not require specific environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +:: Very simple setup: +:: - if WINDOWS_SDK_VERSION is set then activate the SDK. +:: - disable the WDK if it's around. + SET COMMAND_TO_RUN=%* SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows SET WIN_WDK="c:\Program Files (x86)\Windows Kits\10\Include\wdf" ECHO SDK: %WINDOWS_SDK_VERSION% ARCH: %PYTHON_ARCH% - -IF "%PYTHON_VERSION%"=="3.5" ( - IF EXIST %WIN_WDK% ( - REM See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ - REN %WIN_WDK% 0wdf - ) - GOTO main -) - -IF "%PYTHON_ARCH%"=="32" ( - GOTO main +IF EXIST %WIN_WDK% ( + REM See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ + REN %WIN_WDK% 0wdf ) +IF "%WINDOWS_SDK_VERSION%"=="" GOTO main SET DISTUTILS_USE_SDK=1 SET MSSdk=1 @@ -41,6 +19,5 @@ SET MSSdk=1 CALL "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release :main - ECHO Executing: %COMMAND_TO_RUN% CALL %COMMAND_TO_RUN% || EXIT 1 diff --git a/ci/bootstrap.py b/ci/bootstrap.py index e5292aa..e64a6c0 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -28,9 +28,10 @@ if __name__ == "__main__": subprocess.check_call([sys.executable, "-m", "virtualenv", env_path]) print("Installing `jinja2` into bootstrap environment...") subprocess.check_call([join(bin_path, "pip"), "install", "jinja2"]) - activate = join(bin_path, "activate_this.py") - # noinspection PyCompatibility - exec(compile(open(activate, "rb").read(), activate, "exec"), dict(__file__=activate)) + python_executable = join(bin_path, "python") + if not os.path.samefile(python_executable, sys.executable): + print("Re-executing with: {0}".format(python_executable)) + os.execv(python_executable, [python_executable, __file__]) import jinja2 diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml index 751558d..63eec83 100644 --- a/ci/templates/.travis.yml +++ b/ci/templates/.travis.yml @@ -1,51 +1,38 @@ language: python -sudo: false -cache: pip +dist: xenial env: global: - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - SEGFAULT_SIGNALS=all - matrix: - - TOXENV=check - - TOXENV=docs matrix: include: -{% for env in tox_environments %} - - python: {{ env.split('-')[0] if env.startswith('pypy') else '{0[2]}.{0[3]}'.format(env) }} + - python: '3.6' + env: + - TOXENV=check + - python: '3.6' + env: + - TOXENV=docs +{%- for env in tox_environments %}{{ '' }} +{% if env.startswith("pypy3") %} + - python: 'pypy3.5-6.0' +{% elif env.startswith("pypy") %} + - python: 'pypy2.7-6.0' +{% else %} + - python: '{{ "{0[2]}.{0[3]}".format(env) }}' +{% endif %} env: - TOXENV={{ env }},report,coveralls,codecov -{% endfor %} +{%- endfor %}{{ '' }} before_install: - python --version - uname -a - lsb_release -a install: - - pip install -U tox virtualenv + - pip install tox - virtualenv --version - easy_install --version - pip --version - tox --version - - | - set -ex - if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then - (cd $HOME - wget https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-5.7.1-linux_x86_64-portable.tar.bz2 - tar xf pypy-5.7.1-linux_x86_64-portable.tar.bz2 - pypy-5.7.1-linux_x86_64-portable/bin/pypy -m ensurepip - pypy-5.7.1-linux_x86_64-portable/bin/pypy -m pip install -U virtualenv) - export PATH=$HOME/pypy-5.7.1-linux_x86_64-portable/bin/:$PATH - export TOXPYTHON=$HOME/pypy-5.7.1-linux_x86_64-portable/bin/pypy - fi - if [[ $TRAVIS_PYTHON_VERSION == 'pypy3' ]]; then - (cd $HOME - wget https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.5-5.7.1-beta-linux_x86_64-portable.tar.bz2 - tar xf pypy3.5-5.7.1-beta-linux_x86_64-portable.tar.bz2 - pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/pypy3 -m ensurepip - pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/pypy3 -m pip install -U virtualenv) - export PATH=$HOME/pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/:$PATH - export TOXPYTHON=$HOME/pypy3.5-5.7.1-beta-linux_x86_64-portable/bin/pypy3 - fi - set +x script: - tox -v after_failure: diff --git a/ci/templates/appveyor.yml b/ci/templates/appveyor.yml index 2d175da..0006daa 100644 --- a/ci/templates/appveyor.yml +++ b/ci/templates/appveyor.yml @@ -7,20 +7,19 @@ environment: WITH_COMPILER: 'cmd /E:ON /V:ON /C .\ci\appveyor-with-compiler.cmd' matrix: - TOXENV: check - PYTHON_HOME: C:\Python27 - PYTHON_VERSION: '2.7' + TOXPYTHON: C:\Python36\python.exe + PYTHON_HOME: C:\Python36 + PYTHON_VERSION: '3.6' PYTHON_ARCH: '32' - -{% for env in tox_environments %}{% if env.startswith(('py2', 'py3')) %} - - TOXENV: '{{ env }},codecov' +{% for env in tox_environments %}{{ '' }}{% if env.startswith(('py2', 'py3')) %} + - TOXENV: '{{ env }},report,codecov' TOXPYTHON: C:\Python{{ env[2:4] }}\python.exe PYTHON_HOME: C:\Python{{ env[2:4] }} PYTHON_VERSION: '{{ env[2] }}.{{ env[3] }}' PYTHON_ARCH: '32' - - - TOXENV: '{{ env }},codecov' + - TOXENV: '{{ env }},report,codecov' TOXPYTHON: C:\Python{{ env[2:4] }}-x64\python.exe - {%- if env.startswith(('py2', 'py33', 'py34')) %} + {%- if env.startswith(('py2', 'py34')) %} WINDOWS_SDK_VERSION: v7.{{ '1' if env.startswith('py3') else '0' }} {%- endif %} @@ -28,7 +27,6 @@ environment: PYTHON_HOME: C:\Python{{ env[2:4] }}-x64 PYTHON_VERSION: '{{ env[2] }}.{{ env[3] }}' PYTHON_ARCH: '64' - {% endif %}{% endfor %} init: - ps: echo $env:TOXENV diff --git a/docs/conf.py b/docs/conf.py index 551b880..4e14afe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,10 +23,10 @@ if os.getenv('SPELLCHECK'): source_suffix = '.rst' master_doc = 'index' project = 'tblib' -year = '2013-2017' +year = '2013-2019' author = 'Ionel Cristian Mărieș' copyright = '{0}, {1}'.format(year, author) -version = release = '1.3.2' +version = release = '1.4.0' pygments_style = 'trac' templates_path = ['.'] diff --git a/setup.cfg b/setup.cfg index 19e31e2..b2b4bfa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,27 +3,23 @@ universal = 1 [flake8] max-line-length = 140 -exclude = tests/*,*/migrations/*,*/south_migrations/* +exclude = */migrations/* [tool:pytest] +testpaths = tests norecursedirs = - .git - .tox - .env - dist - build - south_migrations migrations python_files = test_*.py *_test.py tests.py addopts = - -rxEfsw + -ra --strict --ignore=tests/badmodule.py --ignore=tests/badsyntax.py --doctest-modules + --doctest-continue-on-failure --doctest-glob=\*.rst --tb=short @@ -34,7 +30,7 @@ known_first_party = tblib default_section = THIRDPARTY forced_separate = test_tblib not_skip = __init__.py -skip = migrations, south_migrations +skip = migrations [egg_info] tag_build = diff --git a/setup.py b/setup.py index be19704..d6f2fb2 100644 --- a/setup.py +++ b/setup.py @@ -16,16 +16,17 @@ from setuptools import setup def read(*names, **kwargs): - return io.open( + with io.open( join(dirname(__file__), *names), encoding=kwargs.get('encoding', 'utf8') - ).read() + ) as fh: + return fh.read() setup( name='tblib', - version='1.3.2', - license='BSD', + version='1.4.0', + license='BSD 2-Clause License', description='Traceback serialization library.', long_description='%s\n%s' % ( re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')), @@ -50,17 +51,27 @@ setup( 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', + # uncomment if you test on these interpreters: + # 'Programming Language :: Python :: Implementation :: IronPython', + # 'Programming Language :: Python :: Implementation :: Jython', + # 'Programming Language :: Python :: Implementation :: Stackless', 'Topic :: Utilities', ], + project_urls={ + 'Documentation': 'https://python-tblib.readthedocs.io/', + 'Changelog': 'https://python-tblib.readthedocs.io/en/latest/changelog.html', + 'Issue Tracker': 'https://github.com/ionelmc/python-tblib/issues', + }, keywords=[ - # eg: 'keyword1', 'keyword2', 'keyword3', + 'traceback', 'debugging', 'exceptions', ], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', ], diff --git a/src/tblib.egg-info/PKG-INFO b/src/tblib.egg-info/PKG-INFO index efef9cd..e7e6fc9 100644 --- a/src/tblib.egg-info/PKG-INFO +++ b/src/tblib.egg-info/PKG-INFO @@ -1,11 +1,14 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: tblib -Version: 1.3.2 +Version: 1.4.0 Summary: Traceback serialization library. Home-page: https://github.com/ionelmc/python-tblib Author: Ionel Cristian Mărieș Author-email: contact@ionelmc.ro -License: BSD +License: BSD 2-Clause License +Project-URL: Documentation, https://python-tblib.readthedocs.io/ +Project-URL: Changelog, https://python-tblib.readthedocs.io/en/latest/changelog.html +Project-URL: Issue Tracker, https://github.com/ionelmc/python-tblib/issues Description: ======== Overview ======== @@ -94,13 +97,13 @@ Description: ======== :: >>> pickle.loads(s1) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) >>> pickle.loads(s2) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) >>> pickle.loads(s3) - (<...Exception'>, Exception('fail',), ) + (<...Exception'>, Exception('fail'...), ) Raising ~~~~~~~ @@ -435,18 +438,14 @@ Description: ======== raise Exception('fail') Exception: fail - How's this useful ? Imagine you're using multiprocessing like this:: + How's this useful? Imagine you're using multiprocessing like this:: + # Note that Python 3.4 and later will show the remote traceback (but as a string sadly) so we skip testing this. >>> import traceback >>> from multiprocessing import Pool >>> from examples import func_a - >>> if sys.version_info[:2] >= (3, 4): - ... import multiprocessing.pool - ... # Undo the fix for http://bugs.python.org/issue13831 so that we can see the effects of our change. - ... # because Python 3.4 will show the remote traceback (but as a string sadly) - ... multiprocessing.pool.ExceptionWithTraceback = lambda e, t: e - >>> pool = Pool() - >>> try: + >>> pool = Pool() # doctest: +SKIP + >>> try: # doctest: +SKIP ... for i in pool.map(func_a, range(5)): ... print(i) ... except: @@ -461,7 +460,7 @@ Description: ======== ... Exception: Guessing time ! - >>> pool.terminate() + >>> pool.terminate() # doctest: +SKIP Not very useful is it? Let's sort this out:: @@ -579,6 +578,14 @@ Description: ======== Changelog ========= + 1.4.0 (2019-05-02) + ~~~~~~~~~~~~~~~~~~ + + * Remove support for end of life Python 3.3. + * Fixed tests for Python 3.7. Contributed by Elliott Sales de Andrade in + `#36 `_. + * Fixed compatibility issue with Twised (``twisted.python.failure.Failure`` expected a ``co_code`` attribute). + 1.3.2 (2017-04-09) ~~~~~~~~~~~~~~~~~~ @@ -616,6 +623,7 @@ Description: ======== * Added ``to_dict`` method and ``from_dict`` classmethod on Tracebacks. Contributed by beckjake in `#5 `_. +Keywords: traceback,debugging,exceptions Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers @@ -626,10 +634,11 @@ Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Utilities +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* diff --git a/src/tblib.egg-info/SOURCES.txt b/src/tblib.egg-info/SOURCES.txt index 1d294f8..721e0c7 100644 --- a/src/tblib.egg-info/SOURCES.txt +++ b/src/tblib.egg-info/SOURCES.txt @@ -42,4 +42,5 @@ src/tblib.egg-info/not-zip-safe src/tblib.egg-info/top_level.txt tests/badmodule.py tests/badsyntax.py -tests/examples.py \ No newline at end of file +tests/examples.py +tests/test_issue30.py \ No newline at end of file diff --git a/src/tblib/__init__.py b/src/tblib/__init__.py index 0b03df3..86dd677 100644 --- a/src/tblib/__init__.py +++ b/src/tblib/__init__.py @@ -15,7 +15,7 @@ except ImportError: if not tb_set_next and not tproxy: raise ImportError("Cannot use tblib. Runtime not supported.") -__version__ = '1.3.2' +__version__ = '1.4.0' __all__ = 'Traceback', PY3 = sys.version_info[0] == 3 @@ -37,6 +37,9 @@ class TracebackParseError(Exception): class Code(object): + + co_code = None + def __init__(self, code): self.co_filename = code.co_filename self.co_name = code.co_name @@ -44,11 +47,11 @@ class Code(object): class Frame(object): def __init__(self, frame): - self.f_globals = dict([ - (k, v) + self.f_globals = { + k: v for k, v in frame.f_globals.items() if k in ("__file__", "__name__") - ]) + } self.f_code = Code(frame.f_code) def clear(self): @@ -112,7 +115,7 @@ class Traceback(object): # noinspection PyBroadException try: exec(code, current.tb_frame.f_globals, {}) - except: + except Exception: next_tb = sys.exc_info()[2].tb_next if top_tb is None: top_tb = next_tb diff --git a/tests/badsyntax.py b/tests/badsyntax.py index 7acf0d0..124ce11 100644 --- a/tests/badsyntax.py +++ b/tests/badsyntax.py @@ -1,3 +1,4 @@ +# flake8: noqa """ bad bad bad diff --git a/tests/test_issue30.py b/tests/test_issue30.py new file mode 100644 index 0000000..6974ff1 --- /dev/null +++ b/tests/test_issue30.py @@ -0,0 +1,24 @@ +import pickle +import sys + +import six +from twisted.python.failure import Failure + +from tblib import pickling_support + + +def test_30(): + pickling_support.install() + + try: + raise ValueError + except ValueError: + s = pickle.dumps(sys.exc_info()) + + f = None + try: + six.reraise(*pickle.loads(s)) + except ValueError: + f = Failure() + + assert f is not None diff --git a/tox.ini b/tox.ini index 7f0c1de..fba49d1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,23 +1,23 @@ -; a generative tox configuration, see: https://testrun.org/tox/latest/config.html#generative-envlist +; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist [tox] envlist = clean, check, - {py27,py33,py34,py35,py36,pypy}, - report, - docs + docs, + {py27,py34,py35,py36,py37,pypy,pypy3}, + report [testenv] basepython = pypy: {env:TOXPYTHON:pypy} pypy3: {env:TOXPYTHON:pypy3} - {py27,docs,spell}: {env:TOXPYTHON:python2.7} - py33: {env:TOXPYTHON:python3.3} + py27: {env:TOXPYTHON:python2.7} py34: {env:TOXPYTHON:python3.4} py35: {env:TOXPYTHON:python3.5} - py36: {env:TOXPYTHON:python3.6} - {bootstrap,clean,check,report,coveralls,codecov}: {env:TOXPYTHON:python3} + {py36,docs,spell}: {env:TOXPYTHON:python3.6} + py37: {env:TOXPYTHON:python3.7} + {bootstrap,clean,check,report,codecov,coveralls}: {env:TOXPYTHON:python3} setenv = PYTHONPATH={toxinidir}/tests PYTHONUNBUFFERED=yes @@ -29,6 +29,7 @@ deps = pytest-travis-fold pytest-cov six + twisted commands = {posargs:py.test --cov=tblib --cov-report=term-missing -vv tests README.rst} @@ -39,8 +40,21 @@ deps = skip_install = true commands = python ci/bootstrap.py -passenv = - * + +[testenv:check] +deps = + docutils + check-manifest + flake8 + readme-renderer + pygments + isort +skip_install = true +commands = + python setup.py check --strict --metadata --restructuredtext + check-manifest {toxinidir} + flake8 src tests setup.py + isort --verbose --check-only --diff --recursive src tests setup.py [testenv:spell] setenv = @@ -60,21 +74,6 @@ commands = sphinx-build {posargs:-E} -b html docs dist/docs sphinx-build -b linkcheck docs dist/docs -[testenv:check] -deps = - docutils - check-manifest - flake8 - readme-renderer - pygments - isort -skip_install = true -commands = - python setup.py check --strict --metadata --restructuredtext - check-manifest {toxinidir} - flake8 src tests setup.py - isort --verbose --check-only --diff --recursive src tests setup.py - [testenv:coveralls] deps = coveralls @@ -90,12 +89,10 @@ commands = coverage xml --ignore-errors codecov [] - [testenv:report] deps = coverage skip_install = true commands = - coverage combine --append coverage report coverage html @@ -103,4 +100,3 @@ commands = commands = coverage erase skip_install = true deps = coverage - -- cgit v1.2.3