8000 Fixed TupleCodec not clearing Python exception after unsuccessful decoding by lostmsu · Pull Request #1083 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Fixed TupleCodec not clearing Python exception after unsuccessful decoding #1083

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

Merged
merged 1 commit into from
Mar 10, 2020

Conversation

lostmsu
Copy link
Member
@lostmsu lostmsu commented Mar 9, 2020

What does this implement/fix? Explain your changes.

When TupleCodec.TryDecode is trying to decode a tuple from Python to .NET, and the element type in Python does not match one in .NET, Converter.ToManaged on that element will fail and leave PyErr set. That caused it to be picked up later by a random check for PyErr and raised as .NET exception in unexpected places.

This change clears PyErr in TryDecode if decoding of an element fails, thus allowing other codecs/overloads to be probed safely.

@codecov-io
Copy link

Codecov Report

Merging #1083 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1083   +/-   ##
=======================================
  Coverage   86.75%   86.75%           
=======================================
  Files           1        1           
  Lines         302      302           
=======================================
  Hits          262      262           
  Misses         40       40
Flag Coverage Δ
#setup_linux 65.56% <ø> (ø) ⬆️
#setup_windows 71.52% <ø> (ø) ⬆️

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 925c166...b501931. Read the comment docs.

@lostmsu lostmsu added this to the 2.4.1 milestone Mar 9, 2020
@filmor filmor merged commit a320d49 into pythonnet:master Mar 10, 2020
@lostmsu lostmsu deleted the PR/TupleCodec/ClearError branch March 10, 2020 20:16
@lostmsu lostmsu modified the milestones: 2.4.1, 2.5.0 Apr 23, 2020
AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull request Jun 29, 2020
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.

3 participants
0