Commit Graph

386 Commits

Author SHA1 Message Date
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 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 dabab90415 interrogate: Fix compilation error of bindings with Python 3.9+ 2020-09-12 22:50:03 +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 4ef8e5228e interrogate: fix ability to return ReferenceCount-like classes
Classes with virtual ref(), unref() and get_ref_count() methods, like RecorderBase, could not be returned by PT() from methods because they didn't inherit from ReferenceCount.  However, classes do not need to inherit ReferenceCount to be able to be tracked by a PointerTo, and defining an abstract base class with pure virtual ref()/unref()/get_ref_count() is a way to avoid dual inheritance of ReferenceCount.
2020-02-22 12:10:55 +01:00
rdb 3c9591cfbf interrogate: envelop function calls in parentheses
This reduces the risk of calling a preprocessor macro instead of a method.
2019-10-08 19:43:34 +02:00
rdb 72b1814331 interrogate: fix comment in C bindings for default arguments
Fixes #732
2019-09-10 09:37:25 +02:00
rdb b3f3f53e01 interrogate: fix missing std:: prefix for string_holder 2019-09-10 09:37:25 +02:00
Paul m. p. P 35b80d0751 interrogate: add missing async/await keywords
Closes #735
2019-09-10 09:37:24 +02:00
rdb 57ff1a5441 interrogate: remove vestigial code causing assert for C bindings
Fixes #722
2019-09-03 12:15:02 +02:00
rdb df8ccdb7ab Add support for Python 3.8 2019-08-13 17:48:32 +02:00
rdb e080d33e31 interrogate: temp hack to make encrypt_string return bytes
Fixes #684
2019-07-10 09:54:57 +02:00
rdb 204cbe4464 interrogate: support unicode characters in Python 3 for 'char' arg
Fixes #626
2019-05-01 17:05:12 +02:00
rdb 3ca3dfd13a interrogate: fix in-place or (|=) operators (see #588) 2019-04-14 17:10:52 +02:00
rdb a634e729c8 interrogate: fix uninitialized var, fixes sporadic nb_true_divide
This was a regression introduced by fa6c066b2f (which in turn fixed #529)
2019-03-08 11:53:45 +01:00
rdb 8e4add0326 interrogate: fix refcount trouble assigning PyObject* properties
In particular, this fixes accessing PythonTask.__dict__
2019-03-04 16:46:28 +01:00
rdb fa6c066b2f interrogate: enable true division in Python 2 as well
This allows using "from __future__ import division" and get the expected result for divisions in Python 2.

Fixes #529
2019-03-03 10:29:39 +01:00
rdb 376cef51c4 interrogate: fix Python 3 crash with optional std::wstring args
This would cause PyMem_Free to be called on an uninitialized pointer if a default argument was not specified.

Fixes #542
2019-01-26 19:27:50 +01:00
Sam Edwards 0c890f059d interrogate: Export Python entry points with EXPORT_CLASS
Closes #505
2019-01-03 12:39:22 +01:00
Sam Edwards 818fdbd232 interrogate: Tidy up hash_string function
The main motivation behind this change is to get rid of a
signed integer overflow that sometimes happens in the prime
multiplication step, which is (per the C++ spec) undefined
behavior. However, it's probably for the best to use only
unsigned int when the function is clearly trying to avoid
negative values.

Not that I suspect it matters much, but I have also heavily
tested that the behavior of the function is unchanged (at
least on PC hardware - signed integer overflow doesn't
behave portably) although it may now be slightly faster due
to the fact that I have removed the floating-point math.
2018-12-30 04:21:34 -07:00
rdb a9d6d3be46 interrogate: refactor default argument handling 2018-12-26 22:47:14 +01:00
rdb 47188b47f6 interrogate: fix recording type of property in interrogatedb 2018-12-23 15:45:30 +01:00
rdb 256c8c5a23 interrogate: don't add space at end of command-line comment 2018-12-23 15:44:59 +01:00
rdb e32388c2f8 interrogate: fix crash reading static property 2018-11-24 22:44:09 +01:00
rdb 074c5187b0 Adopt new WindowProperties(size=(x, y), ...) short-hand
This is intended as replacement for WindowProperties.size(x, y), which is deprecated since it conflicts with the `size` property.  See #444.
2018-11-12 17:53:53 +01:00
rdb 598664ab80 interrogate: disambiguate case where static method shadows a property
While it becomes possible to do this now, it should not become standard practice, and we should deprecate cases where we already do it by renaming either the static method or the property.

Fixes #444
2018-11-12 16:31:54 +01:00
Sam Edwards a9dfd8352e general: Distinguish local/system includes
This changes includes so that local includes are consistently
#include "localFile.h"
while system and third-party includes are consistently
#include <systemFile.h>

This commit mostly converts the former to the latter; the two
exceptions are in android_main.cxx and fmodAudioSound.h, where
the reverse was necessary.
2018-11-10 18:00:10 -07:00
rdb 5ba09ec5a0 interrogate: fix compile error when building with LINK_ALL_STATIC
Fixes #442
2018-11-09 11:38:41 +01:00
rdb b8ed9b1275 Remove pystub dependency from interrogate and friends 2018-11-06 21:49:17 +01:00
rdb 49b72fb198 Move Python support code from libp3interrogatedb to generated module
This prevents libp3interrogatedb from having a dependency on the Python library.

See #387
2018-11-06 19:24:37 +01:00
rdb e6f870ece6 Remove Python type tables from interrogatedb 2018-11-05 22:14:25 +01:00
rdb ad3b145951 interrogate: generated property getter should copy in some cases
This is to fix eg. public ButtonHandle members from being returned as const reference, which means they won't outlive the struct they are accessed on, a recipe for obscure crashes.

The is_trivial() criterium for this to apply is admittedly really arbitrary; I haven't really figured out what the right criterium should be, but it's better than hardcoding ButtonHandle.
2018-10-29 16:08:29 -06:00
Sam Edwards 8d14705689 interrogate: Fix typo 2018-10-07 01:36:44 -06:00
rdb 8b3cc74cad interrogate: write out OS-generic filenames in #include directives
Fixes #386
2018-09-13 21:14:04 +02:00
rdb cb9e65720a interrogate: do not use MOVE in generated code, but use std::move 2018-09-09 13:48:50 +02:00
Mitchell Stokes f663d215d5 Remove some unused variables 2018-08-19 16:55:07 +02:00
rdb c4b657b5b2 interrogate: support implicit typecast operators in some cases
For example, this will let us pass a ConfigVariableFilename to anything that accepts a Filename, just like in C++.

Does not work if the return value if the typecast operator requires management.
2018-08-19 16:06:16 +02:00
rdb 68e7f681f4 interrogate: support enum class to limited extent in Python 2
Only the basics are supported; the __members__ or iter interface is not supported at this time.

See also #351 for discussion on pulling in enum34 module.
2018-07-02 12:16:35 +02:00
rdb 9441c28f61 interrogate: do not wrap methods with rvalue arguments
This could in theory be supported, but this is not really intuitive from a Python user's point of view.
2018-06-30 21:38:45 +02:00
rdb b2c04a8c7a interrogate: support scoped enum args and return values 2018-06-30 21:38:40 +02:00
rdb c03a75d755 interrogate: use range for in various places for code cleanliness 2018-06-30 17:18:14 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
rdb b88bd99704 Various compiler warning fixes 2018-06-12 12:38:07 +02:00
rdb 4fe7fe4c88 interrogate: fix int8_t / signed char range checking on Android 2018-06-12 11:08:02 +02:00
rdb 1c476203fc interrogate: remove Dtool_AddToDictionary (let me know if anyone uses this)
If any code is relying on this, please let me know and I will add it back.  It appears to be redundant, though, since one can access DtoolClassDict directly.

Symbol kept around temporarily in order to keep ABI compatibility for a short while as people may not update their interrogate and Panda in sync, but it can soon be removed.
2018-06-11 13:43:30 +02:00
rdb 3cc88cd304 interrogate: clean up py_panda.h a bit more
Inching towards reducing code in py_panda and eventually having no Python-specific code in interrogatedb anymore.
2018-06-11 13:39:45 +02:00
rdb acac93a1d1 parse_file: show various additional type traits 2018-06-09 10:29:19 +02:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
rdb c166daf0f3 interrogate: fix detection of special std types 2018-06-06 12:22:23 +02:00
rdb 5582e174b6 cppparser: fix issue with typedefs to forward declared templates
I don't know if this is the right solution, but it does fix an issue accessing std::ios::openmode caused by the ios typedef being defined before ios_base is fully specified.
2018-06-04 17:30:02 +02:00