summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/abc.rst6
-rw-r--r--Doc/whatsnew/3.4.rst6
-rw-r--r--Lib/abc.py6
3 files changed, 12 insertions, 6 deletions
diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst
index 7853d31..7a73704 100644
--- a/Doc/library/abc.rst
+++ b/Doc/library/abc.rst
@@ -318,9 +318,9 @@ The :mod:`abc` module also provides the following functions:
Returns the current abstract base class cache token.
- The token is an opaque integer identifying the current version of the
- abstract base class cache for virtual subclasses. This number changes
- with every call to :meth:`ABCMeta.register` on any ABC.
+ The token is an opaque object (that supports equality testing) identifying
+ the current version of the abstract base class cache for virtual subclasses.
+ The token changes with every call to :meth:`ABCMeta.register` on any ABC.
.. versionadded:: 3.4
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index d4f92aa..9f8583d 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -473,6 +473,12 @@ trace memory blocks allocated by Python. It provides the following information:
Improved Modules
================
+abc
+---
+
+New function :func:`abc.get_cache_token` can be used to know when to invalidate
+caches that are affected by changes in the object graph. (Contributed
+by Ɓukasz Langa in :issue:`16832`.)
aifc
----
diff --git a/Lib/abc.py b/Lib/abc.py
index 264c60c..0358a46 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -241,8 +241,8 @@ class ABC(metaclass=ABCMeta):
def get_cache_token():
"""Returns the current ABC cache token.
- The token is an opaque integer identifying the current version of
- the ABC cache for virtual subclasses. This number changes with
- every call to ``register()`` on any ABC.
+ The token is an opaque object (supporting equality testing) identifying the
+ current version of the ABC cache for virtual subclasses. The token changes
+ with every call to ``register()`` on any ABC.
"""
return ABCMeta._abc_invalidation_counter