Created on 2013-08-31 10:56 by scoder, last changed 2017-03-31 16:36 by dstufft. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue18893.diff | madison.may, 2013-09-02 21:01 | 2 to 3 migration for framework_find error handling | review | |
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 552 | closed | dstufft, 2017-03-31 16:36 | |
| Messages (7) | |||
|---|---|---|---|
| msg196629 - (view) | Author: Stefan Behnel (scoder) * | Date: 2013-08-31 10:56 | |
The exception handling clauses in framework_find() are weird.
def framework_find(fn, executable_path=None, env=None):
"""
Find a framework using dyld semantics in a very loose manner.
Will take input such as:
Python
Python.framework
Python.framework/Versions/Current
"""
try:
return dyld_find(fn, executable_path=executable_path, env=env)
except ValueError as e:
pass
fmwk_index = fn.rfind('.framework')
if fmwk_index == -1:
fmwk_index = len(fn)
fn += '.framework'
fn = os.path.join(fn, os.path.basename(fn[:fmwk_index]))
try:
return dyld_find(fn, executable_path=executable_path, env=env)
except ValueError:
raise e
My guess is that this is left-over code from Py2.x. Since it doesn't make sense to catch an exception in the second clause just to re-raise it, I think the intention was really to re-raise the original exception caught in the first clause, which no longer works that way in Py3.
The fix would then be to assign the exception to a new variable in the first except clause and re-raise that in the second.
I found this problem because Cython rejected the module with a compile error about "e" being undefined in the last line.
|
|||
| msg196630 - (view) | Author: Stefan Behnel (scoder) * | Date: 2013-08-31 11:21 | |
changing title as it doesn't really look like a typo, more a "converto" |
|||
| msg196772 - (view) | Author: Ronald Oussoren (ronaldoussoren) * | Date: 2013-09-02 06:05 | |
Your analysis looks correct to me, that is "raise e" is supposed to raise the exception caught by the first try block. |
|||
| msg196807 - (view) | Author: Madison May (madison.may) * | Date: 2013-09-02 21:01 | |
Seems like a simple fix -- patch attached. |
|||
| msg277324 - (view) | Author: Inada Naoki (methane) * | Date: 2016-09-24 17:41 | |
lgtm |
|||
| msg277455 - (view) | Author: Roundup Robot (python-dev) | Date: 2016-09-26 20:06 | |
New changeset e9f34d382eda by Berker Peksag in branch '3.5': Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py https://hg.python.org/cpython/rev/e9f34d382eda New changeset 708337cd8e6a by Berker Peksag in branch '3.6': Issue #18893: Merge from 3.5 https://hg.python.org/cpython/rev/708337cd8e6a New changeset b9d9c49d5b50 by Berker Peksag in branch 'default': Issue #18893: Merge from 3.6 https://hg.python.org/cpython/rev/b9d9c49d5b50 |
|||
| msg277456 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2016-09-26 20:06 | |
Thanks! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-03-31 16:36:34 | dstufft | set | pull_requests: + pull_request1073 |
| 2016-09-26 20:06:40 | berker.peksag | set | status: open -> closed versions:
+ Python 3.7 messages:
+ msg277456 |
| 2016-09-26 20:06:16 | python-dev | set | nosy:
+ python-dev messages: + msg277455 |
| 2016-09-24 17:41:59 | methane | set | versions: + Python 2.7, Python 3.5, Python 3.6, - Python 3.2, Python 3.3, Python 3.4 |
| 2016-09-24 17:41:35 | methane | set | nosy:
+ methane messages: + msg277324 |
| 2013-09-02 21:01:44 | madison.may | set | files:
+ issue18893.diff nosy:
+ madison.may keywords: + patch |
| 2013-09-02 06:05:04 | ronaldoussoren | set | messages: + msg196772 |
| 2013-09-01 07:28:06 | ned.deily | set | nosy:
+ ronaldoussoren |
| 2013-08-31 11:21:00 | scoder | set | messages:
+ msg196630 title: typo in Lib/ctypes/macholib/dyld.py -> invalid exception handling in Lib/ctypes/macholib/dyld.py |
| 2013-08-31 11:04:22 | pitrou | set | nosy:
+ amaury.forgeotdarc, belopolsky, meador.inge |
| 2013-08-31 10:56:26 | scoder | create | |