This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients Zdeněk.Pavlas, amaury.forgeotdarc, ezio.melotti, mrabarnett
Date 2013-03-25.20:22:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364242972.05.0.38518080361.issue17544@psf.upfronthosting.co.za>
In-reply-to
Content
The returned value and the global indicator are not independent.  C functions should not set an error while returning a valid value.

The same behavior will occur in random places -- for example, "for x in range(2): pass" also triggers the issue, this is not specific to the re module.

If you compile python in debug mode (--with-pydebug) an additional (and expensive) check is done and will print "XXX undetected error".

One of the reasons is that accessing the global indicator is an expensive operation, compared to checking the returned value.
But there are cases when this cannot be done. For example, PyIter_Next() returns NULL at the end of the loop, and one must call PyErr_Occurred() to check for errors.

In the _sre.c case though, it looks more like laziness: intermediate returned values are not checked, and PyErr_Occurred() is called at the end.  Bad.
History
Date User Action Args
2013-03-25 20:22:52amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, ezio.melotti, mrabarnett, Zdeněk.Pavlas
2013-03-25 20:22:52amaury.forgeotdarcsetmessageid: <1364242972.05.0.38518080361.issue17544@psf.upfronthosting.co.za>
2013-03-25 20:22:52amaury.forgeotdarclinkissue17544 messages
2013-03-25 20:22:51amaury.forgeotdarccreate