diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-23 18:01:07 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-24 18:48:01 -0400 |
commit | f146f19d4bf1f9150785e22d37a62dcbe3436c9a (patch) | |
tree | 756225b1cac5d3c4f6760014c6972199f267ec2a /lib/sqlalchemy/orm/base.py | |
parent | 90882ed43cce26c069b6696b441b6ad8a7372301 (diff) | |
download | sqlalchemy-f146f19d4bf1f9150785e22d37a62dcbe3436c9a.tar.gz |
Unify NO_VALUE and NEVER_SET
There's no real difference between these two constants
except they are used in different places and therefore allow
various codepaths to work largely by accident. These
codepaths should be explicit. Assign NO_VALUE and NEVER_SET
to the same constant and work towards having just one constant
for "we have no value to return right now".
Fixes: #4696
Change-Id: I7c324967952c1886bf202074d627323a2ad013cc
Diffstat (limited to 'lib/sqlalchemy/orm/base.py')
-rw-r--r-- | lib/sqlalchemy/orm/base.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index f809d5891..4d308d26b 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -45,13 +45,12 @@ NO_VALUE = util.symbol( and flags indicated we were not to load it. """, ) +NEVER_SET = NO_VALUE +""" +Synonymous with NO_VALUE -NEVER_SET = util.symbol( - "NEVER_SET", - """Symbol which may be placed as the 'previous' value of an attribute - indicating that the attribute had not been assigned to previously. - """, -) +.. versionchanged:: 1.4 NEVER_SET was merged with NO_VALUE +""" NO_CHANGE = util.symbol( "NO_CHANGE", @@ -126,15 +125,15 @@ PASSIVE_OFF = util.symbol( RELATED_OBJECT_OK | NON_PERSISTENT_OK | INIT_OK | CALLABLES_OK | SQL_OK ), ) -PASSIVE_RETURN_NEVER_SET = util.symbol( - "PASSIVE_RETURN_NEVER_SET", +PASSIVE_RETURN_NO_VALUE = util.symbol( + "PASSIVE_RETURN_NO_VALUE", """PASSIVE_OFF ^ INIT_OK""", canonical=PASSIVE_OFF ^ INIT_OK, ) PASSIVE_NO_INITIALIZE = util.symbol( "PASSIVE_NO_INITIALIZE", - "PASSIVE_RETURN_NEVER_SET ^ CALLABLES_OK", - canonical=PASSIVE_RETURN_NEVER_SET ^ CALLABLES_OK, + "PASSIVE_RETURN_NO_VALUE ^ CALLABLES_OK", + canonical=PASSIVE_RETURN_NO_VALUE ^ CALLABLES_OK, ) PASSIVE_NO_FETCH = util.symbol( "PASSIVE_NO_FETCH", "PASSIVE_OFF ^ SQL_OK", canonical=PASSIVE_OFF ^ SQL_OK |