Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1839826 - Python's sqlite3.test.userfunctions.FunctionTests fails in rawhide after sqlite was updated to version 3.32.0
Summary: Python's sqlite3.test.userfunctions.FunctionTests fails in rawhide after sqli...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.9
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F33FTBFS 1840234
TreeView+ depends on / blocked
 
Reported: 2020-05-25 16:48 UTC by Miro Hrončok
Modified: 2020-06-05 22:07 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-06-05 22:07:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Python 40784 0 None None None 2020-05-26 17:34:18 UTC

Description Miro Hrončok 2020-05-25 16:48:54 UTC
https://koschei.fedoraproject.org/package/python3?collection=f33
https://koschei.fedoraproject.org/package/python3.9?collection=f33


FAIL: CheckFuncDeterministic (sqlite3.test.userfunctions.FunctionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.8.3/Lib/sqlite3/test/userfunctions.py", line 290, in CheckFuncDeterministic
    self.assertEqual(mock.call_count, 1)
AssertionError: 2 != 1



FAIL: CheckFuncDeterministic (sqlite3.test.userfunctions.FunctionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.9.0b1/Lib/sqlite3/test/userfunctions.py", line 290, in CheckFuncDeterministic
    self.assertEqual(mock.call_count, 1)
AssertionError: 2 != 1
----------------------------------------------------------------------
Ran 286 tests in 0.426s
FAILED (failures=1, skipped=2)


sqlite was updated from 3.31.1-1.fc33 to 3.32.0-1.fc33

Comment 1 Ondrej Dubaj 2020-05-26 11:34:11 UTC
Currently updating sqlite to verison 3.32.1-1, as upstream has released a new version. Can you please test, if the problem persists ?

Comment 2 Miro Hrončok 2020-05-26 11:51:19 UTC
Waiting for https://bodhi.fedoraproject.org/updates/FEDORA-2020-f40c21d394

Comment 3 Miro Hrončok 2020-05-26 16:44:31 UTC
(In reply to Ondrej Dubaj from comment #1)
> Currently updating sqlite to verison 3.32.1-1, as upstream has released a
> new version. Can you please test, if the problem persists ?

The problem persists.

Comment 4 Victor Stinner 2020-05-26 17:34:19 UTC
I reported the issue to Python upstream: https://bugs.python.org/issue40784

It seems like SQLite 3.32 behaves differently. It looks like an issue in SQLite itself: it doesn't respect SQLITE_DETERMINISTIC flag. Or SQLite handles deterministic functions differently.

Comment 5 Ondrej Dubaj 2020-05-27 08:21:14 UTC
Also reported this issue to sqlite upstream

https://sqlite.org/forum/forumpost/e79a299b3f

Comment 6 Richard Hipp 2020-05-27 11:25:38 UTC
(In reply to Victor Stinner from comment #4)
> 
> It seems like SQLite 3.32 behaves differently. It looks like an issue in
> SQLite itself: it doesn't respect SQLITE_DETERMINISTIC flag. Or SQLite
> handles deterministic functions differently.

The SQLite documentation for SQLITE_DETERMINISTIC says:

"The SQLITE_DETERMINISTIC flag means that the new function always gives the same output when the input parameters are the same."

It does not say anything about calling deterministic functions only once.  The documentation says that the query planner *might* try to factor deterministic functions out of inner loops, but it does not make any guarantees.  The purpose of SQLITE_DETERMINISTIC is to permit the function to be used in contexts where the result must always be the same given identical, such as in CHECK constraints.

A proper test for the efficacy of the SQLITE_DETERMINISTIC flag would be to verify that the application-defined SQL function cannot be used inside a CHECK constraint, or in the WHERE clause of a partial index, or in a generated column definition, unless that function is marked as SQLITE_DETERMINISTIC.

See https://www.sqlite.org/c3ref/c_deterministic.html#sqlitedeterministic for additional information about the SQLITE_DETERMINISTIC flag.

Comment 7 Victor Stinner 2020-05-27 16:13:05 UTC
> A proper test for the efficacy of the SQLITE_DETERMINISTIC flag would be to verify that the application-defined SQL function cannot be used inside a CHECK constraint, or in the WHERE clause of a partial index, or in a generated column definition, unless that function is marked as SQLITE_DETERMINISTIC.

https://github.com/python/cpython/pull/20448 has been proposed to rewrite the test using partial index. IMO it's a reasonable test which avoids to rely on implementation details as the current test does.

Comment 8 Miro Hrončok 2020-05-29 07:12:23 UTC
Python 3.9 update: The f33-python side tag is currently being merged.

New builds in f33-python are no longer possible, but python3 is not yet updated to Python 3.9 in rawhide. You can check when Python is Python 3.9 with:

    $ koji wait-repo f33-build --build python3.9-3.9.0~b1-3.fc3

And build the packages normally after that.


Note You need to log in before you can comment on or make changes to this bug.