Skip to content

Commit fcbd322

Browse files
Update Lib/fractions.py
Co-authored-by: Pieter Eendebak <[email protected]>
1 parent d9ce606 commit fcbd322

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/fractions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ def __new__(cls, numerator=0, denominator=None):
234234
elif isinstance(numerator, str):
235235
# Handle construction from strings.
236236
fraction_literal = numerator
237-
num, _, denom = fraction_literal.partition('/')
237+
num, is_fraction_format, denom = fraction_literal.partition('/')
238238
try:
239239
num = num.strip()
240240
denom = denom.strip()
241241
if num and denom and denom[0].isdigit():
242242
denominator = int(denom)
243243
numerator = int(num)
244-
elif num and not _:
244+
elif num and not is_fraction_format:
245245
denominator = 1
246246
num, _, exp = num.replace('E', 'e').partition('e')
247247
if _ and not exp:

0 commit comments

Comments
 (0)