Skip to content

Conversation

cthulahoops
Copy link
Collaborator

Fix this:

>>>>> type.__mro__
Traceback (most recent call last):
  File <stdin>, line 0, in <module>
TypeError: Expected type <class 'type'>, not <class 'NoneType'>

@cthulahoops
Copy link
Collaborator Author

Took me a while to figure out why I couldn't get the property to type check.

@Skinny121 I think this is a bug in the PropertyBuilder?

@codecov-io
Copy link

Codecov Report

Merging #665 into master will increase coverage by 0.02%.
The diff coverage is 22.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #665      +/-   ##
==========================================
+ Coverage   40.37%   40.39%   +0.02%     
==========================================
  Files          79       79              
  Lines       17331    17339       +8     
  Branches     4476     4477       +1     
==========================================
+ Hits         6997     7004       +7     
- Misses       8507     8509       +2     
+ Partials     1827     1826       -1
Impacted Files Coverage Δ
vm/src/obj/objproperty.rs 57.14% <100%> (ø) ⬆️
vm/src/obj/objtype.rs 41.15% <12.5%> (+1.22%) ⬆️

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 a8c0210...48fba05. Read the comment docs.

@BenLewis-Seequent
Copy link

I wanted to make it typesafe so the type of the value returned from 'get' must equal the type 'set' accepted. But it seems to just gets in the way.

@cthulahoops
Copy link
Collaborator Author

I thought I'd tried that. (I blame the error messages.)

I can get it to work by making the getter return PyTupleRef instead of PyTuple (adds some noise to the getter). I'd like to just have the setter take PyTuple but get blocked by:

the trait `pyobject::TryFromObject` is not implemented for `obj::objtuple::PyTuple`

So, I guess implementing that would work.

I think we want PyObjectRef in this case anyway, as we want a TypeError complaining about trying to set a read-only attribute, not a TypeError about trying to set it to the wrong type.

@windelbouwman windelbouwman merged commit f0e285d into master Mar 13, 2019
@windelbouwman
Copy link
Contributor

Strange change, looks like a hack around some other issue in the property factory. We need to take a look at this.

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.

4 participants