summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/cyextension
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-25 17:08:48 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-30 14:04:52 -0400
commit4e754a8914a1c2c16c97bdf363d2e24bfa823730 (patch)
treedb723242b4e4c0d4c7f15c167857dd79fdfa6ccb /lib/sqlalchemy/cyextension
parentdba480ebaf89c0b5ea787661583de9da3928920f (diff)
downloadsqlalchemy-4e754a8914a1c2c16c97bdf363d2e24bfa823730.tar.gz
pep-484: the pep-484ening, SQL part three
hitting DML which is causing us to open up the ColumnCollection structure a bit, as we do put anonymous column expressions with None here. However, we still want Table /TableClause to have named column collections that don't return None, so parametrize the "key" in this collection also. * rename some "immutable" elements to "readonly". we change the contents of immutablecolumncollection underneath, so it's not "immutable" Change-Id: I2593995a4e5c6eae874bed5bf76117198be8ae97
Diffstat (limited to 'lib/sqlalchemy/cyextension')
-rw-r--r--lib/sqlalchemy/cyextension/immutabledict.pyx16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/sqlalchemy/cyextension/immutabledict.pyx b/lib/sqlalchemy/cyextension/immutabledict.pyx
index 861e7574d..6ab255311 100644
--- a/lib/sqlalchemy/cyextension/immutabledict.pyx
+++ b/lib/sqlalchemy/cyextension/immutabledict.pyx
@@ -1,18 +1,24 @@
from cpython.dict cimport PyDict_New, PyDict_Update, PyDict_Size
+def _readonly_fn(obj):
+ raise TypeError(
+ "%s object is immutable and/or readonly" % obj.__class__.__name__)
+
+
def _immutable_fn(obj):
- raise TypeError("%s object is immutable" % obj.__class__.__name__)
+ raise TypeError(
+ "%s object is immutable" % obj.__class__.__name__)
-class ImmutableContainer:
+class ReadOnlyContainer:
__slots__ = ()
- def _immutable(self, *a,**kw):
- _immutable_fn(self)
+ def _readonly(self, *a,**kw):
+ _readonly_fn(self)
- __delitem__ = __setitem__ = __setattr__ = _immutable
+ __delitem__ = __setitem__ = __setattr__ = _readonly
class ImmutableDictBase(dict):