Commit Graph

65 Commits

Author SHA1 Message Date
wmayer
b2672abc06 Tools: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Jonas Bähr
34b176c1db Remove C++ escaping from *Py.xml templates
Now all escaping required for the C++ code generation is done when the
.cpp/.h files are generated. Previously, only newlines were escaped
automatically. This was a) inconsistent and b) leaked c++ details into
the xml data.
In addition, the escaping is now done in one central place, harmonizing
the three previous implementations.

Pre-existing c++ escape sequences in the XML files have been replaced by
their literal equivalent so that the resulting python doc sting remains
unchanged.
2023-08-16 13:17:25 +02:00
wmayer
9f99285d59 modernize C++: use nullptr 2023-08-05 11:23:12 -06:00
wmayer
702f3b4ddd Core: modernize C++: redundant void arg 2023-08-05 16:50:31 +02:00
wmayer
b8a7849dd3 Misc: modernize C++: use override 2023-08-04 17:09:53 +02:00
Chris Hennes
99cd277a93 Tools: Apply pre-commit autoformatting 2023-04-22 13:07:06 -05:00
marioalexis
2b68404892 src: Add descriptor protocol support for Python C++ extension modules 2023-04-10 16:53:51 +02:00
mosfet80
bed7b76524 remove Python2 code 2023-03-04 17:51:43 -06:00
luzpaz
5d3f56989d Fix various indentation issues (tabs->spaces) 2023-01-23 16:59:28 +01:00
wmayer
4e42ff7baa Base: modernize C++: replace 'typedef' with 'using' 2022-08-29 11:42:09 +02:00
luz paz
aec90797b4 Fix various 'testing inequality to None' syntax issues
Substitute `is not None` for `!= None`
2022-07-30 22:41:31 -04:00
Uwe
3060e6197b Revert "remove unused python<3.6 code"
This reverts commit 62d8116bb8af1df8b971bb591611356111a4488c.
2022-06-19 16:23:13 +02:00
andrea
9b640f10cf remove unused python<3.6 code 2022-06-19 15:33:44 +02:00
wmayer
e4d1ed8366 Base: rename BaseExceptionFreeCADError to PyExc_FC_GeneralError 2022-03-17 14:45:48 +01:00
wmayer
659a55ffb9 Base: Exception handling:
* Harmonize FreeCAD with Python exception types
* Implement AbortException::getPyExceptionType() to avoid handling it in client code
* Remove catch block for plain C strings
2022-01-19 18:00:04 +01:00
luz paz
63cd79538e Misc: remove py2 code 2021-04-27 18:52:01 +02:00
wmayer
56c92d1198 Fix generation and build of python classes for 3.8 2021-04-27 14:35:34 +02:00
markus
d6fa0b1d18 Fix generation and build of python classes for 3.9 2021-04-27 00:41:53 +02:00
wmayer
c563198b35 Base: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:29:48 +02:00
wmayer
dbbac56185 Base: do not report C++ exception when converting it to Python exception
See https://forum.freecadweb.org/viewtopic.php?f=23&t=56464
2021-04-11 14:54:11 +02:00
wmayer
2f7e432051 Py3: suppress warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
If the tp_print slot is not set the warning -Wmissing-field-initializers is raised. If it's set then -Wdeprecated-declarations is raised.
So, the only way is to suppress it.
2020-10-15 17:07:39 +02:00
wmayer
c6374bc102 Py3: fix warning: missing field 'tp_print' initializer [-Wmissing-field-initializers]
This warning is only specific to Py3.8. See https://docs.python.org/3/c-api/typeobj.html
2020-10-15 10:35:47 +02:00
wmayer
0b1a2bf223 Py3.8: missing initializer for member '_typeobject::tp_vectorcall' [-Wmissing-field-initializers] 2020-06-08 14:32:21 +02:00
luz.paz
97e11fadac Fix typo in templateClassPyExport.py [skip ci] 2019-12-23 16:50:23 +01:00
wmayer
065356281d Python: change generation of callback functions for class or static methods 2019-12-19 17:55:12 +01:00
wmayer
7f7a573ace handle nested name spaces in Python generation script 2019-11-20 22:57:58 +01:00
wmayer
76f76f02dd add support of static and class methods in Python wrappers 2019-11-12 23:24:42 +01:00
Zheng, Lei
812aea7262 Tools: modify exception catch implemention in templateClassPyExport 2019-08-28 17:46:07 +02:00
wmayer
1106404b1e implement true divide handler of the number protocol for Quantity 2018-10-27 15:27:27 +02:00
wmayer
5df6090150 Make destructors of all generated Py class protected
This is to avoid to create an object on the stack and thus to clutter Python's reference counting mechanism
2018-09-19 18:22:22 +02:00
luz.paz
360e581672 Misc. typo and whitespace fixes
ref: https://forum.freecadweb.org/viewtopic.php?f=3&t=30988#p256964
along with other misc. fixes
2018-09-19 17:26:03 +02:00
Michal Ulianko
2e2b8cba6a py3.7 fix
PyUnicode_AsUTF8() returns const char* in py3.7 instead of char*. Making
changes to reflect that which should also be safe in
other Python versions.
2018-09-01 22:44:39 +02:00
wmayer
1cd894bacc fix -Wcast-function-type 2018-08-19 13:11:08 +02:00
looooo
088b2687ea win: pybind11: workaround for strdup 2018-04-23 09:56:23 +02:00
wmayer
5520c1a92f fix generation script of Python wrapper 2017-11-16 14:30:39 +01:00
luzpaz
f3bf8fe919 Misc. typos
+ some are doxy others are just comment code.  
+ some minor whitespace and grammatical tweaks. 
+ app/SCL/* typos have also been submitted upstream (https://github.com/stepcode/stepcode/pull/366). So it's ok to merge them in to master.
2017-10-04 17:59:11 +02:00
wmayer
f300614729 Py3: replace sq_slice and sq_ass_slice with mp_subscript and mp_ass_subscript because they are not used any more in Py3 2017-08-21 13:33:07 +02:00
Abdullah Tahiri
f4fd0d6b71 Generator script modified to first report and then ask for the python representation, so as keep track of the reported status 2017-08-17 22:47:14 +02:00
wmayer
f07234bf28 py3: support of Python 3.4 2017-06-07 15:28:46 +02:00
wmayer
bf162ebde9 py3: partially revert of getattr -> getattro because getattro is only needed for the static callback function
issue 0000995
2017-06-03 10:51:05 +02:00
looooo
6ad7dc1217 py3: change of getattr -> getattro
issue 0000995
2017-06-03 10:51:05 +02:00
wmayer
3c85aaf0df remove const from exception handler to fix build failure 2017-05-13 17:33:13 +02:00
Abdullah Tahiri
f4c0f0acae Renaming getPyDict to getPyObject for consistency with BaseClass 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
3a27e2d8ff Enable exceptions to save/restore information in a python dictionary and enable throwing exception from dictionary information 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
7049881d47 Use PyErr_setObject with a PyDict to set Base::Exception information to BaseFreeCADError Python exception 2017-05-13 15:27:57 +02:00
wmayer
7150e9ab23 replacement for PR 698 2017-04-27 23:05:40 +02:00
Kunda
5aefa825b1 Typo fixes for doxygen and source comments
issue #0002914
2017-03-31 11:25:57 -03:00
wmayer
7630e6bc2b make sure that the passed 'self' pointer to a method of the Python wrapper is never null 2017-01-24 12:34:23 +01:00
wmayer
0031e13953 extend generation framework to set Python class name 2016-12-03 12:50:36 +01:00
wmayer
2478c9847b fix bug in generation script 2016-10-08 18:48:27 +02:00