diff --git a/newsfragments/1175.bugfix.rst b/newsfragments/1175.bugfix.rst
new file mode 100644
index 00000000..06d5cbfe
--- /dev/null
+++ b/newsfragments/1175.bugfix.rst
@@ -0,0 +1,4 @@
+Fix regression introduced with cancellation changes in 0.12.0, where a
+`trio.CancelScope` which isn't cancelled could catch a propagating
+`trio.Cancelled` exception if shielding were changed while the
+cancellation was propagating.
diff --git a/trio/_core/_run.py b/trio/_core/_run.py
index e46f11a7..96da9262 100644
--- a/trio/_core/_run.py
+++ b/trio/_core/_run.py
@@ -426,7 +426,7 @@ class CancelScope(metaclass=Final):
         else:
             scope_task._activate_cancel_status(self._cancel_status.parent)
         if (
-            exc is not None
+            exc is not None and self._cancel_status.effectively_cancelled
             and not self._cancel_status.parent_cancellation_is_visible_to_us
         ):
             exc = MultiError.filter(self._exc_filter, exc)

New cancellation logic doesn't handle in-flight shielding changes correctly
Reproducer:
```python
import trio

async def main():
    with trio.CancelScope() as outer:
        with trio.CancelScope() as inner:
            outer.cancel()
            try:
                await trio.hazmat.checkpoint()
            finally:
                inner.shield = True
    print(outer.cancel_called, inner.cancel_called)
    print(outer.cancelled_caught, inner.cancelled_caught)

trio.run(main)
```
Prints:
```
True False
False True
```
It shouldn't be possible for a scope that wasn't cancelled to swallow a Cancelled.
diff --git a/trio/_core/tests/test_run.py b/trio/_core/tests/test_run.py
index 4ab41b19..07798be9 100644
--- a/trio/_core/tests/test_run.py
+++ b/trio/_core/tests/test_run.py
@@ -849,6 +849,18 @@ async def test_cancel_scope_nesting():
     assert not scope.cancelled_caught
 
 
+# Regression test for https://github.com/python-trio/trio/issues/1175
+async def test_unshield_while_cancel_propagating():
+    with _core.CancelScope() as outer:
+        with _core.CancelScope() as inner:
+            outer.cancel()
+            try:
+                await _core.checkpoint()
+            finally:
+                inner.shield = True
+    assert outer.cancelled_caught and not inner.cancelled_caught
+
+
 async def test_cancel_unbound():
     async def sleep_until_cancelled(scope):
         with scope, fail_after(1):

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov
3.9
docs-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.12
async-generator==1.10
attrs==19.1.0
Babel==2.7.0
certifi==2019.6.16
chardet==3.0.4
Click==7.0
coverage==7.8.0
docutils==0.15.2
exceptiongroup==1.2.2
idna==2.8
imagesize==1.1.0
immutables==0.9
incremental==17.5.0
iniconfig==2.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
outcome==1.0.0
packaging==19.1
pluggy==1.5.0
Pygments==2.4.2
pyparsing==2.4.2
pytest==8.3.5
pytest-cov==6.0.0
pytz==2019.2
requests==2.22.0
six==1.12.0
sniffio==1.1.0
snowballstemmer==1.9.0
sortedcontainers==2.1.0
Sphinx==2.1.2
sphinx-rtd-theme==0.4.3
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
sphinxcontrib-trio==1.1.0
toml==0.10.0
tomli==2.2.1
towncrier==19.2.0
-e git+https://github.com/python-trio/trio.git@6be25cf675e3bb4111fd2b39fc531bbc3c194a73#egg=trio
urllib3==1.25.3

name: trio
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.12
      - async-generator==1.10
      - attrs==19.1.0
      - babel==2.7.0
      - certifi==2019.6.16
      - chardet==3.0.4
      - click==7.0
      - coverage==7.8.0
      - docutils==0.15.2
      - exceptiongroup==1.2.2
      - idna==2.8
      - imagesize==1.1.0
      - immutables==0.9
      - incremental==17.5.0
      - iniconfig==2.1.0
      - jinja2==2.10.1
      - markupsafe==1.1.1
      - outcome==1.0.0
      - packaging==19.1
      - pluggy==1.5.0
      - pygments==2.4.2
      - pyparsing==2.4.2
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytz==2019.2
      - requests==2.22.0
      - six==1.12.0
      - sniffio==1.1.0
      - snowballstemmer==1.9.0
      - sortedcontainers==2.1.0
      - sphinx==2.1.2
      - sphinx-rtd-theme==0.4.3
      - sphinxcontrib-applehelp==1.0.1
      - sphinxcontrib-devhelp==1.0.1
      - sphinxcontrib-htmlhelp==1.0.2
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.2
      - sphinxcontrib-serializinghtml==1.1.3
      - sphinxcontrib-trio==1.1.0
      - toml==0.10.0
      - tomli==2.2.1
      - towncrier==19.2.0
      - trio==0.12.1+dev
      - urllib3==1.25.3
prefix: /opt/conda/envs/trio

