New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibly out of date C extension documentation #75624
Comments
In the "Defining New Types documentation" basics about tp_new -> PyType_GenericNew, the doc states:
But looking a python C code itself [1] does seem to do this. So I'm guessing that part of the documentation is now irrelevant and the example could just assign PyType_GenericNew to tp_new. [1] Line 2733 in 2ebc5ce
|
On Windows at least: I think "another C module" should be understood as "another DLL or executable". A user extension module is a different DLL from the core Python, so the advice is still valid. |
I'm not sure this is relevant, but I've just made a simple test on Windows (7) with my C extension using { … .tp_new = PyType_GenericNew } and the compiler did not complain (also the code worked as expected) |
PyType_GenericNew() should be in libpython, so indeed the example in the docs seems a bit odd to me. |
FWIW, I've been using https://github.com/python/cpython/blob/master/Modules/_decimal/_decimal.c#L689 the static initialization on problematic platforms like Windows and I'm sure this is valid C, and people here agree: Perhaps this was an issue on very old IRIX systems or similar? |
Christian, do you remember which compiler was the reason for the commit cbf3b5c ? + /* Due to cross platform compiler issues the slots must be filled I've never had problems with VS 2008 or greater. |
I think it's svnmerge of this commit, which talks about VS 2005. It might have been required to support VS 2003 and 2005.
|
Thanks, Christian. -- I found that in the docs the culprit is Cygwin: |
Do we still support cygwin? |
I've just asked on python-dev if Cygwin is still broken. Not sure |
We do not currently officially support cygwin. There are people working on getting it working again (and having a buildbot) so we can support it, so cygwin support is a goal, but not currently a requirement. I've nosied Erik Brey, who is one of the main people interested in and working on cygwin. The note might well be out of date even with regards to cygwin. |
Erik, if you are interested in Cygwin, could you please check that xxmodule.c builds on Cygwin with the patch? You need to uncomment |
In fact, building _decimal should also fail on Cygwin if this |
Building the following with gcc from msys2 (cygwin) worked fine here: https://bpaste.net/show/0cafd5fa8211 |
Okay, thanks. I found that bz2module.c has also used direct initialization for ages. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: