Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Catch Up Upstream #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 197 commits into from
Closed

Catch Up Upstream #45

wants to merge 197 commits into from

Conversation

AlexCatarino
Copy link
Member

@AlexCatarino AlexCatarino commented Jun 29, 2020

Rebase with pythonnet master.

Most important changes:

  • Improved performance of calls from Python to C#
  • Added support for converting python iterators to C# arrays
  • When calling C# from Python, enable passing argument of any type to a parameter of C# type object by wrapping it into PyObject instance
  • Added support for kwarg parameters when calling .NET methods from Python
  • Reworked Finalizer. Now objects drop into its queue upon finalization, which is periodically drained when new objects are created.
  • PyExport attribute to hide .NET types from Python
  • PythonException.Format method to format exceptions the same as traceback.format_exception
  • PyObject.IsNone() to check if a Python object is None in .NET.
  • Codecs as the designated way to handle automatic conversions between .NET and Python types **
  • Fix incorrect dereference in params array handling
  • Fix incorrect dereference of wrapper object in tp_repr, which may result in a program crash
  • Drop support for Python 2

filmor and others added 26 commits June 30, 2020 00:25
- Use `BorrowedReference` where applicable
- Readd `OperatingSystemName` and `MachineName` for now
…thonnet#930)

This addresses the following scenario:

1. A C# object `a` is created and filled with some data.
2. `a` is passed via Python.NET to Python. To do that Python.NET
   creates a wrapper object `w`, and stores reference to `a` in one of
   its fields.
3. Python code later passes `w` back to C#, e.g. calls `SomeCSharpMethod(w)`.
4. Python.NET has to unwrap `w`, so it reads the reference to `a` from it.

Prior to this change in 4. Python.NET had to determine what kind of an
object `a` is. If it is an exception, a different offset needed to be
used. That check was very expensive (up to 4 calls into Python
interpreter).

This change replaces that check with computing offset unconditionally
by subtracting a constant from the object size (which is read from the wrapper),
thus avoiding calls to Python interpreter.

Co-authored-by: Victor Milovanov <[email protected]>
Add a check to see if the last parameter is a params parameter. Set the correct flag to show that it is a paramsArray function.

Fixes pythonnet#943 and pythonnet#331.
- Add .NET Foundation
- Remove Python 3.8.0 warning
@codecov-commenter
Copy link

codecov-commenter commented Jun 29, 2020

Codecov Report

Merging #45 into master will decrease coverage by 4.47%.
The diff coverage is 47.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
- Coverage   69.42%   64.94%   -4.48%     
==========================================
  Files           1        1              
  Lines         278      291      +13     
==========================================
- Hits          193      189       -4     
- Misses         85      102      +17     
Flag Coverage Δ
#setup_linux 64.94% <47.36%> (-4.48%) ⬇️
Impacted Files Coverage Δ
setup.py 64.94% <47.36%> (-4.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d81858...2068399. Read the comment docs.

@jaredbroad
Copy link
Member

Can you please post a summary of the upgrades/fixes?

@Martin-Molinero
Copy link
Member

Closing in favor of #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.