mypyc: Any subclass of BytesIO will always generate an exception when instantiated
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 20.6k
- Forks
- 3.3k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Bug Report
Any subclass of BytesIO will always generate the following exception when instantiated:
BufferError: Existing exports of data: object cannot be re-sized
To Reproduce
1. Run TestSubclassingBytesIO.py and notice it prints two instances (one of BytesIO and the other of SubBytesIO)
2. Using mypyc compile the 4 line file: SubclassingBytesIO.py
3. Then again run the tiny TestSubclassingBytesIO.py
4. The run will crash with the mentioned exception.
Expected Behavior
Running TestSubclassingBytesIO.py after compiling with mypyc should work just like running it before compiling. It should print:
<_io.BytesIO object at 0x0000026903075BC0>
<SubclassingBytesIO.SubBytesIO object at 0x00000269030A0630>
Actual Behavior
<_io.BytesIO object at 0x00000238D1D95BC0>
Traceback (most recent call last):
File "c:\Projects\mypycbug\TestSubclassingBytesIO.py", line 7, in
x = SubBytesIO()
^^^^^^^^^^^^
BufferError: Existing exports of data: object cannot be re-sized
Your Environment
- Mypy version used: 1.5.1
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.11.4
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza extrayendo TestSubclassingBytesIO.zip y ejecutando TestSubclassingBytesIO.py antes y después de compilar SubclassingBytesIO.py con mypyc. Compara las rutas de instanciación de BytesIO y SubBytesIO; se considera terminado cuando el script compilado imprime ambas instancias sin generar BufferError.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- compilers
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100