andialbrecht / sqlparse

A non-validating SQL parser module for Python
BSD 3-Clause "New" or "Revised" License
3.71k stars 693 forks source link

Unnecessary verification #738

Open ghost opened 1 year ago

ghost commented 1 year ago

Describe the bug While searching for a vulnerability error in sqlparse, I found one assert that does not affect (in my opinion) anything, because if you comment it and run tests, they pass without errors and also the example code also pass without errors Here is the link to the code: https://github.com/andialbrecht/sqlparse/blob/3696d5388186a1fd51f657e0d6f4c6809b244143/sqlparse/sql.py#L236

To Reproduce In order to check this, comment out this line and run the tests in any way (with the tox or pytest command) and see that the tests are being passed

Expected behavior If this check would have made sense then at least one test should have fallen)

Versions (please complete the following information):

Additional context If this check still turns out to be necessary, it is better to get rid of the asserts in the code (assert is performed only in debug mode or in tests) and add an if condition. I can send a PR with an update