summaryrefslogtreecommitdiff
path: root/pyuno
AgeCommit message (Collapse)Author
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-12-10Generally determine Rdb content from gb_*_set_componentfile callsStephan Bergmann
...instead of by listing the content somewhat redundantly in the Rdb_*.mk files, to avoid duplication of logic for components that are only built conditionally (and thus should only be included conditionally in the corresponding Rdb). To achieve that, add an "rdb" parameter to gb_ComponentTarget_ComponentTarget (and to the gb_*_set_componentfile macros that internally call gb_ComponentTarget_ComponentTarget), which is used to make the appropriate gb_Rdb_add_component call internally from within gb_ComponentTarget_ComponentTarget. (As a special case, gb_CppunitTest_set_componentfile shall not call gb_Rdb_add_component, as that has already been done by the corresponding gb_Library_set_componentfile call, so allow the gb_ComponentTarget_ComponentTarget "rdb" parameter to be empty to support that special case.) Most Rdb_*.mk files are thus mostly empty now. One exception is i18npool/Rdb_saxparser.mk, which duplicates some of the Rdb_services content as needed during the build in CustomTarget_i18npool/localedata. 1c9a40299d328c78c035ca63ccdf22c5c669a03b "gbuild: create services.rdb from built components" had already tried to do something similar (in addition to other things) under a new --enable-services-rdb-from-build option. However, that approach had four drawbacks that this approach here addresses (and which thus partly reverts 1c9a40299d328c78c035ca63ccdf22c5c669a03b): 1 Rdb_services shall not contain the component files of all libraries that are built. While that commit filtered out the component files that go into Rdb_ure/services (ure/Rdb_ure.mk), it failed to filter out the component files that go into others like Rdb_postgresql-sdbc (connectivity/Rdb_postgresql-sdbc.mk). 2 The code added by that commit to Makefile.gbuild codified the knowledge that there is an Rdb_services, which is brittle. 3 The code added by that commit to solenv/gbuild/Rdb.mk codified the knowledge (for gb_Rdb__URECOMPONENTS) that there is an Rdb_ure/services, which is brittle. 4 Introducing an --enable-services-rdb-from-build option needlessly provided two different ways how the content of Rdb_services is assembled. The changes done here would leave --enable-services-rdb-from-build as a misnomer, as it no longer controls how Rdb_services is assembled. I thus renamed it to --enable-customtarget-components, as that is apparently what it still does now. Change-Id: Ia5e8df4b640146c77421fcec6daa11a9cd260265 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126577 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
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>
2021-10-20loplugin:indentation check for indent inside blockNoel Grandin
look for places where the statements inside a block are not indented Change-Id: I0cbfa7e0b6fb194b2aff6fa7e070fb907d70ca2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123885 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-15Remove non-const Sequence::begin()/end() in internal codeMike Kaganski
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4Mike Kaganski
- Change implementations of getSomething to use getSomethingImpl Or where that's impossible, use getSomething_cast to unify this and reduce number of places where we reinterpret_cast. All static methods getting tunnel ids were renamed to getUnoTunnelId, to comply with the convention used in <comphelper/servicehelper.hxx>. TODO (in separate commits): - Revise uses of getSomething to use getFromUnoTunnel Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 3 [API CHANGE]Mike Kaganski
- Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> OImplementationId uses broken double checked locking; additionally, it uses it at the first call to getImplementationId, not when the object is constructed. This implementation can't be changed, cince it's part of published API; it can't rely on C++11, which would be required for use of thread-safe statics and move the initialization to ctor. The class has obsolete _bUseEthernetAddress member, that is unused and ignored since 4e9fa7e339a1cd6cb2fec643715991bcf5057cec. No need to implement it when replacing its uses to UnoIdInit. The deprecation is the API CHANGE. No published API is introduced to replace it; 3rd-party code should seek alternative solutions, or just keep using the deprecated functionality. TODO (in separate commits): - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: I8b6e684e5389bc0d5bb3b7f21f72a4c8f684107d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122077 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1Mike Kaganski
The header got some changes: 1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace 2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace of uses of OImplementationId with it, including in XTypeProvider 3. Introduce convenience functions 'getSomething_cast' to cast between sal_Int64 and object pointers uniformly. 4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make it a bit shorter, and to reflect its function better. Templatize it to take also css::uno::Any for convenience. 5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it handle cases both with and without fallback to parent. 6. Adjust UNO3_GETIMPLEMENTATION_* macros TODO (in separate commits): - Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation - Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-12Make this instance of cppu::OImplementationId function-localMike Kaganski
Change-Id: I1feaaec9906fd06ae86226c35820072d8b19cf17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121891 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-01clang-tidy:readability-redundant-member-initNoel Grandin
Change-Id: Ic5abfe2d047750d8dfd3ae8cc733fa15d34ea505 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121432 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-21loplugin:stringadd replace OUStringLiteral temporaries with OUString::ConcatNoel Grandin
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
Previously, all of the README files have been renamed to README.md and now, the contents of these files were changed to use Markdown format. Other than format inconsistency, some README.md files lacked information about modules, or were out of date. By using LibreOffice / OpenOffice wiki and other documentation websites, these files were updated. Now every README.md file has a title, and some description. The top-level README.md file is changed to add links to the modules. The result of processing the Markdown format README.md files can be seen at: https://docs.libreoffice.org/ Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-03-24Using .md extension/Markdown syntax for modules READMEHossein
Renaming all README files for all top level modules to README.md, applying no content change at this stage to be able to track history of the files. These files should be edited to use correct Markdown syntax later. Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-03-22cid#1473905 Dereference after null checkCaolán McNamara
Change-Id: I949971374a68156ba78dce3b8d058774b1bef816 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112872 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-02-21loplugin:refcounting in package..saxNoel
Change-Id: I83618f54a4117cd81d8626307716129a761e14c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111274 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-05tdf#138987 Python 3.12 preparationsdante
Change-Id: I8ea476bfbaf27f8ab2daf4a370efc9917a5f9f8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110346 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-06pyuno: uno.Char is UTF-16 code unit, not UCS-4Michael Stahl
Check for that in ctor. Change-Id: Ia69b3d87ac4ccb5b6cc13169d7022c04607c609f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108803 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-05tdf#138987 pyuno: PyEval_InitThreads is a no-op in Python 3.9David Ostrovsky
Change-Id: I220eecfa6aaf4d5cb12e3b4eacadf25843b41452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108403 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-04mbstowcs failure check is only relevant for non-_WIN32 nowStephan Bergmann
...after cbe9a0a815e4a73bf8db425a7c5c651e67b2ed65 "Use Unicode paths on Windows for pyuno" Change-Id: I898ee8ebbc1dfb215c55940c6336756ae7b5ccc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108658 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-01Use Unicode paths on Windows for pyunoMike Kaganski
No need to convert to 8-byte string only to convert back to UTF-16. No idea if this has some logic on Linux, so only changing Windows. Change-Id: I87b7f25e5b1a2dd07ac3354f8f065485949ef229 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108480 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-01-01UTF8 is not ASCIIMike Kaganski
Change-Id: Idb31b3d00f35e0f90a4420f250f7a04535f5fe0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108476 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-19tdf#138987 pyuno: PyEval_InitThreads is a no-op in Python 3.9David Ostrovsky
Change-Id: I7cf95ab1f237e315e8bd80b47758839bca34f970 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107946 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-07Wrap "open" into "with"Mike Kaganski
Change-Id: I1ecc16ddf565ac1f7306289fd51b673ed928cc20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107329 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-04Fix ResourceWarning in pythonloader.pyJulien Nabet
trace: /home/julien/lo/libreoffice/instdir/program/pythonloader.py:146: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/julien/lo/libreoffice/instdir/share/extensions/numbertext/reg.uno.py' mode='r' encoding='utf_8'> mod = self.getModuleFromUrl( locationUrl ) ResourceWarning: Enable tracemalloc to get the object allocation traceback Change-Id: I106ab6c3c9024a8c1a4624a3b64958dc205e30e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107232 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-10tdf#42949 Fix new IWYU warnings in directories [h-r]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I886b6f446293d3b1cfbf4ae05e8dbd7fabab9f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105510 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-06Revert "loplugin:stringbuffer"Noel Grandin
This reverts commit f0356b6128bb4e78041d53025ad7c2e0b8e0c299. Reason for revert: There is a OUStringConcat overload for OUStringBuffer which would have kicked in here, so this is unnecessary Change-Id: I3bafb6c30bd3a2c1912daf227554889f1e09c78a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105354 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-06loplugin:stringbufferNoel
Change-Id: Id6f7268f12eb728dbb255aa19cd590b6813c4f01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05loplugin:reducevarscope in pyunoNoel
Change-Id: I49157f373b0d5919492a0ba4ccdcd545c58730a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105333 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-23PyLong_AsLongAndOverflow returns long, and that's fine to use hereStephan Bergmann
...where the goal is to check for a value in the range [SAL_MIN_INT32 .. SAL_MAX_INT32], i.e., [-2^31 .. 2^31 - 1]: While C++17 (via C LONG_MIN, LONG_MAX) only guarantees a range of [-(2^31 - 1) .. 2^31 - 1] for long, C++20 now requires two's complement and a fitting range of at least [-2^31 .. 2^31 - 1]. No need for 0d79d216886a71436e705c93829ed66a33270a9c "long->tools::Long in pyuno..sd" here. Change-Id: I6be60b50acfe5ed798cc8e9e1183c336c8d72059 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104712 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-10-23long->tools::Long in pyuno..sdNoel
Change-Id: I67c1218d225f49ea9ce789433283ab85275e39a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104627 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-02Use the new single-instance="true" attribute in pyunoStephan Bergmann
Change-Id: I953dcc31445fc76d219903da56b2cc264f28c220 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103848 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-31Remove remains of private:image/ via ImageIdentifier addon propertyMaxim Monastirsky
This is broken since commit 5c39b28a87060f80404079ab77604f664addb063 ("tdf#96059 Replaced imageproducer with CommandInfoProvider") but so far no one complained (maybe because the usefulness of such internal images from extensions is questionable at least). Given also that the whole ImageIdentifier feature (even its still working part) is obsolete since OOo 2.0.3 (according to the OOo dev guide), and that the availability of a particular image from an internal hardcoded image list by a particular numerical id is more an implementation detail, let's just remove the broken code instead of fixing it. In the meantime, the code was also copied into the newly introduced notebookbar addon code, so I handled it there too. There are also the registry schema and a sdk example that mention this feature, and need to be adjusted. Interesting that the particular example used there - private:image/3216 is actually broken since 2011 with commit 2559cab126f81375197051fb5b07ba6abb9efc77 ("FDO#42454 - EasyHack: remove code associated with unused icons"). Change-Id: I968b4fb8c5b207654476dd92c57d8db0815520ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101529 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2020-08-21Fix typosAndrea Gelmini
Change-Id: I8dc0cdcfe6bd90efc596df28e6c6d968b92618b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101098 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2020-07-14pyuno: create instances with uno constructorsNoel Grandin
See tdf#74608 for motivation. Change-Id: I4bdc09b4ba5c2f7ecc4fc8184f2d8230896aef01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98716 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-10replace usage of blacklist with excludelist for IWYUThorsten Behrens
Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 Change-Id: I2f22d455d2a936a85750eaab1fda215ebb6d9d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98182 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-01Upcoming improved loplugin:staticanonymous -> redundantstatic: pyunoStephan Bergmann
Change-Id: I188716d5da92d495b9511f000dd9c1a78259fa9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97621 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-19tdf#121384 don't leave a bare trailing : in PYTHONPATHCaolán McNamara
and don't insert any empty path entries if that situation was to arise Change-Id: I8d8183485f457c3e4385181fee07390c4bfef603 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96713 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-05-21use for-range on Sequence in i18npool..sdNoel Grandin
Change-Id: I19eba57bc6058c317473d0746f06699a09ba2830 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94608 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-20fix some more python 3.8 deprecation warningsNoel Grandin
Change-Id: I8bdbf05f1357aea83a3cdda2f06d63c7d04de8f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94561 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-12Fix initialization of Python-3.8--only at-end tp_print memberStephan Bergmann
Until Python 3.7, PyTypeObject had a member tp_print following tp_dealloc, which had then been repurposed as > /* Methods to implement standard operations */ > > destructor tp_dealloc; > - printfunc tp_print; > + Py_ssize_t tp_vectorcall_offset; > getattrfunc tp_getattr; > setattrfunc tp_setattr; > PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2) in <https://github.com/python/cpython/commit/ aacc77fbd77640a8f03638216fa09372cc21673d> "bpo-36974: implement PEP 590 (GH-13185)" towards Python 3.8. Then only on the 3.8 branch (and prior to tag v3.8.0), <https://github.com/python/cpython/commit/ d917cfe4051d45b2b755c726c096ecfcc4869ceb> "[3.8] bpo-37250: put back tp_print for backwards compatibility (GH-14193)" added > destructor tp_finalize; > vectorcallfunc tp_vectorcall; > > + /* bpo-37250: kept for backwards compatibility in CPython 3.8 only */ > + Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int); > + > #ifdef COUNT_ALLOCS > /* these must be last and never explicitly initialized */ > Py_ssize_t tp_allocs; at the end of PyTypeObject. This was apparently done so that third-party code containing initialization code like X.tp_print = 0; would continue to compile (by just adding back a member with that name, even if at a "random" new---and otherwise unused---location). However, for our way of list-initializing PyTypeObject instances in pyuno that new member caused "missing field 'tp_print' initializer" -Wmissing-field-initializers warnings, so 50ccb7e82b7053306721cbe220323be072306a29 "python 3.8.2 compile: add tp_print to PyTypeObject" added initializers for this new at-end member. But it did so in a way that raises three concerns: 1 The new member was already added in Python 3.8.0 (prior to tag v3.8.0), not only in 3.8.2. 2 The new member was only added to Python 3.8. It has not been added to current master towards 3.9. 3 It is unclear why the comments mention "Py_ssize_t" as the type of that new member, when actually it is of a function pointer type (see above). Probably best to just drop that from the comments, to avoid confusion. Change-Id: Ib44f43befd5f28d4c1ac1e9e14bd55bfb4473507 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94019 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-11More targeted silencing of -Wdeprecated-declarationsStephan Bergmann
...compared to d1786724b8e8e474e1f7e39012c1f19611841dc0 "prevent warnings in pyuno with latest python". For one it is only the /* bpo-37250: kept for backwards compatibility in CPython 3.8 only */ Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int); member (in /usr/include/python3.8/cpython/object.h) that causes a warning. And for another it is only Clang that emits a warning when initializing a deprecated member that way, <http://lists.llvm.org/pipermail/cfe-dev/2020-May/065392.html> "[cfe-dev] Diagnosing initialization of deprecated data member?" Change-Id: I36625118a6bb26f5468d436da4caa82911181202 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94016 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-07prevent warnings in pyuno with latest pythonNoel Grandin
which has marked some members deprecated, but we can't stop initialising them or we run the risk of ASAN complaining Change-Id: I8f4ad0ae083fad9c040613ddde7c40f20d68c7d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93580 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-09pyuno: sed Python2/3 string compatibility wrappersMichael Stahl
Change-Id: I9ed25c5efaa4b447ab14a497a58bbe1147a6e7b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91698 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-04-09pyuno,*: kill Python 2 support with fireMichael Stahl
Python 2 support was retained for use with --enable-python=system on RHEL7 and SLES. The time has arrived to remove it. Some .py files that were imported from third parties are not changed to enable easier replacement with updated versions if necessary. solenv/gdb should continue to support Python 2. bin/get-bugzilla-attachments-by-mimetype requires Python 2 to access Launchpad. Change-Id: I26414ae8e9f8402c90336af82020135685694217 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91697 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-04-03loplugin:flatten in pyunoNoel Grandin
Change-Id: I6074463579f1ffc18f5683a3c4b109402b650f9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91613 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-26Extend loplugin:cstylecast to certain function-style castsStephan Bergmann
...that are equivalent to const_cast or reinterpret_cast, and should arguably better be written that way for clarity. Drawing inspiration from <https://reviews.llvm.org/D76572> "Replace `T(x)` with `reinterpret_cast<T>(x)` everywhere it means reinterpret_cast. No functional change". Change-Id: I27b8f70d324d32ecba658db4d1c2db03e10d5d3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91086 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>