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

Cython should warn if you have a property redefining a cdef attribute #2981

Open
ionelmc opened this issue Jun 2, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@ionelmc
Copy link

commented Jun 2, 2019

So it turns out if you have something like this in a pxd:

cdef class Foobar:
  cdef:
    object stuff

and then later on you implement this in a pyx:

cdef class Foobar:
  @property
  def stuff(self):
    ...
  @stuff.setter
  def stuff(self, value):
    ...

the setter won't be called.

I know this code is silly but it would be nice if cython would give some error or warning about the bad definition.

fwiw I tested this on 0.29.9.

@scoder

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

Doesn't it warn if you increase the warning level?
(That said, warnings about redefinitions are … suboptimal currently, because they also warn about perfectly fine cpdef declarations. PR welcome for that.)

@ionelmc

This comment has been minimized.

Copy link
Author

commented Jun 7, 2019

Ooof .... I'm using the setup.py api to cythonize. I guess I have to do some changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.