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/2002-January/019605.html below:

[Python-Dev] Extending types in C

[Python-Dev] Extending types in C - help neededMartin v. Loewis martin@v.loewis.de
Fri, 18 Jan 2002 22:32:23 +0100
> Wouldn't it suffice to check for tp_dict != NULL (after the call
> to PyType_Ready of course)?

No, see below (although I must admit that I wrote "Right" here first
:-)

> Hm. What does Py_TPFLAGS_HAVE_CLASS mean exactly?

According to the documentation, it means that the underlying
TypeObject structure has the necessary fields in its C declaration.

> Or, better, since TPFLAGS_DEFAULT contains TPFLAGS_HAVE_CLASS,
> what does it mean when Py_TPFLAGS_HAVE_CLASS is NOT in tp_flags?

It means you have been loading a module from an earlier Python
version, which had a different setting for TPFLAGS_DEFAULTS, and a
shorter definition of the TypeObject.

If you try to access tp_dict in such an object, you are accessing
random memory. This may immediately crash, or only crash when you pass
the pointer you got to the dictionary functions.

Regards,
Martin



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