()
| 1374 | lkv_fixed = state._last_known_values |
| 1375 | |
| 1376 | def _go() -> Any: |
| 1377 | assert lkv_fixed is not None |
| 1378 | last_known = to_return = lkv_fixed[prop.key] |
| 1379 | existing_is_available = ( |
| 1380 | last_known is not LoaderCallableStatus.NO_VALUE |
| 1381 | ) |
| 1382 | |
| 1383 | # we support that the value may have changed. so here we |
| 1384 | # try to get the most recent value including re-fetching. |
| 1385 | # only if we can't get a value now due to detachment do we return |
| 1386 | # the last known value |
| 1387 | current_value = mapper._get_state_attr_by_column( |
| 1388 | state, |
| 1389 | dict_, |
| 1390 | column, |
| 1391 | passive=( |
| 1392 | PassiveFlag.PASSIVE_OFF |
| 1393 | if state.persistent |
| 1394 | else PassiveFlag.PASSIVE_NO_FETCH ^ PassiveFlag.INIT_OK |
| 1395 | ), |
| 1396 | ) |
| 1397 | |
| 1398 | if current_value is LoaderCallableStatus.NEVER_SET: |
| 1399 | if not existing_is_available: |
| 1400 | raise sa_exc.InvalidRequestError( |
| 1401 | "Can't resolve value for column %s on object " |
| 1402 | "%s; no value has been set for this column" |
| 1403 | % (column, state_str(state)) |
| 1404 | ) |
| 1405 | elif current_value is LoaderCallableStatus.PASSIVE_NO_RESULT: |
| 1406 | if not existing_is_available: |
| 1407 | raise sa_exc.InvalidRequestError( |
| 1408 | "Can't resolve value for column %s on object " |
| 1409 | "%s; the object is detached and the value was " |
| 1410 | "expired" % (column, state_str(state)) |
| 1411 | ) |
| 1412 | else: |
| 1413 | to_return = current_value |
| 1414 | if to_return is None: |
| 1415 | util.warn( |
| 1416 | "Got None for value of column %s; this is unsupported " |
| 1417 | "for a relationship comparison and will not " |
| 1418 | "currently produce an IS comparison " |
| 1419 | "(but may in a future release)" % column |
| 1420 | ) |
| 1421 | return to_return |
| 1422 | |
| 1423 | return _go |
| 1424 |
nothing calls this directly
no test coverage detected