You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
W.r.t PEP-384:
Every module, except pyexpat, in the stdlib library treats frames as opaque objects, as PEP-384 requires.
(I'm exempting builtins and sys here)
I think it is unreasonable to expect authors of 3rd party modules to respect PEP-384 if the standard library does not.
W.r.t. the change to ctypes: I have simply moved a function from ctypes.c to traceback.c (and renamed it accordingly) so that pyexpat.c can access it.
I think it is unreasonable to expect authors of 3rd party modules to respect PEP-384 if the standard library does not.
I don't understand why you think that. PEP-384 is intended to provide the means to maintain binary compatibility of extension modules so that they don't have to be recompiled for every minor version. Standard library extensions are recompiled for every Python release anyway.
Also, we don't expect authors to respect PEP-384. Either they choose to do so, and get the benefits, or they don't.
I have simply moved a function from ctypes.c to traceback.c (and renamed it accordingly) so that pyexpat.c can access it.
I can see that. It would be cleaner to do the change in two steps, first move the utility function out from ctypes, then use it from pyexpat. On the other hand we haven't been adamant about one-patch-one-change in the past.
test.test_pyexpat.HandlerExceptionTest now fails, but only when running in the installed location, not when running the tests from the builddir. any idea why?
Activity
markshannon commentedon Sep 22, 2014
Modules/pyexpat.c includes some archaic code to create temporary frames
so that, in even of an exception being raised, expat appears in the traceback.
The way this is implemented is a problem for three reasons:
The attached patch fixes these issues.
birkenfeld commentedon Oct 6, 2014
Not sure how this can violate PEP-384, as it doesn't make it mandatory for builtin extensions to use the stable ABI.
The other concerns seem valid, although I don't like how the patch includes an unrelated change to ctypes.
markshannon commentedon Oct 6, 2014
W.r.t PEP-384:
Every module, except pyexpat, in the stdlib library treats frames as opaque objects, as PEP-384 requires.
(I'm exempting builtins and sys here)
I think it is unreasonable to expect authors of 3rd party modules to respect PEP-384 if the standard library does not.
W.r.t. the change to ctypes: I have simply moved a function from ctypes.c to traceback.c (and renamed it accordingly) so that pyexpat.c can access it.
pitrou commentedon Oct 6, 2014
FWIW, I think the patch's approach is ok. I just did a small comment on the review UI.
birkenfeld commentedon Oct 6, 2014
I don't understand why you think that. PEP-384 is intended to provide the means to maintain binary compatibility of extension modules so that they don't have to be recompiled for every minor version. Standard library extensions are recompiled for every Python release anyway.
Also, we don't expect authors to respect PEP-384. Either they choose to do so, and get the benefits, or they don't.
I can see that. It would be cleaner to do the change in two steps, first move the utility function out from ctypes, then use it from pyexpat. On the other hand we haven't been adamant about one-patch-one-change in the past.
pitrou commentedon Oct 7, 2014
Here is an updated patch with a test.
python-dev commentedon Oct 8, 2014
New changeset 5433ef907e4f by Antoine Pitrou in branch '3.4':
Issue bpo-22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
https://hg.python.org/cpython/rev/5433ef907e4f
New changeset f2f13aeb590a by Antoine Pitrou in branch 'default':
Issue bpo-22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
https://hg.python.org/cpython/rev/f2f13aeb590a
pitrou commentedon Oct 8, 2014
Patch pushed. I've kept the changes together :) Hopefully there won't be any ctypes regression.
doko42 commentedon Nov 13, 2014
according to https://jenkins.qa.ubuntu.com/job/vivid-adt-python3.4/7/
test.test_pyexpat.HandlerExceptionTest now fails, but only when running in the installed location, not when running the tests from the builddir. any idea why?
python-dev commentedon Nov 29, 2014
New changeset e4b986350feb by Antoine Pitrou in branch '3.4':
Close issue bpo-22895: fix test failure introduced by the fix for issue bpo-22462.
https://hg.python.org/cpython/rev/e4b986350feb
New changeset 4990157343c6 by Antoine Pitrou in branch 'default':
Close issue bpo-22895: fix test failure introduced by the fix for issue bpo-22462.
https://hg.python.org/cpython/rev/4990157343c6