-
Notifications
You must be signed in to change notification settings - Fork 250
Open
Description
Python 3.14 now raises a SyntaxWarning when a break, continue or return statement is used in a finally block.
As a consequence, the following code fails in strict test environments, and will fail in the future on production:
tencentcloud-sdk-python/tencentcloud/common/credential.py
Lines 126 to 135 in a7e8b98
| def get_role_name(self): | |
| if self.role: | |
| return self.role | |
| try: | |
| resp = urlopen(self._role_endpoint) | |
| self.role = resp.read().decode("utf8") | |
| except Exception as e: | |
| raise TencentCloudSDKException("ClientError.MetadataError", str(e)) | |
| finally: | |
| return self.role |
The fix seems pretty straightforward: the final return self.role should be made in the try block because if it fails, an exception will be raised and no value would be returned anyway.
Metadata
Metadata
Assignees
Labels
No labels