Skip to content
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

fix: remove typing on reset_ttl for cython compat #1213

Merged
merged 1 commit into from Aug 4, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 3, 2023

fixes #1207

Cythonizing src/zeroconf/_dns.py

Error compiling Cython file:
------------------------------------------------------------
...

    def is_recent(self, now: _float) -> bool:
        """Returns true if the record more than one quarter of its TTL remaining."""
        return self.created + (_RECENT_TIME_MS * self.ttl) > now

    def reset_ttl(self, other: 'DNSRecord') -> None:
                       ^
------------------------------------------------------------

src/zeroconf/_dns.py:210:24: Compiler crash in AnalyseDeclarationsTransform

File 'ModuleNode.py', line 124, in analyse_declarations: ModuleNode(_dns.py:1:0,
    doc = ' Multicast DNS Service Discovery for Python, v0.14-wmcbrine\n    Copyright 2003 Paul Scott-Murphy, 2014 William McBrine\n\n    This module provides a framework for the use of DNS Service Discovery\n    using IP multicast.\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Lesser General Public\n    License as published by the Free Software Foundation; either\n    version 2.1 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n    Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public\n    License along with this library; if not, write to the Free Software\n    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301\n    USA\n',
    full_module_name = 'zeroconf._dns')
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(_dns.py:23:0)
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(_dns.py:156:0)
File 'Nodes.py', line 4817, in analyse_declarations: CClassDefNode(_dns.py:156:0,
    class_name = 'DNSRecord',
    doc = 'A DNS record - like a DNS entry, but has a TTL',
    visibility = 'private')
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(_dns.py:158:4)
File 'Nodes.py', line 2359, in analyse_declarations: CFuncDefNode(_dns.py:210:4,
    doc = "Sets this record's TTL and created time to that of\n        another record.",
    is_c_class_method = 1,
    modifiers = [...]/0,
    overridable = 1,
    visibility = 'private')
File 'Nodes.py', line 681, in analyse: CFuncDeclaratorNode(_dns.py:210:4,
    calling_convention = '')
File 'Nodes.py', line 909, in analyse: CArgDeclNode(_dns.py:210:24,
    is_generic = 1,
    outer_attrs = [...]/2)

Compiler crash traceback from this point on:
  File "/usr/lib64/python3.8/site-packages/Cython/Compiler/Nodes.py", line 909, in analyse
    if self.annotation and env and env.directives['annotation_typing'] and self.base_type.name is None:
AttributeError: 'CAnalysedBaseTypeNode' object has no attribute 'name'

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (53a694f) 99.78% compared to head (cd757cb) 99.78%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1213   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          22       22           
  Lines        2750     2750           
  Branches      478      478           
=======================================
  Hits         2744     2744           
  Misses          3        3           
  Partials        3        3           
Files Changed Coverage Δ
src/zeroconf/__init__.py 100.00% <100.00%> (ø)
src/zeroconf/_dns.py 100.00% <100.00%> (ø)

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

@bdraco bdraco mentioned this pull request Aug 3, 2023
@bdraco
Copy link
Member Author

bdraco commented Aug 4, 2023

pushing to production to get a test on this but its a compile time issue so its only a sanity check here

@bdraco
Copy link
Member Author

bdraco commented Aug 4, 2023

downstream tests are passing as well.

If #1212 is done before I hear back if this fixes #1207 I'll merge at the same time to try to avoid two releases

@bdraco bdraco merged commit 0094e26 into master Aug 4, 2023
34 checks passed
@bdraco bdraco deleted the drop_typing_reset_ttl branch August 4, 2023 00:36
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.

0.72.0: build fails
1 participant