Fix Regression in [OUT] parameters handling (Issue #287)#289
Fix Regression in [OUT] parameters handling (Issue #287)#289oaubert merged 3 commits intooaubert:masterfrom
Conversation
Part of the problem was that `Func.docs_in_sphinx_format` is called after `Par.flags` during generation, when the former method fills the `out` member of `Func`, on which the output of `Par.flags` depends. It resulted in out parameters being incorrectly flagged as in parameters (because it is the default). The concerned functions are: - `libvlc_log_get_context` - `libvlc_log_get_object`.
Out parameters that have documentation spanning multiple lines were not flagged as out parameters, because only the presence of `[OUT]` in the _first_ documentation line was checked. This commit fixes the issue be checking the presence of `[OUT]` in other lines as well. The concerned functions are: - `libvlc_media_discoverer_list_get` - `libvlc_media_player_get_full_chapter_descriptions` - `libvlc_media_player_get_full_title_descriptions` - `libvlc_media_slaves_get` - `libvlc_media_tracks_get` - `libvlc_renderer_discoverer_list_get`
|
Great, thanks! I had a look at the media_tracks_get issue, but we will need to fix the ctypes code before updating the override code: calling the To solve this, I think we will have to write a I got to something like: but the last conversion needs some thinking, and then some more investigation to make sure that the correct argument is used. To be continued... |
I identified and fixed two bugs:
During bindings generation (
PythonGenerator.generate_funcsandPythonGenerator.generate_func_pointer_decorator),Func.docs_in_sphinx_formatwas called afterPar.flags, when the former fills theoutmember ofFunc, which determines the output ofPar.flags. This resulted in out parameters being ignored, even though they are properly gathered byFunc.docs_in_sphinx_format. Actually, some are still taken into account, because inPar.flags, some pointer types are hard-coded to be considered out parameters (this hard-coding may not be necessary anymore).This issue is fixed by commit "Partially fix regression in [OUT] parameter handling".
The functions concerned by the fix are:
libvlc_log_get_contextlibvlc_log_get_objectFunc.docs_in_sphinx_formatdid not properly gather all out parameters. It failed to gather those that have documentation spanning multiple lines. As the[OUT]flag is often (always?) present at the end of a parameter's documentation, it was missed in those cases.This issue is fixed by commit "Fix regression in [OUT] parameters handling".
The functions concerned by the fix are:
libvlc_media_discoverer_list_getlibvlc_media_player_get_full_chapter_descriptionslibvlc_media_player_get_full_title_descriptionslibvlc_media_slaves_getlibvlc_media_tracks_getlibvlc_renderer_discoverer_list_getWhat I have not done is change
generator/templates/override.py, which has calls to:libvlc_media_player_get_full_chapter_descriptionslibvlc_media_player_get_full_title_descriptionslibvlc_media_tracks_getthat now take an incorrect number of arguments.
Tests fail for this reason.
Otherwise, the first commit ("Fix dumping of parameters that are Func and not Par") fixes a small bug in the code for dumping in debug mode.