Giter VIP home page Giter VIP logo

pycnite's Introduction

CI PyPI - Wheel

pycnite

A collection of utilities for working with compiled Python bytecode.

This library adds pure Python, versioned parsers for the .pyc format, allowing tools that work with bytecode to have different host and target Python versions.

Currently supported target versions: 3.8, 3.9, 3.10, 3.11 and 3.12

pycnite's People

Contributors

martindemello avatar h-joo avatar frigus02 avatar rchen152 avatar

Stargazers

Allen Guo avatar wrmsr avatar Elliot Tarbet avatar wolfi3 avatar Jason Lam avatar Gregory P. Smith avatar Yilei Yang avatar

Watchers

 avatar James Cloos avatar Teddy Sudol avatar  avatar  avatar  avatar

Forkers

sunilgitb

pycnite's Issues

Incorrect line numbers for opcodes in 3.11

This was discovered through a pytype bug. For the following code:

s = []
s.clear()
s.clear()
x: int = "some str"

We expect pytype to raise an annotation-type-mismatch error on the last line. However, the two method calls (s.clear()) cause pycnite to generate the wrong line numbers for the opcodes of this snippet. This makes pytype think that the STORE_NAME x opcode is on line 3, entirely missing the : int type hint and allowing the annotation to go through.

(I have not investigated if other operations besides 2 method calls in a row trigger this behavior.)

I found that LineTableReader311 generates 30 line table entries, while dis generates only 28 opcodes.

Incorrect line number for STORE_FAST opcode in 3.11

In the following code:

import collections
from typing import Any, Mapping
def f(x: str | None):
  y = x
  z = collections.defaultdict(
      lambda: ([], []))  # type: Mapping[int, Any]
  for k, v in z.items():
    key = (y, k)
    v1, v2 = v
    yield (k, v1, v2)

The STORE_FAST y op should be at line 4, but pycnite puts it at line 5.

pycnite isn't compatible with Python 3.8-3.9.

A pytype PR to use pycnite (google/pytype#1499) fails pytype's tests in Python 3.8 due to the use of the dataclass kw_only option, which is new in 3.10.

I'm thinking I'll fix that, then add a GitHub Actions workflow to run pycnite's tests in 3.8-3.11 and fix any additional 3.8/3.9 incompatibilities that flushes out.

Latest pycnite (2024.5.27) does not have sdist on PyPI

We (FreeBSD ports) mainly use sdist to build python modules.
Previous version (2023.10.11) of pycnite provided sdist (pycnite-2023.10.11.tar.gz) on PyPI.
Please also publish sdist of pycnite 2024.5.27 to PyPI.
Thanks.

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.