summaryrefslogtreecommitdiffstats
path: root/Lib/fractions.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-09-02 16:10:58 (GMT)
committerGitHub <noreply@github.com>2022-09-02 16:10:58 (GMT)
commit656167db81a53934da55d90ed431449d8a4fc14b (patch)
tree7c7a16ea4f63ee2b8557cc8496549f4dd79dc18e /Lib/fractions.py
parent91f40f3f78d6016a283989e32ec3d1fb61bcebca (diff)
downloadcpython-656167db81a53934da55d90ed431449d8a4fc14b.zip
cpython-656167db81a53934da55d90ed431449d8a4fc14b.tar.gz
cpython-656167db81a53934da55d90ed431449d8a4fc14b.tar.bz2
Allow whitespace around a slash in fraction string inputs (GH-96496)
Diffstat (limited to 'Lib/fractions.py')
-rw-r--r--Lib/fractions.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/fractions.py b/Lib/fractions.py
index 738a0d4..43b72ae 100644
--- a/Lib/fractions.py
+++ b/Lib/fractions.py
@@ -26,7 +26,7 @@ _RATIONAL_FORMAT = re.compile(r"""
(?=\d|\.\d) # lookahead for digit or .digit
(?P<num>\d*|\d+(_\d+)*) # numerator (possibly empty)
(?: # followed by
- (?:/(?P<denom>\d+(_\d+)*))? # an optional denominator
+ (?:\s*/\s*(?P<denom>\d+(_\d+)*))? # an optional denominator
| # or
(?:\.(?P<decimal>d*|\d+(_\d+)*))? # an optional fractional part
(?:E(?P<exp>[-+]?\d+(_\d+)*))? # and optional exponent