summaryrefslogtreecommitdiff
path: root/pyuno/source
AgeCommit message (Collapse)Author
2024-11-13tdf#163486: PVS: variable was assigned the same valueXisco Fauli
Since commit 2387c2a46e15995686d28dccdfd455012072b4cf Author: Matthew J. Francis <mjay.francis@gmail.com> Date: Wed Jul 29 15:22:54 2015 +0800 Give PyUNO structs/exceptions their own separate type V1048 The 'me' variable was assigned the same value. Change-Id: Ia75c524c9cf459ff2961206c9a17dac1de0125a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176530 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-11-11clang-tidy: performance-unnecessary-copy-initialization in variousNoel Grandin
Change-Id: Ib7d75d4d8207261898568402e7983e0f11da14bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176417 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-11loplugin:reftotemp in pyuno..saxNoel Grandin
Change-Id: Ia616256e06f64ad3c635ac30abf521e5dab107d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176401 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-08Simplify a bitMike Kaganski
Change-Id: I618b0f8bcb2e8032ee12367c73e1136685f66b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176183 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-07loplugin:passstuffbyref in lotuswordpro..pyunoNoel Grandin
Change-Id: I9cd7a98d74b1896951124740b66d873ca41cceae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176197 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-10-27cid#1555789 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1556865 COPY_INSTEAD_OF_MOVE cid#1556871 COPY_INSTEAD_OF_MOVE cid#1556939 COPY_INSTEAD_OF_MOVE cid#1556951 COPY_INSTEAD_OF_MOVE cid#1556964 COPY_INSTEAD_OF_MOVE cid#1556966 COPY_INSTEAD_OF_MOVE cid#1556968 COPY_INSTEAD_OF_MOVE cid#1556971 COPY_INSTEAD_OF_MOVE cid#1556989 COPY_INSTEAD_OF_MOVE cid#1557001 COPY_INSTEAD_OF_MOVE cid#1557011 COPY_INSTEAD_OF_MOVE cid#1557032 COPY_INSTEAD_OF_MOVE cid#1557038 COPY_INSTEAD_OF_MOVE cid#1557041 COPY_INSTEAD_OF_MOVE cid#1557055 COPY_INSTEAD_OF_MOVE cid#1557056 COPY_INSTEAD_OF_MOVE cid#1557057 COPY_INSTEAD_OF_MOVE cid#1557065 COPY_INSTEAD_OF_MOVE cid#1557068 COPY_INSTEAD_OF_MOVE cid#1557087 COPY_INSTEAD_OF_MOVE cid#1557090 COPY_INSTEAD_OF_MOVE cid#1557093 COPY_INSTEAD_OF_MOVE cid#1557113 COPY_INSTEAD_OF_MOVE cid#1557122 COPY_INSTEAD_OF_MOVE cid#1557126 COPY_INSTEAD_OF_MOVE cid#1557145 COPY_INSTEAD_OF_MOVE cid#1557151 COPY_INSTEAD_OF_MOVE cid#1557152 COPY_INSTEAD_OF_MOVE cid#1557197 COPY_INSTEAD_OF_MOVE cid#1557216 COPY_INSTEAD_OF_MOVE cid#1557245 COPY_INSTEAD_OF_MOVE cid#1557272 COPY_INSTEAD_OF_MOVE cid#1557310 COPY_INSTEAD_OF_MOVE cid#1557314 COPY_INSTEAD_OF_MOVE cid#1557318 COPY_INSTEAD_OF_MOVE cid#1557333 COPY_INSTEAD_OF_MOVE cid#1557340 COPY_INSTEAD_OF_MOVE cid#1557358 COPY_INSTEAD_OF_MOVE cid#1557359 COPY_INSTEAD_OF_MOVE cid#1557365 COPY_INSTEAD_OF_MOVE cid#1557367 COPY_INSTEAD_OF_MOVE cid#1557395 COPY_INSTEAD_OF_MOVE cid#1557418 COPY_INSTEAD_OF_MOVE cid#1557488 COPY_INSTEAD_OF_MOVE cid#1557493 COPY_INSTEAD_OF_MOVE cid#1557506 COPY_INSTEAD_OF_MOVE cid#1557514 COPY_INSTEAD_OF_MOVE cid#1557528 COPY_INSTEAD_OF_MOVE cid#1557534 COPY_INSTEAD_OF_MOVE cid#1557537 COPY_INSTEAD_OF_MOVE cid#1557562 COPY_INSTEAD_OF_MOVE cid#1557563 COPY_INSTEAD_OF_MOVE cid#1557592 COPY_INSTEAD_OF_MOVE cid#1557608 COPY_INSTEAD_OF_MOVE cid#1557615 COPY_INSTEAD_OF_MOVE cid#1557619 COPY_INSTEAD_OF_MOVE cid#1557637 COPY_INSTEAD_OF_MOVE cid#1557648 COPY_INSTEAD_OF_MOVE cid#1557712 COPY_INSTEAD_OF_MOVE cid#1557750 COPY_INSTEAD_OF_MOVE cid#1557762 COPY_INSTEAD_OF_MOVE cid#1557765 COPY_INSTEAD_OF_MOVE Change-Id: I10db1910627e04a26e25836c05ad5c2707abd18b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175696 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-10-26cid#1555767 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1555770 COPY_INSTEAD_OF_MOVE cid#1555788 COPY_INSTEAD_OF_MOVE cid#1555789 COPY_INSTEAD_OF_MOVE cid#1555798 COPY_INSTEAD_OF_MOVE cid#1555816 COPY_INSTEAD_OF_MOVE cid#1555822 COPY_INSTEAD_OF_MOVE cid#1555835 COPY_INSTEAD_OF_MOVE cid#1555845 COPY_INSTEAD_OF_MOVE cid#1555859 COPY_INSTEAD_OF_MOVE cid#1555864 COPY_INSTEAD_OF_MOVE cid#1555868 COPY_INSTEAD_OF_MOVE cid#1555892 COPY_INSTEAD_OF_MOVE cid#1555896 COPY_INSTEAD_OF_MOVE cid#1555921 COPY_INSTEAD_OF_MOVE cid#1555932 COPY_INSTEAD_OF_MOVE cid#1555935 COPY_INSTEAD_OF_MOVE cid#1555944 COPY_INSTEAD_OF_MOVE cid#1555952 COPY_INSTEAD_OF_MOVE cid#1555985 COPY_INSTEAD_OF_MOVE cid#1556024 COPY_INSTEAD_OF_MOVE cid#1556038 COPY_INSTEAD_OF_MOVE cid#1556042 COPY_INSTEAD_OF_MOVE cid#1556044 COPY_INSTEAD_OF_MOVE cid#1556060 COPY_INSTEAD_OF_MOVE cid#1556083 COPY_INSTEAD_OF_MOVE cid#1556085 COPY_INSTEAD_OF_MOVE cid#1556090 COPY_INSTEAD_OF_MOVE cid#1556136 COPY_INSTEAD_OF_MOVE cid#1556157 COPY_INSTEAD_OF_MOVE cid#1556159 COPY_INSTEAD_OF_MOVE cid#1556172 COPY_INSTEAD_OF_MOVE cid#1556179 COPY_INSTEAD_OF_MOVE cid#1556187 COPY_INSTEAD_OF_MOVE cid#1556255 COPY_INSTEAD_OF_MOVE cid#1556256 COPY_INSTEAD_OF_MOVE cid#1556266 COPY_INSTEAD_OF_MOVE cid#1556275 COPY_INSTEAD_OF_MOVE cid#1556290 COPY_INSTEAD_OF_MOVE cid#1556294 COPY_INSTEAD_OF_MOVE cid#1556301 COPY_INSTEAD_OF_MOVE cid#1556311 COPY_INSTEAD_OF_MOVE cid#1556318 COPY_INSTEAD_OF_MOVE cid#1556326 COPY_INSTEAD_OF_MOVE cid#1556369 COPY_INSTEAD_OF_MOVE cid#1556374 COPY_INSTEAD_OF_MOVE cid#1556387 COPY_INSTEAD_OF_MOVE cid#1556388 COPY_INSTEAD_OF_MOVE cid#1556417 COPY_INSTEAD_OF_MOVE cid#1556425 COPY_INSTEAD_OF_MOVE cid#1556435 COPY_INSTEAD_OF_MOVE cid#1556495 COPY_INSTEAD_OF_MOVE cid#1556497 COPY_INSTEAD_OF_MOVE cid#1556501 COPY_INSTEAD_OF_MOVE cid#1556503 COPY_INSTEAD_OF_MOVE cid#1556520 COPY_INSTEAD_OF_MOVE cid#1556523 COPY_INSTEAD_OF_MOVE cid#1556562 COPY_INSTEAD_OF_MOVE cid#1556573 COPY_INSTEAD_OF_MOVE cid#1556576 COPY_INSTEAD_OF_MOVE cid#1556598 COPY_INSTEAD_OF_MOVE cid#1556615 COPY_INSTEAD_OF_MOVE cid#1556626 COPY_INSTEAD_OF_MOVE cid#1556671 COPY_INSTEAD_OF_MOVE cid#1556689 COPY_INSTEAD_OF_MOVE cid#1556701 COPY_INSTEAD_OF_MOVE cid#1556713 COPY_INSTEAD_OF_MOVE cid#1556758 COPY_INSTEAD_OF_MOVE cid#1556759 COPY_INSTEAD_OF_MOVE cid#1556788 COPY_INSTEAD_OF_MOVE cid#1556811 COPY_INSTEAD_OF_MOVE cid#1556821 COPY_INSTEAD_OF_MOVE cid#1556824 COPY_INSTEAD_OF_MOVE cid#1556825 COPY_INSTEAD_OF_MOVE cid#1556862 COPY_INSTEAD_OF_MOVE Change-Id: I4925a79688a983bb07252600430039ec0bcb75b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175678 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-09-29tdf#163190: [pyuno] SyntaxWarning: invalid escape sequence '\P'Julien Nabet
Use raw string to fix this. Regression from d8978a8c4ffabd6b36a691fd3e2df68563808234 tdf#116156 tdf#157162 tdf#159528 Fix glitches in officehelper.py Change-Id: I6f68fdc5988c05b41dc91619947d0d97d04bc739 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174108 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2024-09-19Remaining GCC -Wcast-function-type issuesStephan Bergmann
As Clang supports that warning now too, lots of occurrences have meanwhile been cleaned up for good (0c29c417ef3f0b749042e5a461abae9c36cf655b "Avoid -Werror,-Wcast-function-type-mismatch", 1344e6261a1d856c71eca1e0cc29215a586bf335 "Avoid -Werror,-Wcast-function-type-mismatch", 85a2bb9f52a0d834b02681344ce56e0b091e1abd "Avoid -Werror,-Wcast-function-type-mismatch", etc.), so ce99754e9b5b954be4360f39356ed7198b298265 "Globally disable -Wcast-function-type new with upcoming GCC 8" in solenv/gbuild/platform/com_GCC_defs.mk should no longer be necessary. One remaining issue I encountered was dae7304df68493afcf6e9c9e490d65ea20d8211f "Silence Clang 19 trunk -Werror,-Wcast-function-type-mismatch", where GCC needs a different way for silencing the warnings in pyuno/source/module/ than had been used there for Clang. Change-Id: I5d0404b957d798114051209c31e022a898cf91f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173623 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
2024-08-01pyuno,unotest,xmlsecurity: copy GPG test files for UITtestMichael Stahl
The problem was that running UITest_xmlsecurity_gpg changed the files in test/signing-keys/ ... prevent that by copying the directory in that test, which is more complicated than initially expected. Change-Id: Ie3be922e0b2e9dae49f9a70e35ad5270c90b4fc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171322 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2024-07-27odk, oox, pyuno: fix issues found by Ruff linterIlmari Lauhakangas
Change-Id: I79d56453877a10502768b522ca93da3990891c0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171098 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-07-20Remove now unneeded osl/diagnose.hGabor Kelemen
followup to commit 57c228803e55ed343c6693de7d0857ad7d3cd9e3 Change-Id: Iebfb23bb65e2bf898bf27f367cc9641f47a14cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167998 Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Jenkins
2024-07-11cid#1607892 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1607910 COPY_INSTEAD_OF_MOVE cid#1607818 COPY_INSTEAD_OF_MOVE cid#1557402 COPY_INSTEAD_OF_MOVE cid#1556530 COPY_INSTEAD_OF_MOVE cid#1557396 COPY_INSTEAD_OF_MOVE cid#1556522 COPY_INSTEAD_OF_MOVE cid#1555628 COPY_INSTEAD_OF_MOVE cid#1554705 COPY_INSTEAD_OF_MOVE Change-Id: Iae3fbf4a04bf3714f416995640b9d70fe204cf73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170321 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-05pyuno: fix deprecated warningsXisco Fauli
* Replace PyUnicode_FromUnicode(str, len) with PyUnicode_FromWideChar(str, len) * Replace PyUnicode_AS_UNICODE(PyObject) with PyUnicode_AsWideCharString(PyObject, size) Change-Id: I1d8b46059d72f4de261d99393e1681f1e41eafdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169625 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-06-19Fix typoAndrea Gelmini
Change-Id: I633ad7aa1a8167795e76bfacfaeec9a42b9db3f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169157 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-05-11workaround clang segfault on macos-intelNoel Grandin
Change-Id: Icfced4a990e2d02995bff4078f14b8ee26e9cca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-10loplugin:ostr in pyunoNoel Grandin
Change-Id: I54555110b5c66ea92f2675edc50dccd252558e28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167435 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-05-09tdf#158447 Use PyConfig for setting Python home directory with Python >= 3.8Ilmari Lauhakangas
Change-Id: Ic5b7c60613b22f5215cb1a2a13fecf3e0946ca49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161089 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-04-03minor fixes to officehelper.pyAlain Romedenne
- erroneous code sample in code comment -retry delays - fix when raising OSError exception - undefined variable Change-Id: I2cae4e8b6bbb3153e79f290ae1d316aa22a86b4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165714 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-26officehelper.py memory cleanupAlain Romedenne
- main program must stop subprocesses it initiates before it throws exceptions Change-Id: I6e87d79e2f21cd41f7cd8e470cc166f8d5282954 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164819 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-24Silence Clang 19 trunk -Werror,-Wcast-function-type-mismatchStephan Bergmann
Change-Id: Icd0af828e47c770ca8964656188d0d722a7f1ddc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165250 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-13allow build with python 3.12.0: initialize new tp_watchedJustin Luth
This fixes the build failure after I updated Ubuntu 24.04 (alpha), which upgraded python 3.11.7 to python 3.12.0, causing the error: libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1: error: missing initializer for member ‘_typeobject::tp_watched’ [-Werror=missing-field-initializers] ... I gleaned this information from a July 2023 commit for https://github.com/xbmc/xbmc/issues/23503 tp_watched was added in upstream commit python/cpython@82ccbf6 https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab This change first appeared in Python v3.12.0a1 Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-02tdf#116156 tdf#157162 tdf#159528 Fix glitches in officehelper.pyAlain Romedenne
- MacOs & GNU/Linux distributions are supported, next to Windows - Connection attempts are customisable - Reporting to console can be configured - Python source doc. added - service memory cleanup suggestion examples intended for QA as well as inclusion in wiki pages officehelper documentation: https://wiki.documentfoundation.org/Documentation/DevGuide/First_Steps#First_Contact Change-Id: I6a7c19429e78a1736e4a1479c4bbc1950228d93f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164118 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-26Define a name for the extended path buffer size, instead of a literalMike Kaganski
Change-Id: If6d40c818e021b3241d6b6b33aceca07c6393511 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163926 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Replace an instance of MAX_PATH with 32767Mike Kaganski
... which is the approximate maximum of Windows API, as documented in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation Change-Id: I8b10e41d3a8bf85e266f071bdc2eb88eb9403917 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163914 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-15pyuno: Use expected return value (-1) on failureAron Budea
Both PyObject_SetAttr and PyObject_SetItem are expected to: Raise an exception and return -1 on failure; return 0 on success. https://docs.python.org/3/c-api/object.html Change-Id: Id1f6129e91e9da2f5d3bc1858422eeee4c3393d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163418 Tested-by: Jenkins Reviewed-by: Aron Budea <aron.budea@collabora.com>
2024-01-27Drop std::as_const from css::uno::Sequence iterationsMike Kaganski
Obsoleted by commit 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and commit fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code, 2021-11-05). Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-17Add back XComponentContext to officecfg::...::get() callsStephan Bergmann
4256c764aee0777770466115a97420d9b55c23ac "do not pass XComponentContext to officecfg::...::get() calls" had removed it, for performance reasons, but 8a695046cfcc8f9ec835b208b0d56ca821a3ff84 "tdf#158375 Hack to make sure process service factory is set" is a case where it should be passed in. To hopefully avoid performance regressions, don't default to comphelper::getProcessComponentContext() for what gets passed in, but default to an empty Reference and only call comphelper::getProcessComponentContext() when actually needed in the implementation. Change-Id: I5b75ac2c28f36e21d1c8bc368b0b972c33c61a51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-17tdf#158375 Hack to make sure process service factory is setStephan Bergmann
(TODO: A more clean fix would pass XComponentContext into the configuration wrapper.) Change-Id: I1936a4517877f30cc7a825ce1c94923b350f7173 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162198 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-09tdf#158375: add expert option DisablePythonRuntimeSarper Akdemir
When DisablePythonRuntime is set, anything that utilizes pyuno bindings won't work (e.g. python macros and extensions). Change-Id: Id42d01647eebee42b120b399470a1f944e4ba00f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160968 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-11-19Extended loplugin:ostr: pyunoStephan Bergmann
Change-Id: Ie8ec1e8b3debd1501b16d40567a063390749a19b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159683 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-23tdf#130924 replace '*printf' with 'SAL_*' logging macros in pyunosahil
Change-Id: I2c491629f52fe0b90517c563f221d7d0345b6ee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156452 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-10-14Use exception ctors, instead of setting members laterMike Kaganski
Avoids overwriting source location in message Change-Id: Ia0290c7dd1ab3ea1357712a27ecab75c7b583dd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157893 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-09-29cid#1546834 Unchecked return valueCaolán McNamara
Change-Id: Id2c54c61d3d44611ab02db81b8e64cedb0010ba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157398 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-01WaE: Py_SetPythonHome is deprecated since python 3.11Caolán McNamara
not obvious how to replace it, so just accept for now Change-Id: Id3fc4c95a5cc60e078f06faaa024faa9c770de20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152504 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-04-17loplugin:stringaddStephan Bergmann
Change-Id: I04dad33cad121eba7189fc78cac762e31d7c4c2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150477 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-27loplugin:stringadd in oox..pyunoNoel Grandin
after my patch to merge the bufferadd loplugin into stringadd Change-Id: I5fdc0a33923fe00e7b588f4576607515a93e5c13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-13tdf#143148 Use pragma once instead of include guardsbuldi
Change-Id: I5a88b699425a37b914a71400e918965a9f6116eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146730 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-09-16tdf#150982: properly unquote (URL-decode) vnd.sun.star.expand payloadMike Kaganski
Similar to what is done in bootstrap_expandUri, expandUnoRcUrl, UrlReference::expand, JavaLoader.expand_url, and is documented in XVndSunStarExpandUrl interface. Change-Id: I92917adb38e42c3926494427e4df2451298033e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140042 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-13clang-tidy modernize-pass-by-value in variousNoel Grandin
Change-Id: Ie091b22bd77d4e1fbff46545bc86c12f1dbafcfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138171 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-10loplugin:passstuffbyrefNoel Grandin
Change-Id: Ib2b2650da7abc9260897f9b5aad619a0ea6ae941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138052 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-09tdf#133123: fix crash when importing defusedxml.ElementTree after pyunoNiko Fink
Change-Id: I89ac6108c679504c81dd9a439a4fb02e9e1adc07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138007 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-07-22elide some makeStringAndClear() callsNoel Grandin
Change-Id: I3b80d0f5b6d39c071242bc6ccc1e4333886c835d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137309 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-16rhbz#2097411 Avoid obsolete PyThreadState_Delete crashing Python 3.11Stephan Bergmann
1fb53a637597f76bea86514b62ddfad34f60c889 "pyuno_loader::CreateInstance: delete the initial PyThreadState" had added the PyThreadState_Delete for claimed benefits but whose details appear lost to history (cf. the comment thread starting at <https://gerrit.libreoffice.org/c/core/+/3452/2#message-602ff52abdd1c95fd5c13cfe405b5fadd0048c5f> "pyuno_loader::CreateInstance: delete the initial PyThreadState"). And at least a recent master Linux --enable-python=fully-internal build with the bundled Python 3.8.12 appears to succeed `make check` just fine with the PyThreadState_Delete temporarily removed. But on the other hand, building against upcoming Python 3.11 now started to make CppunitTest_services fail with > Fatal Python error: init_threadstate: thread state already initialized > Python runtime state: initialized > Thread 0x0000ffff81c8b020 (most recent call first): > <no Python frame> > Fatal exception: Signal 6 > Stack: > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_sal.so.3(+0x37c28)[0xffff81be7c28] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_sal.so.3(+0x37e40)[0xffff81be7e40] > linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffff81ccb7ec] > /lib64/libc.so.6(+0x82878)[0xffff81742878] > /lib64/libc.so.6(raise+0x20)[0xffff816fae00] > /lib64/libc.so.6(abort+0xe8)[0xffff816e72b8] > /lib64/libpython3.11.so.1.0(+0x104e28)[0xfffee4de4e28] > /lib64/libpython3.11.so.1.0(+0x105200)[0xfffee4de5200] > /lib64/libpython3.11.so.1.0(PyThread_get_thread_native_id+0x0)[0xfffee4ed6764] > /lib64/libpython3.11.so.1.0(PyThreadState_New+0x14)[0xfffee4ed6628] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libpyuno.so(_ZN5pyuno14PyThreadAttachC2EP3_is+0x78)[0xfffee4c8c52c] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libpythonloaderlo.so(pyuno_Loader_get_implementation+0x5c)[0xfffee5243060] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_cppuhelpergcc3.so.3(+0x544b4)[0xffff815544b4] because of the PyThreadState_Delete. (The deleted PyThreadState, while not reused again directly, is still recorded in the state obtained from PyInterpreterState_Head() later.) So conservatively keep the PyThreadState_Delete of unclear benefit for older Python versions and only drop it for 3.11 where it is known to have negative effects now. Change-Id: I9b99f1e947f0b165ddc95c2bfbd764858dda39db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136006 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-04Just use Any ctor instead of makeAny in pyunoStephan Bergmann
Change-Id: I53eb836c64e8e4a354c5c895bc7f16b168bd4cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133793 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-17loplugin:stringviewparam convert methods using copy()Noel Grandin
which converts to std::string_view::substr() Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-01Don't make UNO calls from PyThreadAttached regions (i.e., with the GIL locked)Stephan Bergmann
...which caused e.g. UITest_writer_tests3 to occasionally hang with the python.bin process thread 1 at > File "sw/qa/uitest/writer_tests3/insertPageFooter.py", line 30, in delete_footer [...] i.e., > #4 ___pthread_cond_wait at /usr/src/debug/glibc-2.35-4.fc36.x86_64/nptl/pthread_cond_wait.c:618 > #5 0x00007ff9d6ad9c43 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:72 > #6 0x00007ff9d6ae8e79 in cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) at cppu/source/threadpool/threadpool.cxx:303 > #7 0x00007ff9d6ae9278 in uno_threadpool_enter(uno_ThreadPool, void**) at cppu/source/threadpool/threadpool.cxx:407 > #8 0x00007ff9c7d016eb in binaryurp::Bridge::makeCall(rtl::OUString const&, com::sun::star::uno::TypeDescription const&, bool, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >&&, binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) at binaryurp/source/bridge.cxx:604 > #9 0x00007ff9c7d322fc in binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:168 > #10 0x00007ff9c7d338cb in binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:101 > #11 0x00007ff9d63222e0 in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, typelib_TypeDescription const*, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191 > #12 0x00007ff9d6322b59 in cpp_vtable_call(sal_Int32, sal_Int32, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389 > #13 0x00007ff9d63336ca in privateSnippetExecutor at instdir/program/libgcc3_uno.so > #14 0x00007ff9d6241f38 in (anonymous namespace)::ImplIntrospectionAccess::hasByName(rtl::OUString const&) at stoc/source/inspect/introspection.cxx:1114 > #15 0x00007ff9d6b856b2 in pyuno::PyUNO_getattr(PyObject*, char*) at pyuno/source/module/pyuno.cxx:1392 [...] doing a remote call to soffice.bin with GIL locked, and thread 4 at > #6 0x00007ff9e51efa28 in take_gil at workdir/UnpackedTarball/python3/Python/ceval_gil.h:207 > #7 0x00007ff9e51f00d3 in PyEval_AcquireThread at workdir/UnpackedTarball/python3/Python/ceval.c:316 > #8 0x00007ff9d6b9b1e8 in pyuno::Adapter::invoke(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) at pyuno/source/module/pyuno_adapter.cxx:181 > #9 0x00007ff9d632b3e4 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77 > #10 0x00007ff9d632a4f1 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233 > #11 0x00007ff9d632a9e6 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413 > #12 0x00007ff9d621384a in stoc_invadp::(anonymous namespace)::AdapterImpl::invoke at stoc/source/invocation_adapterfactory/iafactory.cxx:457 > #13 stoc_invadp::adapter_dispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**) at stoc/source/invocation_adapterfactory/iafactory.cxx:605 > #14 0x00007ff9c7d1a7db in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const at include/typelib/typedescription.hxx:155 > #15 0x00007ff9c7d1d65f in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:78 > #16 0x00007ff9c7d33ad3 in binaryurp::(anonymous namespace)::request(void*) at ~/gcc/trunk/inst/include/c++/12.0.1/bits/unique_ptr.h:172 > #17 0x00007ff9d6ad9e1b in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100 > #18 0x00007ff9d6adbb80 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:164 [...] processing an unrelated incoming call from soffice.bin and blocked trying to lock the GIL. (The reason that thread 1 doesn't make progress is that the soffice.bin process is also blocking with thread 6 at > #8 osl::Guard<comphelper::SolarMutex>::Guard(comphelper::SolarMutex&) at include/osl/mutex.hxx:142 > #9 SolarMutexGuard::SolarMutexGuard() at include/vcl/svapp.hxx:1368 > #10 sw::(anonymous namespace)::XStyleFamily::hasByName(rtl::OUString const&) at sw/source/core/unocore/unostyle.cxx:923 > #11 0x00007f089d3d53e4 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77 > #12 0x00007f089d3d44f1 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233 > #13 0x00007f089d3d49e6 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413 > #14 0x00007f089c1be7db in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const at include/typelib/typedescription.hxx:155 > #15 0x00007f089c1c165f in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:78 > #16 0x00007f089c1d7ad3 in binaryurp::(anonymous namespace)::request(void*) at ~/gcc/trunk/inst/include/c++/12.0.1/bits/unique_ptr.h:172 > #17 0x00007f08a18ade1b in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100 > #18 0x00007f08a18afb80 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:164 [...] processing the incoming call from python.bin thread 1 and blocked trying to lock the SolarMutex, while thread 1 at > #4 ___pthread_cond_wait at /usr/src/debug/glibc-2.35-4.fc36.x86_64/nptl/pthread_cond_wait.c:618 > #5 0x00007f08a18adc43 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:72 > #6 0x00007f08a18bce79 in cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) at cppu/source/threadpool/threadpool.cxx:303 > #7 0x00007f08a18bd278 in uno_threadpool_enter(uno_ThreadPool, void**) at cppu/source/threadpool/threadpool.cxx:407 > #8 0x00007f089c1a56eb in binaryurp::Bridge::makeCall(rtl::OUString const&, com::sun::star::uno::TypeDescription const&, bool, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >&&, binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) at binaryurp/source/bridge.cxx:604 > #9 0x00007f089c1d62fc in binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:168 > #10 0x00007f089c1d78cb in binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:101 > #11 0x00007f089d3cc2e0 in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, typelib_TypeDescription const*, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191 > #12 0x00007f089d3ccb59 in cpp_vtable_call(sal_Int32, sal_Int32, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389 > #13 0x00007f089d3dd6ca in privateSnippetExecutor at instdir/program/libgcc3_uno.so > #14 0x00007f08a6b5d170 in operator() at sfx2/source/notify/globalevents.cxx:491 > #15 comphelper::OInterfaceContainerHelper4<com::sun::star::document::XDocumentEventListener>::forEach<(anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyListener(const com::sun::star::document::DocumentEvent&)::<lambda(const com::sun::star::uno::Reference<com::sun::star::document::XDocumentEventListener>&)> > at include/comphelper/interfacecontainer4.hxx:285 > #16 at sfx2/source/notify/globalevents.cxx:488 > #17 0x00007f08a6b04c8b in (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator() (listener=Python Exception <class 'gdb.error'>: Dwarf Error: Cannot find DIE at 0x0 referenced in module instdir/program/libmergedlo.so > #18 comphelper::OInterfaceContainerHelper2::forEach<com::sun::star::document::XDocumentEventListener, at include/comphelper/interfacecontainer2.hxx:271 > #19 SfxBaseModel::postEvent_Impl(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XController2> const&, com::sun::star::uno::Any const&) at sfx2/source/doc/sfxbasemodel.cxx:3253 > #20 0x00007f08a6b066fe in SfxBaseModel::Notify(SfxBroadcaster&, SfxHint const&) at sfx2/source/doc/sfxbasemodel.cxx:2902 > #21 0x00007f08a6f15def in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:39 > #22 0x00007f087d640650 in SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) at sw/source/core/layout/layact.cxx:2389 > #23 0x00007f087dc0832b in SwViewShell::LayoutIdle() at sw/source/core/view/viewsh.cxx:821 > #24 0x00007f087d2ba194 in sw::DocumentTimerManager::DoIdleJobs(Timer*) at sw/source/core/inc/rootfrm.hxx:206 > #25 0x00007f08a89fbd26 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:472 > #26 0x00007f08a8ca8780 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54 > #27 SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:212 > #28 0x00007f08a8ca99bd in SvpSalInstance::ImplYield(bool, bool) at vcl/headless/svpinst.cxx:452 > #29 0x00007f08a8ca9db1 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:524 > #30 0x00007f08a8a27d4c in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:474 > #31 0x00007f08a8a28445 in Application::Execute() at vcl/source/app/svapp.cxx:452 [...] is doing the remote call to python.bin thread 4 with the SolarMutex erroneously locked. But lets concentrate on just fixing the python.bin deadlock in this commit.) The PyThreadDetach antiguard just covering the xInvocation->getValue call in the "or a property" case had been added with e0a1cd4dc7202795e4a60c73ea1608d86984add7 "fixed a deadlock", presumably without taking into account that the xInvocation->hasMethod/hasProperty calls are equally problematic. Change-Id: I2483949df8213c3397a674be190224ee58c95c02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132428 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-07tdf#146621: handle an exception that may hang process at ExitProcess timeMike Kaganski
Change-Id: I3ffc2303ae1851ab909612ae9bb7f70a077b24fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128097 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-22loplugin:flatten in package..reportdesignNoel Grandin
Change-Id: I2da242fcb59709ebdd0819ec04d051d794da71e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-30Prepare for removal of non-const operator[] from Sequence in pyunoMike Kaganski
Change-Id: Ifea4a6baa5fd3878e807ffde6b3fd2e2794312f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124379 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>