claudevdm commented on code in PR #35904:
URL: https://github.com/apache/beam/pull/35904#discussion_r2433085413


##########
sdks/python/apache_beam/internal/pickler_test.py:
##########
@@ -302,6 +302,48 @@ def test_disable_best_effort_determinism(self):
         dumps(set1, enable_best_effort_determinism=False),
         dumps(set2, enable_best_effort_determinism=False))
 
+  def test_stable_identifier_uses_current_code(self):
+    pickler.set_library('cloudpickle')
+
+    # Get original dynamic function
+    func_v1 = module_test.mutable_test_function()
+
+    pickled_stable = pickler.dumps(
+        func_v1, enable_stable_code_identifier_pickling=True)
+
+    pickled_frozen = pickler.dumps(
+        func_v1, enable_stable_code_identifier_pickling=False)
+
+    # Save original function for cleanup
+    original_function = module_test.mutable_test_function
+
+    try:
+      # Monkey patch: Replace the entire outer function with v2
+      code_v2 = """
+def mutable_test_function():

Review Comment:
   If this causes linting issues, you can indent and call textwrap.dedent like 
here 
https://github.com/apache/beam/blob/99ee1738e2bf33add4487de2dad4c290f847b4f1/sdks/python/apache_beam/coders/coders_test_common.py#L725



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to