| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent efefe25 commit b64334c
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,10 +93,13 @@ def _maybe_compile(compiler, source, filename, symbol): | |||
| 93 | 93 | except SyntaxError as e: | |
| 94 | 94 | err2 = e | |
| 95 | 95 | ||
| 96 | - if code: | ||
| 97 | - return code | ||
| 98 | - if not code1 and repr(err1) == repr(err2): | ||
| 99 | - raise err1 | ||
| 96 | + try: | ||
| 97 | + if code: | ||
| 98 | + return code | ||
| 99 | + if not code1 and repr(err1) == repr(err2): | ||
| 100 | + raise err1 | ||
| 101 | + finally: | ||
| 102 | + err1 = err2 = None | ||
| 100 | 103 | ||
| 101 | 104 | def _compile(source, filename, symbol): | |
| 102 | 105 | return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,6 +149,8 @@ def framework_find(fn, executable_path=None, env=None): | |||
| 149 | 149 | return dyld_find(fn, executable_path=executable_path, env=env) | |
| 150 | 150 | except ValueError: | |
| 151 | 151 | raise error | |
| 152 | + finally: | ||
| 153 | + error = None | ||
| 152 | 154 | ||
| 153 | 155 | def test_dyld_find(): | |
| 154 | 156 | env = {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -839,7 +839,11 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, | |||
| 839 | 839 | sock.close() | |
| 840 | 840 | ||
| 841 | 841 | if err is not None: | |
| 842 | - raise err | ||
| 842 | + try: | ||
| 843 | + raise err | ||
| 844 | + finally: | ||
| 845 | + # Break explicitly a reference cycle | ||
| 846 | + err = None | ||
| 843 | 847 | else: | |
| 844 | 848 | raise error("getaddrinfo returns an empty list") | |
| 845 | 849 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + Break cycle generated when saving an exception in socket.py, codeop.py and | ||
| 2 | + dyld.py as they keep alive not only the exception but user objects through | ||
| 3 | + the ``__traceback__`` attribute. Patch by Mario Corchero. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments