Commit Graph

283 Commits

Author SHA1 Message Date
rdb 73360393df Switch use of Py_INCREF to new Py_NewRef function
This is more idiomatic, simplifies the code, makes it easier to port to eg. HPy later on, and makes it easier to use the limited ABI (where it can be optimized to a tail call) later on

A polyfill is provided for compatibility with Python versions 3.8 and 3.9
2024-01-29 17:57:53 +01:00
rdb c6c75092e1 interrogate: Reduce generated code, refactor bad args error code 2024-01-05 17:15:02 +01:00
rdb e04daec2fe Merge branch 'release/1.10.x' 2024-01-05 16:08:53 +01:00
rdb 7926a3a929 interrogate: Fix some pointless code generation case
Some cases of eg. inplace ternary operator would needlessly construct and then immediately destruct a tuple
2024-01-05 14:52:52 +01:00
rdb 37c9e58ea0 interrogate: Fix handling of RF_self / inplace binary operator 2024-01-05 14:32:26 +01:00
rdb 46e662bd8e interrogate: Add cleverness to avoid writing out dead code
Hopefully fixes GCC 13 compile regression, see #1580
2024-01-05 13:56:02 +01:00
rdb 115a716a7d Implement support for custom TypedWritable subclasses in Python
Fixes #1495
2023-07-26 19:55:40 +02:00
rdb cdc95acf81 Merge branch 'release/1.10.x' 2023-05-08 20:08:48 +02:00
rdb 5d833c988a interrogate: Support explicit `cls` parameter for static methods 2023-05-05 10:55:06 +02:00
rdb 4bb6d8f6d8 interrogate: Additional string table size reductions for NDEBUG 2023-03-09 11:24:31 +01:00
rdb 05436a749f Merge branch 'release/1.10.x' 2023-03-09 11:23:19 +01:00
rdb 68927cad0b interrogate: Code size reduction for generated wrappers
No need to have a separate entry in the string table for every possible class for this uncommon error message
2023-03-09 11:00:36 +01:00
rdb 5e26aae1ff cleanup: Fix assorted issues uncovered by clang-tidy 2023-02-12 18:17:03 +01:00
Disyer af4a1bc7a9 python: Use public PyErr_Occurred API instead of private macro
The _PyErr_OCCURRED macro was removed in Python 3.10, so we shouldn't keep any compat code left around for it
2023-02-12 02:36:57 +02:00
rdb fdcfaf69b0 interrogate: Optimizate creating Python wrapper instances
Fewer function pointer calls by moving the wrapper creation logic to the downcast function

This also paves the way for some classes to have custom wrapper creation logic
2022-12-15 20:25:48 +01:00
rdb 68111b2c42 Merge branch 'release/1.10.x' 2022-11-07 18:05:03 +01:00
rdb 11746457ff interrogate: Fix invalid syntax for `make()` coerce ctor with kwargs
[skip ci]
2022-11-07 18:03:41 +01:00
rdb 7f707de384 interrogate: rename `operator [] =` to `operator []=` 2022-10-24 13:24:30 +02:00
rdb a0be50c769 general: Fix assorted compiler warnings 2022-03-01 16:09:07 +01:00
rdb a354b774b3 interrogate: Add __reduce_ex__ to methods that shouldn't be renamed 2021-12-14 11:31:37 +01:00
rdb 98054d1bbd interrogate: Support reverse binary operators as extension methods
Necessary for implementing #1048
2021-07-05 14:12:39 +02:00
rdb 18e8918138 interrogate: Reimplement subscript assignment "operator"
This redoes the handling of `obj[n] = item` to occur in InterrogateBuilder instead so that it doesn't prevent the same remap from being used as getitem.

