nebius/SWE-bench-extra huggingface dataset:
Repository: sendgrid/sendgrid-python

Issue:
Attempting to set substitutions on Personalization helper causes infinite regress
#### Issue Summary

Attempting to set substitutions on a `Personalization` helper directly (rather than with `add_substitution`) throws a `RecursionError`.

#### Steps to Reproduce

```python
from sendgrid.helpers.mail import Personalization
p = Personalization()
p.substitutions = [{'a': 0}, {'b': 1}]
```

This throws a `RecursionError`. The offending line is [personalization.py#L119](https://github.com/sendgrid/sendgrid-python/blob/master/sendgrid/helpers/mail/personalization.py#L119).

I will open a PR as this is an easy fix.

#### Technical details:

* sendgrid-python Version: `5.3.0`
* Python Version: 3.6

Comments:

Patch:
diff --git a/examples/helpers/mail/mail_example.py b/examples/helpers/mail/mail_example.py
index 93b3fb6..b2de7f0 100644
--- a/examples/helpers/mail/mail_example.py
+++ b/examples/helpers/mail/mail_example.py
@@ -30,7 +30,7 @@ def build_personalization(personalization):
         mock_personalization.add_to(cc_addr)
 
     for bcc_addr in personalization['bcc_list']:
-        mock_personalization.add_bc(bcc_addr)
+        mock_personalization.add_bcc(bcc_addr)
 
     for header in personalization['headers']:
         mock_personalization.add_header(header)
@@ -216,4 +216,4 @@ def send_kitchen_sink():
 send_hello_email()
 
 # this will only send an email if you set SandBox Mode to False
-send_kitchen_sink()
\ No newline at end of file
+send_kitchen_sink()
diff --git a/sendgrid/helpers/mail/personalization.py b/sendgrid/helpers/mail/personalization.py
index e49432c..8bb4bed 100644
--- a/sendgrid/helpers/mail/personalization.py
+++ b/sendgrid/helpers/mail/personalization.py
@@ -116,7 +116,7 @@ class Personalization(object):
 
     @substitutions.setter
     def substitutions(self, value):
-        self.substitutions = value
+        self._substitutions = value
 
     def add_substitution(self, substitution):
         """Add a new Substitution to this Personalization.


Test patch:
diff --git a/test/test_mail.py b/test/test_mail.py
index 86f21c0..7721b52 100644
--- a/test/test_mail.py
+++ b/test/test_mail.py
@@ -558,3 +558,7 @@ class UnitTests(unittest.TestCase):
             tracking_settings.get(),
             {'click_tracking': {'enable': False, 'enable_text': False}}
         )
+
+    def test_directly_setting_substitutions(self):
+        personalization = Personalization()
+        personalization.substitutions = [{'a': 0}]