diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py
index f2b1699..32f4556 100644
--- a/kafka/consumer/group.py
+++ b/kafka/consumer/group.py
@@ -819,7 +819,7 @@ class KafkaConsumer(six.Iterator):
         Returns:
             set: {topic, ...}
         """
-        return self._subscription.subscription
+        return self._subscription.subscription.copy()
 
     def unsubscribe(self):
         """Unsubscribe from all topics and clear all assigned partitions."""

KafkaConsumer.subscribe() should return copy
When calling ``consumer.subscription()`` a reference to the internal ``set()`` object ``self._subscription.subscription`` is returned.

If that is modified (eg to add a new topic) and then passed to ``consumer.subscribe(topics)`` then ``SubscriptionState.change_subscription`` will hit ``subscription unchanged by change_subscription`` and therefor not call ``self._group_subscription.update``.

It should not be so easy to modify the internal state of the ``SubscriptionState`` therefor consumer.subscription() should return a copy of ``self._subscription.subscription``

Example code, that does not work as expected:

```
consumer = KafkaConsumer()
topics = consumer.subscription()
topics.add('new-topic')
consumer.subscribe(topics)  # Will log that subscription is unchanged
```
diff --git a/test/test_consumer.py b/test/test_consumer.py
index 073a3af..e5dd946 100644
--- a/test/test_consumer.py
+++ b/test/test_consumer.py
@@ -24,6 +24,14 @@ class TestKafkaConsumer(unittest.TestCase):
         with self.assertRaises(KafkaConfigurationError):
             KafkaConsumer(bootstrap_servers='localhost:9092', fetch_max_wait_ms=41000, request_timeout_ms=40000)
 
+    def test_subscription_copy(self):
+        consumer = KafkaConsumer('foo', api_version=(0, 10))
+        sub = consumer.subscription()
+        assert sub is not consumer.subscription()
+        assert sub == set(['foo'])
+        sub.add('fizz')
+        assert consumer.subscription() == set(['foo'])
+
 
 class TestMultiProcessConsumer(unittest.TestCase):
     @unittest.skipIf(sys.platform.startswith('win'), 'test mocking fails on windows')

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-catchlog pytest-sugar pytest-mock mock python-snappy lz4tools xxhash
apt-get update apt-get install -y gcc libsnappy-dev
3.6
docs/requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
cramjam==2.5.0
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
-e git+https://github.com/dpkp/kafka-python.git@899f11730db5f209c03cfad20111ec131ee4c70b#egg=kafka_python
lz4tools==1.3.1.2
MarkupSafe==2.0.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
pockets==0.9.1
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-catchlog==1.2.2
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-sugar==0.9.6
python-snappy==0.7.3
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-napoleon==0.7
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
termcolor==1.1.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
xxhash==3.2.0
zipp==3.6.0

name: kafka-python
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
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - cramjam==2.5.0
      - docutils==0.18.1
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - lz4tools==1.3.1.2
      - markupsafe==2.0.1
      - mock==5.2.0
      - packaging==21.3
      - pluggy==1.0.0
      - pockets==0.9.1
      - py==1.11.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-catchlog==1.2.2
      - pytest-cov==4.0.0
      - pytest-mock==3.6.1
      - pytest-sugar==0.9.6
      - python-snappy==0.7.3
      - pytz==2025.2
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-rtd-theme==2.0.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-napoleon==0.7
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - termcolor==1.1.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - xxhash==3.2.0
      - zipp==3.6.0
prefix: /opt/conda/envs/kafka-python

test/test_consumer.py::TestKafkaConsumer::test_subscription_copy
test/test_consumer.py::TestKafkaConsumer::test_fetch_max_wait_larger_than_request_timeout_raises test/test_consumer.py::TestKafkaConsumer::test_non_integer_partitions test/test_consumer.py::TestKafkaConsumer::test_session_timeout_larger_than_request_timeout_raises test/test_consumer.py::TestMultiProcessConsumer::test_partition_list test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_commit_does_not_raise test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_failed_payloads test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_leader_change test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_reset_partition_offset test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_unknown_topic_partition
kafka/consumer/group.py
kafka/consumer/group.py