Skip to content

worked on fixing cast mechanisms for handling cast-issues on MSVC - #1012

Merged
zerothi merged 1 commit into
mainfrom
cython-cast-issues
Aug 21, 2026
Merged

zerothi merged 1 commit into
mainfrom
cython-cast-issues

Conversation

@zerothi

@zerothi zerothi commented Aug 21, 2026 •

Copy link
Copy Markdown
Owner

The problem is that MSVC does not have proper complex support.

Now we use an inline wrapper call that does the correct thing by compile time optimizations

Since cython removes branches we can use checks at the different branches of data-types, hence removing all boiler plate code before the heavy lifting.
This results in a little more verbose code, but will compile on windows (hopefully) and also with no performance penalty.

Also, one should never do += because Cython can't translate it to proper arithmetic on Windows (no support of the complex dtype).

The inlined code does not use const because Cython thinks that const T is no the same as T, meaning it reconstructs the type at pass.
I'll try and do this on the other parts of the code as well.

  • Closes windows builds #1010
  • Added tests for new/changed functions?
  • Documentation for functionality in docs/
  • Changes documented in changes/<num>.<type>.rst

The problem is that MSVC does not have proper complex support.

Now we use an inline wrapper call that does the correct thing
by compile time optimizations

Since cython removes branches we can use checks at the different
branches of data-types, hence removing all boiler plate code
before the heavy lifting.
This results in a little more verbose code, but will compile
on windows (hopefully) and also with no performance penalty.

Also, one should never do += because Cython can't translate
it to proper arithmetic on Windows (no support of the complex
dtype).

The inlined code does not use *const* because Cython
thinks that const T is no the same as T, meaning it
reconstructs the type at pass.
I'll try and do this on the other parts of the code as well.
@codecov

codecov Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.64%. Comparing base (e9d20ad) to head (e8d840e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1012   +/-   ##
=======================================
  Coverage   86.64%   86.64%           
=======================================
  Files         414      414           
  Lines       54754    54754           
=======================================
  Hits        47442    47442           
  Misses       7312     7312           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zerothi
zerothi merged commit ee07e9d into main Aug 21, 2026
12 of 13 checks passed
@zerothi
zerothi deleted the cython-cast-issues branch August 21, 2026 13:22
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.

windows builds

1 participant