Commit Graph

61 Commits

Author SHA1 Message Date
Kacper Donat
e65f69715b 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
2c60e83f25 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
5c251e73ac python: apply const method annotations to impls. 2025-04-16 20:32:04 -07:00
tritao
718773bc9c Base: Clean up Python includes in PyObjectBase.h. 2025-04-05 12:14:32 +01:00
tritao
5117c82d33 Base: Clean documentation for PyObjectBase.h. 2025-02-08 13:14:22 +00:00
mosfet80
0bdb8a0e22 Disable python2 support
Disable python2 support
2024-12-01 10:39:48 +01:00
supermixed
bbb6eeb1ed 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
fd5eb34d6a Base: Add PropertyError exception 2024-08-02 20:19:16 -03:00
Chris Hennes
914edb7887 Base: Fix missing NOLINTEND 2023-11-22 11:15:32 +01:00
wmayer
3ac4dc0686 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
c5f5bfd22a fix readability-braces-around-statements 2023-11-16 01:22:08 +01:00
wmayer
985def3416 Base: apply clang format 2023-11-13 12:01:26 -05:00
wmayer
097d5d6fee Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
wmayer
4210ab01e0 Base: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
marioalexis
ce91630ab1 Base: Add helper function to check Python types 2022-09-24 05:10:34 +02:00
wmayer
4e42ff7baa Base: modernize C++: replace 'typedef' with 'using' 2022-08-29 11:42:09 +02:00
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