Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3 bigmem test catches wrong exception #99659

Closed
ambv opened this issue Nov 21, 2022 · 2 comments
Closed

sqlite3 bigmem test catches wrong exception #99659

ambv opened this issue Nov 21, 2022 · 2 comments
Labels
topic-sqlite3 type-bug An unexpected behavior, bug, or error

Comments

@ambv
Copy link
Contributor

ambv commented Nov 21, 2022

Lib/test/test_sqlite3/test_types.py has two bigmem tests:

  • test_too_large_string; and
  • test_too_large_blob.

Those are skipped unless -M is passed to the test runner so nobody was running those tests until I set up a bigmem buildbot. Running tests on the buildbot revealed two failures:


======================================================================
ERROR: test_too_large_blob (test.test_sqlite3.test_types.SqliteTypeTests.test_too_large_blob)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\support\__init__.py", line 967, in wrapper
    return f(self, maxsize)
           ^^^^^^^^^^^^^^^^
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\test_sqlite3\test_types.py", line 121, in test_too_large_blob
    self.cur.execute("insert into test(s) values (?)", (b'x'*(2**31-1),))
sqlite3.DataError: string or blob too big
Stdout:
 ... expected peak memory use: 6.0G
Stderr:
R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\support\__init__.py:910: RuntimeWarning: /proc not available for stats: [Errno 2] No such file or directory: '/proc/10708/statm'
  warnings.warn('/proc not available for stats: {}'.format(e),
======================================================================
ERROR: test_too_large_string (test.test_sqlite3.test_types.SqliteTypeTests.test_too_large_string)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\support\__init__.py", line 967, in wrapper
    return f(self, maxsize)
           ^^^^^^^^^^^^^^^^
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\test_sqlite3\test_types.py", line 110, in test_too_large_string
    self.cur.execute("insert into test(s) values (?)", ('x'*(2**31-1),))
sqlite3.DataError: string or blob too big
Stdout:
 ... expected peak memory use: 8.0G
----------------------------------------------------------------------

The with self.assertRaises() in those tests should catch sqlite.DataError instead of the exceptions currently listed.

Linked PRs

@ambv ambv added the type-bug An unexpected behavior, bug, or error label Nov 21, 2022
@zware
Copy link
Member

zware commented Nov 21, 2022

Confirmed the same result on Linux (SQLite version 3.37.2).

ambv added a commit to ambv/cpython that referenced this issue Nov 21, 2022
The tests in question were added in 0eec627 by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.
ambv added a commit to ambv/cpython that referenced this issue Nov 21, 2022
The tests in question were added in 0eec627 by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.
ambv added a commit that referenced this issue Nov 21, 2022
The tests in question were added in 0eec627 by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 21, 2022
…nGH-99660)

The tests in question were added in 0eec627 by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.
(cherry picked from commit 2781ec9)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
miss-islington added a commit that referenced this issue Nov 22, 2022
The tests in question were added in 0eec627 by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.
(cherry picked from commit 2781ec9)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
@erlend-aasland
Copy link
Contributor

Thanks for fixing these!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-sqlite3 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants