Skip to content

Commit 67fe545

Browse files
committed
v0.2; work around CPython bug
1 parent b60ab98 commit 67fe545

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
### 0.2.0 - 2021-11-27
4+
- More efficient generation of Python identifiers
5+
- Workaround for [CPython parser bug in 3.9.8](https://bugs.python.org/issue45738) (#16)
6+
Yes, *yet another* one - still, that's why `hypothesmith` exists...
7+
38
### 0.1.9 - 2021-08-19
49
- Fixed rare internal error when `from_node()` generated misplaced `except:` clauses
510

Diff for: src/hypothesmith/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
from hypothesmith.cst import from_node
44
from hypothesmith.syntactic import from_grammar
55

6-
__version__ = "0.1.9"
6+
__version__ = "0.2.0"
77
__all__ = ["from_grammar", "from_node"]

Diff for: src/hypothesmith/syntactic.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@ def draw_symbol(self, data, symbol, draw_state): # type: ignore
127127
# of bizzare errors in CPython, especially with the new PEG parser,
128128
# and so we maintain this extra clause to ensure that we get a decent
129129
# error message out of it.
130-
if isinstance(err, SystemError) and sys.version_info[:3] == (3, 9, 0):
130+
if isinstance(err, SystemError) and (
131+
sys.version_info[:3] == (3, 9, 0)
132+
or sys.version_info[:3] >= (3, 9, 8)
133+
and str(err) == "Negative size passed to PyUnicode_New"
134+
):
131135
# We've triggered https://bugs.python.org/issue42218 - it's been
132136
# fixed upstream, so we'll treat it as if it were a SyntaxError.
137+
# Or the new https://bugs.python.org/issue45738 which makes me
138+
# wish CPython would start running proptests in CI already.
133139
assume(False)
134140
source_code = ascii("".join(draw_state.result[count:]))
135141
raise type(err)(

0 commit comments

Comments
 (0)