A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-April/052848.html below:

[Python-Dev] Error checking in init<module> functions

[Python-Dev] Error checking in init<module> functions [Python-Dev] Error checking in init<module> functionsMichael Hudson mwh at python.net
Fri Apr 22 17:05:29 CEST 2005
Thomas Heller <theller at python.net> writes:

> I always wondered why there usually is very sloppy error checking in
> init<module> functions.

Laziness, I presume...

> The problem is that when one of these things fail (although they are
> probably supposed to NOT fail) you end up with a module missing
> something, without any error message.

Err.  There's a call to PyErr_Occurred() after the init function is
called, so you should get an error message.

Carrying on regardless after an error runs the risk that the exception
will be cleared, of course.

> What would be the correct thing to do - I assume something like
>
>      if (PyModule_AddIntConstant(m, "MAX_WBITS", MAX_WBITS)) {
>          PyErr_Print();
>          return;
>      }

Just return, I think.

Cheers,
mwh

-- 
  The meaning of "brunch" is as yet undefined.
                                             -- Simon Booth, ucam.chat
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4