Skip to content
This repository was archived by the owner on Aug 26, 2020. It is now read-only.

Commit 81478d2

Browse files
committed
Allow native (byte) str on Python2
1 parent 9863270 commit 81478d2

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ on such inputs, but may translate them to have the JS behaviour in a future vers
6666

6767
## Changelog
6868

69+
#### 1.0.1 - 2019-10-17
70+
- Allow use of native strings on Python 2. This is not actually valid according
71+
to the spec, but it's only going to be around for a few months so whatever.
72+
6973
#### 1.0.0 - 2019-10-04
7074
- Now considered feature-complete and stable, as all constructs recommended
7175
for `jsonschema` patterns are supported and all Python-side incompatibilities

src/js_regex/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""A thin compatibility layer to use Javascript regular expressions in Python."""
22

3-
__version__ = "1.0.0"
3+
__version__ = "1.0.1"
44
__all__ = ["NotJavascriptRegex", "compile"]
55

66
from ._impl import NotJavascriptRegex, compile

src/js_regex/_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def compile(pattern, flags=0):
3535
This is not a full implementation of EMCA-standard regex, but somewhat
3636
better than simply ignoring the differences between dialects.
3737
"""
38-
if not isinstance(pattern, type("")):
38+
if not isinstance(pattern, (str, type(""))):
3939
raise TypeError("pattern={!r} must be a unicode string".format(pattern))
4040
if not isinstance(flags, int):
4141
raise TypeError("flags={!r} must be an integer".format(flags))

0 commit comments

Comments
 (0)