diff --git a/kgb/spies.py b/kgb/spies.py
index f85834ec386341e45a014aeb5dbdb802eda4f294..8ca1d27f2efec536a9151abc4802f0db2b6b9787 100644
--- a/kgb/spies.py
+++ b/kgb/spies.py
@@ -993,10 +993,14 @@ class FunctionSpy(object):
             # one when possible. On Python 3.11, this will ensure that
             # state needed for exceptions (co_positions()) will be set
             # correctly.
+            #
+            # NOTE: Prior to kgb 7.2, we had set co_freevars and co_vellvars
+            #       here. This caused crashes with Python 3.13 beta 2 (the
+            #       latest release as of this writing -- June 19, 2024). We
+            #       don't appear to actually need or want to set these on
+            #       Python 3, so we removed this.
             replace_kwargs = {
                 'co_name': old_code.co_name,
-                'co_freevars': old_code.co_freevars,
-                'co_cellvars': old_code.co_cellvars,
             }
 
             if pyver >= (3, 11):
diff --git a/kgb/tests/test_function_spy.py b/kgb/tests/test_function_spy.py
index 9ec311958f31588ef206202be394707548a77b62..ab223e7bd8a47035ddca709c50f0d5cf68a365be 100644
--- a/kgb/tests/test_function_spy.py
+++ b/kgb/tests/test_function_spy.py
@@ -1188,6 +1188,24 @@ class FunctionSpyTests(TestCase):
         self.assertTrue(func.called)
         self.assertEqual(d, {'called': True})
 
+    def test_call_with_function_providing_closure_access_args(self):
+        """Testing FunctionSpy calls with an inline function accessing
+        parent's arguments
+        """
+        # NOTE: This originally caused a crash on Python 3.13 beta 2.
+        #       See: https://github.com/beanbaginc/kgb/issues/11
+        def func(arg):
+            def inline_func():
+                print(arg)
+
+            return 123
+
+        self.agency.spy_on(func)
+
+        d = func(42)
+        self.assertEqual(d, 123)
+        self.assertTrue(func.called)
+
     def test_call_with_bound_method_with_list_comprehension_and_self(self):
         """Testing FunctionSpy calls for bound method using a list
         comprehension referencing 'self'
diff --git a/tox.ini b/tox.ini
index 42de234ef3f15c2f463ebdc960cde626cbb31bd7..ae8da09f0534076293f50cf2a3525a0f3b809c60 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py{27,36,37,38,39,310,311},pypy{37,38}
+envlist = py{27,36,37,38,39,310,311,312,313},pypy{37,38}
 skipsdist = True
 
 [testenv]
