Commit Graph

45 Commits

Author SHA1 Message Date
wmayer
a34911605c Base: add convenience function to convert PyObject_IsTrue to a boolean 2022-07-16 12:41:01 +02:00
wmayer
f5235a8057 cppcoreguidelines-pro-type-union-access
According to https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md using union for type-punning is undefined behaviour.
 Replace it with std::memcpy
2022-06-24 14:29:50 +02:00
wmayer
e4d1ed8366 Base: rename BaseExceptionFreeCADError to PyExc_FC_GeneralError 2022-03-17 14:45:48 +01:00
wmayer
1f12dca2b4 Py: replace BaseExceptionFreeCADError with more suitable exception types 2022-03-17 13:54:23 +01:00
wmayer
a90a39a4c9 Base: add more custom Python exception types 2022-03-17 11:29:09 +01:00
Uwe
6a9310499a [Base] Py and Placement: remove unused includes 2022-03-01 12:13:58 +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
wmayer
16c7ee80f3 Base: [skip ci] allow to access the twin pointer of a PyObjectBase 2021-12-11 08:33:50 +01: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
luz paz
59b7e9fdd0 Base: remove Py2 code 2021-04-26 09:23:58 +02:00
wmayer
0edbea1316 Base: use Python's weak reference mechanism to avoid memory leaks due to cyclic dependencies 2021-04-23 11:02:19 +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
Chris Hennes
53972c62e3 Remove catch block for plain C strings
LGTM complains about this construct leaking memory. Commit 227cf6de88
eliminated the parts of FreeCAD that throw those strings. This commit
eliminates the catch block.
2021-02-07 13:41:42 +01:00
luz paz
01b21e0d06 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
wmayer
1a15d566d5 Part: [skip ci] include OCC hesder to PCHs, fix compiler warning when trying to delete void pointer 2020-09-28 20:23:33 +02:00
wmayer
27b9192539 Base: [skip ci] allow to replace twin object of PyObjectBase 2020-09-28 11:21:20 +02:00
wmayer
adf662b13d remove superfluous includes of iostream, use iosfwd instead 2020-07-28 15:22:23 +02:00
luz.paz
011e5aedfa src/Base: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Base` files
2019-12-25 11:38:58 +01:00
Zheng, Lei
74db105fb5 Base: fix line ending in PyObjectBase.h 2019-08-28 17:46:06 +02:00
Zheng, Lei
e288bb672d Base: fix duplicated exception message
Because the exception can propagate across C++ and Python boundary
multiple times, prepending extra information may cause duplication,
something like,

"FreeCAD exception thrown(FreeCAD exception thrown(..."
2019-08-17 15:32:49 +02:00
Zheng, Lei
8f16147a40 Base: improve exception
For better FC and Python exception mapping.
2019-08-17 14:52:08 +02:00
wmayer
2aee1e8368 fixes 0003771: Memory leak in Part.Face.Surface 2019-01-23 22:38:51 +01: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
5572f55312 clear dict when invalidating Py object to fix possible cyclic references 2018-08-25 21:49:57 +02:00
wmayer
99ec96acd5 prepare for PyCXX 7.0 2018-04-18 19:20:50 +02:00
Unknown
e3eca59173 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01: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
fb7094bf31 use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
7150e9ab23 replacement for PR 698 2017-04-27 23:05:40 +02:00
wmayer
cdbfee565a issue #2902: track attribute objects in parent structure to notify about changes 2017-02-14 16:38:38 +01:00
wmayer
f95587fc7a issue #0002902: replace members of PyObjectBase with a PyDictObject 2017-02-14 13:09:09 +01:00
wmayer
d0e6253041 issue #0002902: PyObjectBase notification chain can lead to unexpected changes to document 2017-02-14 00:32:30 +01:00
wmayer
b0b68b7c7b fix -Wunused-variable 2017-01-27 16:10:19 +01:00
looooo
a88afb33af py3: add PyMOD_INIT_FUNC
from: py3: ported module init to python3, wwmayer
2017-01-25 10:16:06 +01:00
wmayer
0dbc5d8041 remove deprecated macros 2016-11-09 16:58:54 +01:00
wmayer
af4ef2fa7f Coverity issues:
129202: replace dynamic_cast with static_cast
129421, 129422: fix Py_Return macro
128928: Unchecked return value
129488, 129490: uninitialized scalar variable
129567, 129661: uninitialized scalar field
129665: uninitialized pointer field
2016-08-15 21:28:41 +02:00
wmayer
6b67d4a4e7 + replace old C casts with static_cast in generated C++ code, remove unused parent structure of Python classes, support of -1 as return value of setCustomAttributes 2015-09-27 22:08:08 +02:00
Mateusz Skowroński
05f95c0506 Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
Sebastian Hoogen
d49528b27e issue #1700 replace PyExc_Exception 2014-09-17 11:15:57 +02:00
Sebastian Hoogen
af50cbf964 fixes #0001422: Subclass Exception
inherit Base.FreeCADError form RuntimeError
inherit Part.OCCError from Base.FreeCADError
inherit OCCDomainError from Part.OCCError
inherit OCCRangeError from Part.OCCError
inherit OCCConstructionError from OCCDomainError
inherit OCCDimensionError from OCCDomainError
Added PY_CATCH_OCC macro
replace PyExc_Exception
use FreeCADError in makeWireString
catch exception in BSplineCurve.increasedegree
2014-09-17 11:15:56 +02:00
wmayer
f53c22417e + remove unneeded semicolons 2014-05-08 17:32:23 +02:00
wmayer
966b12813a + fix typos or documentation 2014-03-29 11:46:07 +01:00
wmayer
15f38e1a62 Fixes for MacOSX 2012-10-26 12:59:43 +02:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00