Coder Social home page Coder Social logo

Comments (5)

JelleZijlstra avatar JelleZijlstra commented on July 28, 2024 1

This looks like a bug in pypy: it doesn't properly support __mro_entries__.

% python3.8
Python 3.8.16 (default, Dec 26 2022, 20:36:56) 
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(): pass
... 
>>> f.__mro_entries__ = lambda _: (int,)
>>> class x(f): pass
... 
>>> x.__bases__
(<class 'int'>,)
>>> 
% ~/.pyenv/versions/pypy3.8-7.3.11/bin/python
Python 3.8.16 (a9dbdca6fc3286b0addd2240f11d97d8e8de187a, Dec 29 2022, 11:45:30)
[PyPy 7.3.11 with GCC Apple LLVM 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> def f(): pass
>>>> f.__mro_entries__ = lambda _: (int,)
>>>> class x(f): pass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: metaclass found to be 'function', but calling <class 'function'> with args ('x', (<function f at 0x0000000148314ca0>,), ...) raised "'internal-code' object expected, got 'str' instead"

Meanwhile, on pypy3.9-7.3.11 this works fine. I reported https://foss.heptapod.net/pypy/pypy/-/issues/3958.

As a workaround, we could go back to the previous implementation of TypedDict on pypy3.7/8 and cut a bugfix release.

from typing_extensions.

AlexWaygood avatar AlexWaygood commented on July 28, 2024

Ah, looks like even PyPy-3.8 is broken: https://github.com/python/typing_extensions/actions/runs/5421296757/jobs/9856554127

from typing_extensions.

A5rocks avatar A5rocks commented on July 28, 2024

Hi, I've encountered this too! Only on pypy 3.7 here cause turns out pylint subclasses typing_extensions.TypedDict when python version <3.8! https://github.com/python-trio/trio/actions/runs/5405876855/jobs/9822036832#step:5:1587 (I'm going to pin typing_extensions to below the current version just until we get out our final release that supports 3.7, so this isn't a major problem for us.)

from typing_extensions.

AlexWaygood avatar AlexWaygood commented on July 28, 2024

As a workaround, we could go back to the previous implementation of TypedDict on pypy3.7/8 and cut a bugfix release.

If it was just broken on PyPy-3.7, I wouldn't worry about it, but since this also breaks PyPy-3.8, I think this might be a good idea as a stopgap solution, even though I definitely feel like the bug is on PyPy's side ://

from typing_extensions.

AlexWaygood avatar AlexWaygood commented on July 28, 2024

#262 is a compatibility shim that isn't too invasive for us, and fixes tests on PyPy <3.9

from typing_extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.