From 20960df455fffd73d556a5ed92cdf6832c23e65f Mon Sep 17 00:00:00 2001 From: Samuel Searles-Bryant Date: Sat, 18 Apr 2026 12:59:39 +0300 Subject: Fixed #37045 -- Renamed savepoint() to savepoint_create(). This makes the name consistent with the `savepoint_commit` and `savepoint_rollback` functions. The previous name is maintained as a deprecated alias. This also frees up the `savepoint` name, which would allow the context manager from `django-subatomic` to be included in Django. Co-authored-by: Lily --- docs/internals/deprecation.txt | 3 +++ docs/releases/6.1.txt | 3 +++ docs/topics/db/transactions.txt | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 1e6415e484..2cb6a15f2f 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -126,6 +126,9 @@ details on these changes. * Support for overriding ``ModelAdmin.get_action_choices()`` without the new ``action_location`` parameter will be removed. +* The ``django.db.transaction.savepoint()`` alias to + ``django.db.transaction.savepoint_create()`` will be removed. + .. _deprecation-removed-in-6.1: 6.1 diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt index 12596d4fe6..b041bbdda0 100644 --- a/docs/releases/6.1.txt +++ b/docs/releases/6.1.txt @@ -791,6 +791,9 @@ Miscellaneous * Overriding ``ModelAdmin.get_action_choices()`` without the new ``action_location`` parameter is deprecated. +* ``django.db.transaction.savepoint()`` is deprecated in favor of + ``django.db.transaction.savepoint_create()``. + Features removed in 6.1 ======================= diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt index c44c8c6ee7..4733a95bf8 100644 --- a/docs/topics/db/transactions.txt +++ b/docs/topics/db/transactions.txt @@ -547,6 +547,17 @@ Savepoints are controlled by three functions in :mod:`django.db.transaction`: .. function:: savepoint(using=None) + .. deprecated:: 6.1 + + ``savepoint`` has been renamed to ``savepoint_create``. + + Creates a new savepoint. This marks a point in the transaction that is + known to be in a "good" state. Returns the savepoint ID (``sid``). + +.. function:: savepoint_create(using=None) + + .. versionadded:: 6.1 + Creates a new savepoint. This marks a point in the transaction that is known to be in a "good" state. Returns the savepoint ID (``sid``). @@ -579,7 +590,7 @@ The following example demonstrates the use of savepoints:: a.save() # transaction now contains a.save() - sid = transaction.savepoint() + sid = transaction.savepoint_create() b.save() # transaction now contains a.save() and b.save() @@ -692,7 +703,7 @@ you can roll back the single offending operation, rather than the entire transaction. For example:: a.save() # Succeeds, and never undone by savepoint rollback - sid = transaction.savepoint() + sid = transaction.savepoint_create() try: b.save() # Could throw exception transaction.savepoint_commit(sid) -- cgit v1.3