Steve Dower <steve.do...@python.org> added the comment:

The section of documentation you reference explains that this behaviour is  not 
covered by the standard ("applied to a non-static variable like 
PyBaseObject_Type() is not required to produce an address constant"), and so 
static addresses of exported symbols do not have to be supported.

It also says that gcc supports it (I assume by generating dynamic code for 
getting the address) while MSVC does not (requiring you to write your own 
dynamic code). 

The conclusion, "tp_base should be set in the extension module’s init 
function," is exactly the right conclusion if you want your code to work across 
all the supported compilers. Invoking the C standard to explain why this looks 
similar to standard code but actually is not is totally fine.

Though I do note that the text can obviously be clearer. I assume it was 
written this way because of a discussion that started "but the C standard says 
..." and so it was clarified to point out that this isn't actually the part of 
the spec that someone thought it was. If we can make it clearer, happy to, but 
it's certainly not incorrect as it stands.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15870>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to