This fixes the non-const variant of InstanceList[n].
2021-04-25 11:27:18 +02:00
rdb e4ecb548bf interrogate: Use __bool__ for default name of operator bool 2021-03-09 19:33:50 +01:00
rdb 179f316b36 interrogate: Wrap anonymous parameter names as positional-only args 2021-03-01 19:33:43 +01:00
rdb f6b1b6dbb0 interrogate: Support three-way comparison operator <=> 2021-03-01 19:33:35 +01:00
rdb 8cbe36b352 Merge branch 'release/1.10.x' 2021-03-01 19:33:27 +01:00
rdb eab1308438 interrogate: Fix bug sorting overloads of AsyncFuture::set_result() 2021-03-01 10:59:02 +01:00
rdb 5ae08eadf7 Merge branch 'release/1.10.x' 2021-02-22 19:38:49 +01:00
rdb 7ed9f573e7 interrogate: Map operator / to true divide unless it takes an int
This is a little less conservative than the previous behaviour of only mapping if it takes a float, but this behaviour is more intuitive for non-scalar operands such as for Filename's operator /.
2021-02-22 19:14:18 +01:00
rdb 601ca323f5 interrogate: Support __truediv__, __floordiv__, etc. special methods 2021-02-22 18:13:34 +01:00
rdb e099d9e787 Merge branch 'release/1.10.x' 2021-01-02 02:33:35 +01:00
rdb 99f9352e76 interrogate: improvements to __setstate__ handling:
* Force single arg variant, easing argument parsing
* Allow defining __setstate__ taking multiple args, leading to tuple unpack
* Allow __setstate__ to be called on already initialized object (useful with __reduce__)
2021-01-01 15:57:41 +01:00
rdb 3e1d4aa6b5 interrogate: Fix memory leak in __setstate__ 2020-12-31 18:12:52 +01:00
rdb 1793c9a938 interrogate: Fix __setstate__ not working for subclasses 2020-12-31 18:11:50 +01:00
rdb a6e6826939 interrogate: support __getstate__ and __setstate__
The latter in particular will be called instead of __init__, so must construct the object.
2020-11-17 22:35:25 +01:00
rdb c788912070 Merge branch 'release/1.10.x' 2020-10-02 12:20:58 +02:00
rdb 5655e97ec1 interrogate: fix misbehaving == and != operator if only < is defined
Fixes comparison of two empty RenderEffects objects
2020-09-16 23:21:16 +02:00
rdb 66ac3be604 Merge branch 'release/1.10.x' into master 2020-09-12 23:23:58 +02:00
rdb dabab90415 interrogate: Fix compilation error of bindings with Python 3.9+ 2020-09-12 22:50:03 +02:00
rdb 707ea089cb Merge remote-tracking branch 'origin/release/1.10.x' 2020-09-01 11:09:29 +02:00
rdb ab6bf5f4f7 general: Add workaround for Windows bug in various uses of isprint()
See #994; there is a regression in certain versions of the Windows CRT that gives the wrong result for isprint().  This adds workarounds to various potentially affected locations where isprint() is being used.
2020-08-21 14:51:42 +02:00
rdb a203ff11fc interrogate: support __getstate__ and __setstate__
The latter in particular will be called instead of __init__, so must construct the object.
2020-04-01 18:59:44 +02:00
rdb a34867ae4f interrogate: support __int__ -> nb_int slot mapping 2020-04-01 18:59:44 +02:00
rdb d2bd4181e0 interrogate: set tp_base to DTOOL_SUPER_BASE and tp_basicsize to 0
The tp_basicsize field, as well as a few others, seem to be inherited from whatever is set in tp_base.  In absence of a tp_base, Python will set it to PyBaseObject_Type, which is not at all correct for Panda types.
2019-11-06 10:49:53 +01:00
rdb 2c42cfcc1a Merge branch 'release/1.10.x' 2019-09-10 16:34:11 +02:00
Paul m. p. P 35b80d0751 interrogate: add missing async/await keywords
Closes #735
2019-09-10 09:37:24 +02:00
rdb a40228202b Merge branch 'release/1.10.x' 2019-08-18 22:34:23 +02:00
rdb df8ccdb7ab Add support for Python 3.8 2019-08-13 17:48:32 +02:00
rdb fa62344452 express: better fix for encrypt_string Python 3 issues
A workaround for the bug described in #684 was made in e080d33e31 but this fix is significantly cleaner.

Unit test was added.
2019-07-10 13:46:42 +02:00
rdb d5788d9422 Merge branch 'release/1.10.x' 2019-07-10 12:22:56 +02:00