Benedikt Reinartz
ac75e0ccc3
Merge pull request #1621 from pythonnet/fix-enum-codec
...
Fix enum codec
2022-05-04 09:38:14 +02:00
Benedikt Reinartz
7d6e27a23e
Allow conversion of UInt64 based enums
2022-05-04 08:40:50 +02:00
Benedikt Reinartz
4f070f24c3
Add unit test for enum encoder
2022-05-04 08:40:26 +02:00
Benedikt Reinartz
df3b569eb1
Fix enum codec
...
A boxed enum value can't be casted directly to an integer, but using `System.Convert`
functions instead works fine.
2022-05-04 08:15:21 +02:00
Benedikt Reinartz
37f12359e0
Merge pull request #1760 from filmor/misc-fixes
...
Miscellaneous fixes and cleanups
2022-05-04 08:07:53 +02:00
Benedikt Reinartz
aa5b54bf7f
Modernise syntax in ClassDerived
2022-05-04 08:07:10 +02:00
Benedikt Reinartz
d8990839a8
Fix Py.SetArgv for systems that don't support GetCommandLineArgs
2022-05-04 08:07:10 +02:00
Benedikt Reinartz
d2d3ba669f
Modernise syntax a bit
2022-05-04 08:07:09 +02:00
Benedikt Reinartz
5eccd45a7e
Use Py.GIL directly, now that it doesn't try to init anymore
2022-05-04 07:39:50 +02:00
Victor
bbfa25263f
workaround for potentially buggy threading in Mono ( #1779 )
...
https://github.com/mono/mono/issues/21466
2022-05-04 07:33:38 +02:00
Benedikt Reinartz
7247da55c1
Fix decimal default parameters ( #1773 )
...
* Drop outdated work around to fix decimal default parameters
* Add test for Decimal default parameter
* Update changelog
2022-04-26 09:11:58 -07:00
Benedikt Reinartz
090ff9f460
Ensure that codec tests are run ( #1763 )
...
* Move test_codec.py to the right directory
* Call PyObjectConversions.Reset from Python via a proxy to keep it internal
* Sign Python.Test DLL and make Python.Runtime internals visible for it
2022-04-25 10:51:52 +02:00
Benedikt Reinartz
80dc9f0ba0
Implement IConvertible interface on PyObject
2022-04-11 13:11:28 -07:00
Benedikt Reinartz
ab6d2c5017
Merge pull request #1765 from losttech/bugs/32bit-1729
...
Fix layout of `NativeTypeSpec` on 32 bit platforms
2022-04-11 20:53:08 +02:00
Victor Nova
85037267f8
enable x86 testing on Windows in CI
2022-04-11 09:02:47 -07:00
Victor Nova
5af19614d8
fixed NativeTypeSpec on 32 bit platforms
2022-04-10 15:32:08 -07:00
Victor
86c6a7f40c
clear weak reference list when an extension type is destroyed ( #1761 )
...
According to official documentation for defining extension types, if they are to support weak references, they must clear weak reference list associated with the instance in tp_clear.
Extension types were missed in https://github.com/pythonnet/pythonnet/pull/1758 ( 50da522c3b
)
2022-04-10 09:24:38 +02:00
Victor
50da522c3b
clear weakref list when reflected object is destroyed ( #1758 )
...
this was missed when https://github.com/pythonnet/pythonnet/pull/1267 was superseded
2022-04-09 16:10:34 +02:00
Benedikt Reinartz
1cf616d70a
Merge pull request #1712 from losttech/bugs/ShutdownSegFault
...
On shutdown from Python release all slot holders
2022-04-08 18:50:16 +02:00
Victor Nova
58bd58c01c
Ensure that shutdown is called from Python
2022-04-08 08:42:03 -07:00
Victor
0e57cdd4c5
support for BigInteger <-> PyInt ( #1710 )
...
fixes https://github.com/pythonnet/pythonnet/issues/1642#issuecomment-1058412759
2022-04-08 12:21:22 +02:00
Victor Nova
e9cbb87073
do not attempt to manually delete derived class instances after TypeManager is terminated and Python is shutting down
2022-04-07 15:55:58 -07:00
Victor Nova
5e041afadb
on runtime shutdown from Python release all slot holders, not only the ones, that belong to managed types
2022-03-04 11:00:33 -08:00
Victor Nova
eec30c062f
make methods of PyObject inherited from its base C# classes GIL-safe
...
fixes https://github.com/pythonnet/pythonnet/issues/1642
2022-03-03 21:58:12 -08:00
Andrii Oriekhov
303378a657
add GitHub URL for PyPi ( #1708 )
2022-03-03 14:42:39 +01:00
Victor Nova
76378845d6
removed dead code
2022-02-28 15:39:40 -08:00
Victor Nova
ad0d4e7940
allow dynamic PyObject conversion to IEnumerable when the object is a Python iterable
...
this enables foreach loops over dynamic PyObject instances
closes https://github.com/pythonnet/pythonnet/issues/1680
2022-02-17 11:29:52 -08:00
nobbi1991
dd3302a90e
Update CHANGELOG.md ( #1690 )
...
added missing backticks
2022-01-31 12:32:35 +01:00
Benedikt Reinartz
dd5a8de82f
We can drop the import hack as we are now using the newer import mechanics
2022-01-28 09:35:11 -08:00
Félix Bourbonnais
ca1a72b1bd
Add tests for exception leaking.
...
Originally from PR #1402 . The underlying bug is now fixed, but the tests
are atill applicable.
2022-01-24 18:25:01 -08:00
Ehsan Iran-Nejad
b7fb03a62b
added todo note to ensure CLA is signed
2022-01-14 18:11:23 -08:00
Ehsan Iran-Nejad
f69753c701
allow Python not passing fake arguments for out parameters ( #1672 )
2022-01-13 18:55:42 -08:00
Benedikt Reinartz
75f4398174
Only run CI on pushes to master and on all pull requests ( #1670 )
...
Fixes #1668
2022-01-09 22:14:03 +01:00
Victor
f81b1c6b4b
Add ARM64 CI action ( #1669 )
2022-01-09 21:05:12 +01:00
Benedikt Reinartz
67dded2401
Merge pull request #1665 from filmor/move-everything-around
...
Move code to subdirectories and rename or split up
2022-01-09 21:03:38 +01:00
Benedikt Reinartz
c2945828a5
Remove obsolete documented remark on Exception types
2022-01-09 21:01:52 +01:00
Benedikt Reinartz
5cb40290be
Move code to subdirectories and rename or split up
2022-01-09 21:01:52 +01:00
Benedikt Reinartz
7e2ec4d9cf
Performance tests with baseline from Pypi ( #1667 )
...
* reenable perf tests for 3.0
* Get baseline dll from pypi
fixes https://github.com/pythonnet/pythonnet/issues/1368
Co-authored-by: Victor Nova <lost@losttech.software>
2022-01-08 16:07:55 -08:00
Victor Nova
7450c5cb9a
added support for byref parameters when overriding .NET methods from Python
...
new code is emitted to
1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly
2. marshal those new values from the args array back into arguments in IL
fixes https://github.com/pythonnet/pythonnet/issues/1481
2022-01-07 10:09:08 -08:00
Victor Nova
88850f5dc9
cleanup PyBuffer a bit:
...
- better finalizer, that actually calls PyBuffer_Release
- improved input parameter handling for common routines
- added support for copying data to/from large Python buffers
fixes https://github.com/pythonnet/pythonnet/issues/1556
2022-01-06 10:32:37 -08:00
Victor
efad01cf2e
provide `__int__` instance method on .NET enum types to support int(Enum.Member) ( #1661 )
...
implements https://github.com/pythonnet/pythonnet/issues/1585
2022-01-06 10:24:15 +01:00
Victor
7e5cc29a62
use the same facility to access Py_NoSiteFlag as the one used to load Python C API functions ( #1659 )
...
fixes https://github.com/pythonnet/pythonnet/issues/1517
2022-01-06 09:56:04 +01:00
Victor Nova
fabb22ca07
improved support for generic method overloading
...
Prior to this change if method had multiple generic overloads, only 1 of them could be matched (whichever one reflection would return first)
Now MethodBinder.MatchParameters returns all matching generic overloads, not just the first one.
fixes https://github.com/pythonnet/pythonnet/issues/1522
2022-01-05 10:57:36 -08:00
Victor Nova
c4238d9a69
reworked the way .NET objects are constructed from Python
...
was: tp_new implementation would call .NET constructor and return a fully constructed object
now:
Except for some special .NET types tp_new creates uninitialized .NET object, which is later initialized by calling __init__.
__init__ is set using type dictionary to a MethodObject, that contains ConstructorInfo[] instead of MethodInfo[]
This allows Python to:
1) freely override __init__
2) when deriving from .NET types call base __init__ (e.g. .NET constructor), and choose the overload as needed
fixes https://github.com/pythonnet/pythonnet/issues/238
2022-01-04 12:23:44 -08:00
Victor Nova
fc31de1731
base accessors were not exposed to Python because .NET PropertyInfo GetMethod would not return base non-overriden accessor for a partially overriden property
...
because of that when constructing PropertyObject we scan base classes to find base accessor (if any)
this might have performance implications due to replacement of PropertyInfo.GetValue with getter.Invoke (not tested)
fixes https://github.com/pythonnet/pythonnet/issues/1455
2022-01-04 08:42:42 -08:00
Victor
8d6a91891d
added a regression test for https://github.com/pythonnet/pythonnet/issues/1420 ( #1652 )
...
closes https://github.com/pythonnet/pythonnet/issues/1420
2021-12-30 10:20:31 +01:00
Victor
cc72be4243
moved Py class into its own file ( #1649 )
2021-12-29 10:18:13 +01:00
Victor Nova
8d61215d03
when process is exiting, there's no need to save live .NET objects as they won't be resurrected
2021-12-27 10:33:36 -08:00
Victor Nova
ec8b69fd35
attempt to fix crash on shutdown of Python executable
2021-12-25 10:22:01 -08:00
Victor Nova
2596cdf61c
fixed Python derived types crashing on shutdown of Python process
...
clearing GCHandle from an instance of Python derived type would drop the last reference to it, so it was destroyed without being removed from reflectedObjects collection
2021-12-25 10:22:01 -08:00