[issue42303] I found a bug while checking string with find()

DongwonTTuna report at bugs.python.org
Tue Nov 10 02:11:02 EST 2020


New submission from DongwonTTuna <ttuna0790 at gmail.com>:

USED THE PYTHON-BINANCE MODULE FOR THIS
------------------------------------------------
from binance.client import Client
from binance.exceptions import *

client = Client(api_key='Your_Public_Apikey',
                api_secret='Your_Secret_Apikey')

def buy_limit_test(coin, amount):
    client.create_test_order(
        symbol=coin + 'USDT',
        side=Client.SIDE_BUY,
        type=Client.ORDER_TYPE_MARKET,
        quantity=amount)

try:
    buy_limit_test(coin='HOT', amount=-19298.0)
except BinanceAPIException as E:
    print(E.message.find("'quaaantity'; legal range is"))
    if E.message.find("'quantity'; legal range is"):
        print(E.message)
    else:
        print("yes")
------------------------------------------------




And the parameters.

------------------------------------------------

E.message.find("'quantity'; legal range is") = 38

E.message = "Illegal characters found in parameter 'quantity'; legal range is '^([0-9]{1,20})(\.[0-9]{1,20})?$'."

------------------------------------------------

If I run with this

if E.message.find("'quaaaaaaaaaaaaaaaaaaaaaaaaanatity'; legal range is"):

It should be run with print("yes"), but It shows print(E.message).

But If I run with
if E.message.find("'quaaaaaaaaaaaaaaaaaaaaaaaaanatity'; legal range is") == True:

It's now run with print("yes") not the print(E.message).

I think it's a bug

----------
files: 스크린샷 2020-11-10 16.02.46.png
messages: 380636
nosy: DongwonTTuna
priority: normal
severity: normal
status: open
title: I found a bug while checking string with find()
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49585/스크린샷 2020-11-10 16.02.46.png

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42303>
_______________________________________


More information about the Python-bugs-list mailing list