Skip to content

chore: some Cython 3.1.0rc1 build failures #1574

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
May 3, 2025

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented May 3, 2025

Fix the few build failures I've hit with Cython 3.1.0rc1. Unfortunately, I'm stuck at:

Error compiling Cython file:
------------------------------------------------------------
...
        version: IPVersion = IPVersion.All,
    ) -> list[DNSAddress]:
        """Return matching DNSAddress from ServiceInfo."""
        return self._dns_addresses(override_ttl, version)

    def _dns_addresses(
    ^
------------------------------------------------------------

src/zeroconf/_services/info.py:586:4: Signature not compatible with previous declaration

Error compiling Cython file:
------------------------------------------------------------
...
    cpdef addresses_by_version(self, object version)

    cpdef ip_addresses_by_version(self, object version)

    @cython.locals(cacheable=cython.bint)
    cdef cython.list _dns_addresses(self, object override_ttls, object version)
                                   ^
------------------------------------------------------------

src/zeroconf/_services/info.pxd:124:35: Previous declaration is here

and the like. I suspect it doesn't like override_ttls but can't figure out how to make it work.

Copy link

codecov bot commented May 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.76%. Comparing base (f5c15e9) to head (b9e8a38).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1574   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          33       33           
  Lines        3400     3400           
  Branches      461      461           
=======================================
  Hits         3392     3392           
  Misses          5        5           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

codspeed-hq bot commented May 3, 2025

CodSpeed Performance Report

Merging #1574 will not alter performance

Comparing mgorny:cython-3.1 (b9e8a38) with master (f5c15e9)

Summary

✅ 6 untouched benchmarks

@mgorny
Copy link
Contributor Author

mgorny commented May 3, 2025

Removed the other change, as apparently there is no way to satisfy both ruff and cython, and limited this to that one clear fix.

Fix `AsyncListener._respond_query()` to use `DNSIncoming` type
for the `msg` argument, matching `handle_query_or_defer()`.  This fixes
the following error with Cython 3.1.0rc1:

```
Error compiling Cython file:
------------------------------------------------------------
...
    def _cancel_any_timers_for_addr(self, addr: _str) -> None:
        """Cancel any future truncated packet timers for the address."""
        if addr in self._timers:
            self._timers.pop(addr).cancel()

    def _respond_query(
    ^
------------------------------------------------------------

src/zeroconf/_listener.py:225:4: Signature not compatible with previous declaration

Error compiling Cython file:
------------------------------------------------------------
...
        object port,
        object transport,
        tuple v6_flow_scope
    )

    cpdef _respond_query(
                        ^
------------------------------------------------------------

src/zeroconf/_listener.pxd:51:24: Previous declaration is here
```
@mgorny
Copy link
Contributor Author

mgorny commented May 3, 2025

Okay, so the other problem is that _dns.pxd declares DNSRecord.ttl as cython.float but it's float | int on the Python end.

@mgorny mgorny mentioned this pull request May 3, 2025
@bdraco bdraco changed the title Fix some Cython 3.1.0rc1 build failures fix: some Cython 3.1.0rc1 build failures May 3, 2025
@bdraco bdraco changed the title fix: some Cython 3.1.0rc1 build failures chore: some Cython 3.1.0rc1 build failures May 3, 2025
@bdraco
Copy link
Member

bdraco commented May 3, 2025

change to chore so it doesn't release. Will try to fix a few more and than do a fix one at the end

@bdraco bdraco merged commit 02eef34 into python-zeroconf:master May 3, 2025
62 of 64 checks passed
@bdraco
Copy link
Member

bdraco commented May 3, 2025

Thanks @mgorny

@mgorny mgorny deleted the cython-3.1 branch May 3, 2025 15:05
@mgorny
Copy link
Contributor Author

mgorny commented May 3, 2025

Thanks!

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.

2 participants