Open mgorny opened 1 month ago
That's not a regression, it's just a newly added test which doesn't pass on PyPy. See https://github.com/annotated-types/annotated-types/compare/v0.6.0...v0.7.0
IMO the specific repr here isn't actually that important, and we can fix the test by picking some other predicate function from the standard library which does have a module attribute under PyPy.
I think this is an issue with the built-in function repr on PyPy. math.isfinite
does have math
as its __module__
, but that does not show up in the repr.
I think this is an issue with the built-in function repr on PyPy.
math.isfinite
does havemath
as its__module__
, but that does not show up in the repr.
It doesn't really show up in repr()
in CPython either:
>>> repr(math.isfinite)
'<built-in function isfinite>'
Sorry, I guess the problem is with built-in functions __self__
in PyPy.
yeah, builtin-functions have a __self__
that is always None
in PyPy. maybe we should use the module there, where we know it?
here's that the docs say about builtin functions:
__self__
is set toNone
(but see the next item).__module__
is the name of the module the function was defined in or None if unavailable. See function.module.
I don't really know how to interpret this, tbh. It sounds like __self__
being None
is fine, but what does "see the next item" mean?
I think "the next item" refers to the next section on builtin methods, where __self__
is different.
@JelleZijlstra ok, I suppose that makes sense. but then the description is in direct contradiction to the actual behaviour, where math.isinf.__self__ is math
is True.
The 0.7.0 release introduces a test regression on PyPy3.10:
I guess PyPy implements it as a builtin without a loadable module.
CC @mattip, @cfbolz