!2 Add support for positional only arguments

Merge pull request !2 from ultra_planet/master
This commit is contained in:
openeuler-ci-bot 2020-06-24 20:41:04 +08:00 committed by Gitee
commit 1c76ea2ec8
2 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1,28 @@
From 8f47297fa2e19c426a42b06bb5f8bf1406b8f0f3 Mon Sep 17 00:00:00 2001
From: Paul Ganssle <paul@ganssle.io>
Date: Mon, 29 Apr 2019 15:12:28 -0400
Subject: [PATCH] Add support for positional only arguments
PEP 570 adds "positional only" arguments to Python, which changes the
code object constructor. This adds support for Python 3.8.
Fixes GH #1943: https://github.com/HypothesisWorks/hypothesis/issues/1943
---
hypothesis-python/src/hypothesis/internal/compat.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hypothesis-python/src/hypothesis/internal/compat.py b/hypothesis-python/src/hypothesis/internal/compat.py
index 73305bacd2..58f63715ac 100644
--- a/src/hypothesis/internal/compat.py
+++ b/src/hypothesis/internal/compat.py
@@ -392,6 +392,10 @@ def get_type_hints(thing):
'co_cellvars',
]
+ if sys.version_info >= (3, 8, 0):
+ # PEP 570 added "positional only arguments"
+ CODE_FIELD_ORDER.insert(1, "co_posonlyargcount")
+
def update_code_location(code, newfile, newlineno):
"""Take a code object and lie shamelessly about where it comes from.

View File

@ -1,12 +1,13 @@
%{?python_enable_dependency_generator}
Name: python-hypothesis
Version: 3.66.11
Release: 2
Release: 3
Summary: based testing for python code
License: MPLv2.0
URL: https://github.com/HypothesisWorks/hypothesis-python
Source0: %{url}/archive/hypothesis-python-%{version}/hypothesis-%{version}.tar.gz
Patch0: hypothesis-3.12.0-offline.patch
Patch0000: hypothesis-3.12.0-offline.patch
Patch0001: hypothesis-Add-support-for-positional-only-arguments.patch
BuildRequires: python-sphinx
BuildArch: noarch
@ -72,5 +73,8 @@ PYTHONPATH=src READTHEDOCS=True sphinx-build -b man docs docs/_build/man
%{python3_sitelib}/hypothesis/
%changelog
* Wed Jun 24 2020 lingsheng<lingsheng@huawei.com> - 3.66.11-3
- Add support for positional only arguments
* Thu Nov 28 2019 likexin<likexin4@huawei.com> - 3.66.11-2
- Package init