-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[sipify] make all protected methods slots #45348
Conversation
The spell test can discarded for now, I'm not in a mood of hacking sipify to support typos in headers. |
Fix looks acceptable to me. But I'm curious what the actual cause of this change was... did older sip versions silently treat public as private? |
What's the status on this? I'm missing my python algorithms 😉 |
2cc06a5
to
f5bdc7e
Compare
This can be merged, only failing test is the spell check which I don't want to handle (it's gonna file once when this is merged, and at every change in @nyalldawson ok for you? |
@3nids , is there a reason why we double spell check here (i.e. source .h[eader] and the derived .sip.in files)? With source .h[eader] we have the #spellok tag to make the spellcheck happy. Could we just skip .sip.in files altogether since they are nowadays always generated from the headers? |
@3nids , thanks for this fix! |
@3nids , you'll need to append a ':%' suffix to the spelling.dat's seperate line (https://github.com/qgis/QGIS/blob/master/scripts/spell_check/spelling.dat#L6422) . While at it, you could improve this regexp in check_spelling.sh (https://github.com/qgis/QGIS/blob/master/scripts/spell_check/check_spelling.sh#L254) from
to
to catch the .sip.in files (although I think that's a pointless change since .sip.in seems to strip the #spellok tag. |
309d1c6
to
993122e
Compare
993122e
to
f5fddbf
Compare
@3nids , @nyalldawson , I've rebased this against master to fix the conflict. Let's merge this as soon as it turns green to avoid further conflicts. |
Hm, so just built this PR, and I still can't run python algorithms, error:
I'll make clean and rebuild from scratch, but that doesn't look good :/ |
OK, so, if I remove 'protected slots:' in the qgsprocessingalgorithm.sip.in (i.e., making those functions all public:), I can run algorithms again. So, going |
Unrelated test failure (3d). All is green, let's merge? |
yep |
This breaks the MSVC build, which doesn't define
Above can be avoided by defining Reverting fee62e4 and dff05dd and rerunning |
Ping @manisandro are you able to investigate this with a matter of urgency? If we can't resolve before Friday we'll need to revert all the sip cmake changes prior to release... |
um, "all" wouldn't be good either - osgeo4w now has SIP 6… The MSVC build just completed (https://cdash.orfeo-toolbox.org/buildSummary.php?buildid=87711). Trying it now on Linux (looks good so far). In all it takes much longer than I had expected (since sunday night so far)… |
BTW do we want python code to access protected members, although it's not in method of a derived class? That's what #45331 is about, isn't it? Or am I missing something? |
Ideally no, but unfortunately they're effectively part of the stable api guarantee now, and there IS client code which access them out there (e.g. processing) |
Arguable. IMHO it's still a bug in the client code if it uses a protected member. But if we protected something that actually needs to be public to be useful, it should not be protected to start with. OTOH the pyqgis documentation doesn't tell whether something is protected or not unless it explicitly mentioned in the description (probably because that concept doesn't exist in python). |
Only from a legalistic point of view. As you've pointed out, Python has no concept of these and we've been happily exposing the methods in the pyqgis docs, in python dir(object) results, in IDE autocomplete, etc for over a decade. It's not reasonable to expect that Python devs have had to check the c++ code/docs to determine if every method exposed in PyQGIS is supposed to be used or not. We CAN'T release with this regression. The consequences of knowingly breaking stable API in such a wholesale manner (especially mid-way through the 3.16 LTR release) are mind numbing... 😱 |
Hm, can't reproduce #45331 with the MSVC build.
as in 3.20 and 3.16. I wonder why we need to turn everything public explicetely at all. As python doesn't have protected methods, SIP should need to make them public already to make them available for derived classes (even if it probably cannot restrict their use to derived classes only). I guess the |
@jef-n |
|
So maybe the issue is only reproducible with sip v 5? (I'm stuck on 4.19, so can't test myself...) |
if needed, we could make this depending on the SIP version. |
I only tested with sip6 on my part and could reproduce the issue with sip6. Rather, if #45331 is not reproducible with the MSVC build, can the protected -> public replacement be made only on non-MSVC? |
Apparently not on MSVC at least. osgeo4w v2 has been using sip5 all along until the support was broken by the sip 6 updates. And on the 3.16 and 3.20 release builds I also get |
sip6 with diff --git a/cmake/SIPMacros.cmake b/cmake/SIPMacros.cmake
index 21328c9d83..4a9c400e6f 100644
--- a/cmake/SIPMacros.cmake
+++ b/cmake/SIPMacros.cmake
@@ -101,7 +101,7 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES
ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
- SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --pep484-pyi --no-make --concatenate=${SIP_CONCAT_PARTS} --qmake=${QMAKE_EXECUTABLE} --include-dir=${CMAKE_CURRENT_BINARY_DIR} --include-dir=${PYQT5_SIP_DIR} ${SIP_BUILD_EXTRA_OPTIONS})
+ SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --no-protected-is-public --pep484-pyi --no-make --concatenate=${SIP_CONCAT_PARTS} --qmake=${QMAKE_EXECUTABLE} --include-dir=${CMAKE_CURRENT_BINARY_DIR} --include-dir=${PYQT5_SIP_DIR} ${SIP_BUILD_EXTRA_OPTIONS})
ADD_CUSTOM_COMMAND(
OUTPUT ${_sip_output_files} and then also produces |
3fb0f66 (followup qgis#45348) Using --no-public-is-protected (default on Windows) also works on Linux and fixes qgis#45331 too
reverting 3fb0f66 (followup qgis#45348) Using --no-public-is-protected (default on Windows) also works on Linux and fixes qgis#45331 too
@nyalldawson so? |
@nirvn are you able to test this? |
@nyalldawson , @jef-n , building now. |
@nyalldawson , this commit (jef-n@7219b1f) works for me. Good job @jef-n . |
fixes #45331