trio/_core/tests/test_run.py::test_unshield_while_cancel_propagating
trio/_core/tests/test_run.py::test_instruments_crash trio/_core/tests/test_run.py::test_broken_abort trio/_core/tests/test_run.py::test_error_in_run_loop
trio/_core/tests/test_run.py::test_basic trio/_core/tests/test_run.py::test_initial_task_error trio/_core/tests/test_run.py::test_run_nesting trio/_core/tests/test_run.py::test_nursery_warn_use_async_with trio/_core/tests/test_run.py::test_nursery_main_block_error_basic trio/_core/tests/test_run.py::test_child_crash_basic trio/_core/tests/test_run.py::test_basic_interleave trio/_core/tests/test_run.py::test_task_crash_propagation trio/_core/tests/test_run.py::test_main_and_task_both_crash trio/_core/tests/test_run.py::test_two_child_crashes trio/_core/tests/test_run.py::test_child_crash_wakes_parent trio/_core/tests/test_run.py::test_reschedule trio/_core/tests/test_run.py::test_current_time trio/_core/tests/test_run.py::test_current_time_with_mock_clock trio/_core/tests/test_run.py::test_current_clock trio/_core/tests/test_run.py::test_current_task trio/_core/tests/test_run.py::test_root_task trio/_core/tests/test_run.py::test_out_of_context trio/_core/tests/test_run.py::test_current_statistics trio/_core/tests/test_run.py::test_instruments trio/_core/tests/test_run.py::test_instruments_interleave trio/_core/tests/test_run.py::test_null_instrument trio/_core/tests/test_run.py::test_instrument_before_after_run trio/_core/tests/test_run.py::test_instrument_task_spawn_exit trio/_core/tests/test_run.py::test_cancel_scope_repr trio/_core/tests/test_run.py::test_cancel_points trio/_core/tests/test_run.py::test_cancel_edge_cases trio/_core/tests/test_run.py::test_cancel_scope_multierror_filtering trio/_core/tests/test_run.py::test_precancelled_task trio/_core/tests/test_run.py::test_cancel_shielding trio/_core/tests/test_run.py::test_cancel_inheritance trio/_core/tests/test_run.py::test_cancel_shield_abort trio/_core/tests/test_run.py::test_basic_timeout trio/_core/tests/test_run.py::test_cancel_scope_deprecated trio/_core/tests/test_run.py::test_cancel_scope_nesting trio/_core/tests/test_run.py::test_cancel_unbound trio/_core/tests/test_run.py::test_cancel_scope_misnesting trio/_core/tests/test_run.py::test_timekeeping trio/_core/tests/test_run.py::test_failed_abort trio/_core/tests/test_run.py::test_spawn_system_task trio/_core/tests/test_run.py::test_system_task_crash trio/_core/tests/test_run.py::test_system_task_crash_MultiError trio/_core/tests/test_run.py::test_system_task_crash_plus_Cancelled trio/_core/tests/test_run.py::test_system_task_crash_KeyboardInterrupt trio/_core/tests/test_run.py::test_yield_briefly_checks_for_timeout trio/_core/tests/test_run.py::test_exc_info trio/_core/tests/test_run.py::test_exc_info_after_yield_error trio/_core/tests/test_run.py::test_exception_chaining_after_yield_error trio/_core/tests/test_run.py::test_nursery_exception_chaining_doesnt_make_context_loops trio/_core/tests/test_run.py::test_TrioToken_identity trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_basic trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_too_late trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_idempotent trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_idempotent_requeue trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_after_main_crash trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_crashes trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_FIFO trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_starvation_resistance trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_threaded_stress_test trio/_core/tests/test_run.py::test_TrioToken_run_sync_soon_massive_queue trio/_core/tests/test_run.py::test_slow_abort_basic trio/_core/tests/test_run.py::test_slow_abort_edge_cases trio/_core/tests/test_run.py::test_task_tree_introspection trio/_core/tests/test_run.py::test_nursery_closure trio/_core/tests/test_run.py::test_spawn_name trio/_core/tests/test_run.py::test_current_effective_deadline trio/_core/tests/test_run.py::test_nice_error_on_bad_calls_to_run_or_spawn trio/_core/tests/test_run.py::test_calling_asyncio_function_gives_nice_error trio/_core/tests/test_run.py::test_trivial_yields trio/_core/tests/test_run.py::test_nursery_start trio/_core/tests/test_run.py::test_task_nursery_stack trio/_core/tests/test_run.py::test_nursery_start_with_cancelled_nursery trio/_core/tests/test_run.py::test_nursery_start_keeps_nursery_open trio/_core/tests/test_run.py::test_nursery_explicit_exception trio/_core/tests/test_run.py::test_nursery_stop_iteration trio/_core/tests/test_run.py::test_nursery_stop_async_iteration trio/_core/tests/test_run.py::test_traceback_frame_removal trio/_core/tests/test_run.py::test_contextvar_support trio/_core/tests/test_run.py::test_contextvar_multitask trio/_core/tests/test_run.py::test_system_task_contexts trio/_core/tests/test_run.py::test_Nursery_init trio/_core/tests/test_run.py::test_Nursery_private_init trio/_core/tests/test_run.py::test_Nursery_subclass trio/_core/tests/test_run.py::test_Cancelled_init trio/_core/tests/test_run.py::test_Cancelled_str trio/_core/tests/test_run.py::test_Cancelled_subclass trio/_core/tests/test_run.py::test_CancelScope_subclass trio/_core/tests/test_run.py::test_sniffio_integration trio/_core/tests/test_run.py::test_Task_custom_sleep_data trio/_core/tests/test_run.py::test_permanently_detach_coroutine_object trio/_core/tests/test_run.py::test_detach_and_reattach_coroutine_object trio/_core/tests/test_run.py::test_detached_coroutine_cancellation
newsfragments/1175.bugfix.rst trio/_core/_run.py
newsfragments/1175.bugfix.rst trio/_core/_run.py