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/2004-July/046088.html below:

[Python-Dev] Proposal: C API Macro to decref and set to NULL

[Python-Dev] Proposal: C API Macro to decref and set to NULL [Python-Dev] Proposal: C API Macro to decref and set to NULLTim Peters tim.peters at gmail.com
Tue Jul 13 00:50:31 CEST 2004
[Jim Fulton]
...
> If there are no objections I'll add the following definition to object.h,
> after the definition for Py_DECREF:
> 
> #define Py_CLEAR(op)                            \
>         do {                                   \
>                 if (op) {                      \
>                         PyObject *tmp = (op);  \
>                         (op) = NULL;           \
>                         Py_DECREF(tmp);                \
>                 }                              \
>         } while (0)
> 
> and update the docs and the tutorial on creating types in C.

+1.  At least pystate.c can get rid of its functionally identical
private ZAP macro then.

BTW, re-invented at least as often is a VISIT macro for use in
tp_traverse slots, like typeobject.c's (and several other files')

#define VISIT(SLOT) \
	if (SLOT) { \
		err = visit((PyObject *)(SLOT), arg); \
		if (err) \
			return err; \
	}
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