Refs #27025 -- Removed obsolete sqlite3 transaction management workaround for Python 3.6+.
Obsolete per https://bugs.python.org/issue10740#msg274816.
This commit is contained in:
parent
c6525bea9e
commit
717ee63e56
|
@ -395,7 +395,7 @@ class BaseDatabaseWrapper:
|
|||
|
||||
start_transaction_under_autocommit = (
|
||||
force_begin_transaction_with_broken_autocommit and not autocommit and
|
||||
self.features.autocommits_when_autocommit_is_off
|
||||
hasattr(self, '_start_transaction_under_autocommit')
|
||||
)
|
||||
|
||||
if start_transaction_under_autocommit:
|
||||
|
@ -595,15 +595,6 @@ class BaseDatabaseWrapper:
|
|||
allow_thread_sharing=False,
|
||||
)
|
||||
|
||||
def _start_transaction_under_autocommit(self):
|
||||
"""
|
||||
Only required when autocommits_when_autocommit_is_off = True.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
'subclasses of BaseDatabaseWrapper may require a '
|
||||
'_start_transaction_under_autocommit() method'
|
||||
)
|
||||
|
||||
def schema_editor(self, *args, **kwargs):
|
||||
"""
|
||||
Return a new instance of this backend's SchemaEditor.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import sys
|
||||
|
||||
from django.db import utils
|
||||
from django.db.backends.base.features import BaseDatabaseFeatures
|
||||
from django.utils.functional import cached_property
|
||||
|
@ -13,7 +15,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|||
supports_timezones = False
|
||||
max_query_params = 999
|
||||
supports_mixed_date_datetime_comparisons = False
|
||||
autocommits_when_autocommit_is_off = True
|
||||
autocommits_when_autocommit_is_off = sys.version_info < (3, 6)
|
||||
can_introspect_decimal_field = False
|
||||
can_introspect_duration_field = False
|
||||
can_introspect_positive_integer_field = True
|
||||
|
|
|
@ -173,8 +173,8 @@ class Atomic(ContextDecorator):
|
|||
connection.commit_on_exit = True
|
||||
connection.needs_rollback = False
|
||||
if not connection.get_autocommit():
|
||||
# Some database adapters (namely sqlite3) don't handle
|
||||
# transactions and savepoints properly when autocommit is off.
|
||||
# sqlite3 in Python < 3.6 doesn't handle transactions and
|
||||
# savepoints properly when autocommit is off.
|
||||
# Turning autocommit back on isn't an option; it would trigger
|
||||
# a premature commit. Give up if that happens.
|
||||
if connection.features.autocommits_when_autocommit_is_off:
|
||||
|
|
Loading…
Reference in New Issue