Commit Graph

61 Commits

Author SHA1 Message Date
Kacper Donat
38ec685f2d CAM: Fix origin indicator for Job
This commit fixes how origin (coordinate system) indicator looks. Before
it showed as disc, and now it shows as point which is more approperiate
given the context.
2025-07-05 18:46:01 +02:00
wmayer
0576c129cd Base: Improve Python exception handling
If the Python profiler is activated then transporting the dict as
exception object is broken where InteractiveInterpreter::runCode()
fails to restore it.
To fix the problem use Exception::setPyException() instead inside
the macto PY_CATCH and the generated wrapper code.

This also improves exception handling in command line mode.
2025-06-04 14:14:20 +02:00
Jacob Oursland
5b81cd741a python: apply const method annotations to impls. 2025-04-16 20:32:04 -07:00
tritao
ccbae8b847 Base: Clean up Python includes in PyObjectBase.h. 2025-04-05 12:14:32 +01:00
tritao
19fd9e6c7e Base: Clean documentation for PyObjectBase.h. 2025-02-08 13:14:22 +00:00
mosfet80
be3ad26140 Disable python2 support
Disable python2 support
2024-12-01 10:39:48 +01:00
supermixed
f763425b4f Core: Import STEP: Cancel button does not cancel (#16499)
* Fix importing .step file when user cancelled import settings dialog
* Refactor object loading python code, fix not using settings when STEP options dialog not shown
* Use custom exception type for user cancelling import instead of `RuntimeError`
* Pull python code out to external file
2024-09-20 08:25:23 -05:00
marioalexis
776158addd Base: Add PropertyError exception 2024-08-02 20:19:16 -03:00
Chris Hennes
98b3df9442 Base: Fix missing NOLINTEND 2023-11-22 11:15:32 +01:00
wmayer
08b10cd287 fix cppcoreguidelines-*
* cppcoreguidelines-init-variables
* cppcoreguidelines-c-copy-assignment-signature
* cppcoreguidelines-macro-usage
* cppcoreguidelines-non-private-member-variables-in-classes
* cppcoreguidelines-pro-type-member-init
* cppcoreguidelines-slicing
* cppcoreguidelines-special-member-functions
* cppcoreguidelines-virtual-class-destructor
2023-11-16 01:22:09 +01:00
wmayer
e4975f0153 fix readability-braces-around-statements 2023-11-16 01:22:08 +01:00
wmayer
e85c383bff Base: apply clang format 2023-11-13 12:01:26 -05:00
wmayer
010dca8303 Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
wmayer
4fb07bcfd6 Base: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
marioalexis
2185b8086d Base: Add helper function to check Python types 2022-09-24 05:10:34 +02:00
wmayer
d2168f51b9 Base: modernize C++: replace 'typedef' with 'using' 2022-08-29 11:42:09 +02:00
wmayer
231de30c2f Base: add convenience function to convert PyObject_IsTrue to a boolean 2022-07-16 12:41:01 +02:00
wmayer
c955372ecf 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
9160f06e1c Base: rename BaseExceptionFreeCADError to PyExc_FC_GeneralError 2022-03-17 14:45:48 +01:00
wmayer
d69defaa3c Py: replace BaseExceptionFreeCADError with more suitable exception types 2022-03-17 13:54:23 +01:00
wmayer
10a13c6dbc Base: add more custom Python exception types 2022-03-17 11:29:09 +01:00
Uwe
9a42b61fcb [Base] Py and Placement: remove unused includes 2022-03-01 12:13:58 +01:00
wmayer
31e2e95203 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
2f99b5b56d Base: [skip ci] allow to access the twin pointer of a PyObjectBase 2021-12-11 08:33:50 +01:00
wmayer
af16ab02a0 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
142c2c2c4d Base: remove Py2 code 2021-04-26 09:23:58 +02:00
wmayer
56fb65de62 Base: use Python's weak reference mechanism to avoid memory leaks due to cyclic dependencies 2021-04-23 11:02:19 +02:00
wmayer
111a21e45c 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
7d5a1d7e5d Remove catch block for plain C strings
LGTM complains about this construct leaking memory. Commit 13927b2465
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
d5f6c096b8 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
wmayer
39cd29c0d7 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
afd6f39197 Base: [skip ci] allow to replace twin object of PyObjectBase 2020-09-28 11:21:20 +02:00
wmayer
cd5341001e remove superfluous includes of iostream, use iosfwd instead 2020-07-28 15:22:23 +02:00
luz.paz
6f11ed298a 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
22541cfbdf Base: fix line ending in PyObjectBase.h 2019-08-28 17:46:06 +02:00
Zheng, Lei
9e3a981d37 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
59417068f5 Base: improve exception
For better FC and Python exception mapping.
2019-08-17 14:52:08 +02:00
wmayer
dedaa80762 fixes 0003771: Memory leak in Part.Face.Surface 2019-01-23 22:38:51 +01:00
Michal Ulianko
faf8834484 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
f8f4cd76cc clear dict when invalidating Py object to fix possible cyclic references 2018-08-25 21:49:57 +02:00
wmayer
840c9e8b3c prepare for PyCXX 7.0 2018-04-18 19:20:50 +02:00
Unknown
a8ecffb652 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01:00
wmayer
69d0e8bd7f 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
bc696e5ab5 py3: change of getattr -> getattro
issue 0000995
2017-06-03 10:51:05 +02:00
wmayer
1673ab801e use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
df1e2642d0 replacement for PR 698 2017-04-27 23:05:40 +02:00
wmayer
19111f1ed7 issue #2902: track attribute objects in parent structure to notify about changes 2017-02-14 16:38:38 +01:00
wmayer
4f23b569b3 issue #0002902: replace members of PyObjectBase with a PyDictObject 2017-02-14 13:09:09 +01:00
wmayer
b72aa9f369 issue #0002902: PyObjectBase notification chain can lead to unexpected changes to document 2017-02-14 00:32:30 +01:00
wmayer
36e1d072a6 fix -Wunused-variable 2017-01-27 16:10:19 +01:00