compiler1.py / compiler38.py appear to be dead code that has drifted from compiler.py (including missing bugfixes) — should be removed or clarified

Đang mở
#910 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
compilers

Hướng nghiên cứu

Start by reviewing transcrypt/modules/org/transcrypt/compiler.py alongside compiler1.py and compiler38.py, then verify the references in transcrypt/main.py, setup.py, and MANIFEST.in. Confirm with maintainers whether the two files support an older Python version or another workflow; done means either removing the unused files or documenting their purpose and keeping them intentionally.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

While reviewing transcrypt/modules/org/transcrypt/, I noticed two files that closely mirror the main compiler but don't appear to be referenced anywhere in the codebase: compiler1.py and compiler38.py (each ~164KB, ~4,000 lines).

Investigation

Only compiler.py is imported at runtime:

$ grep -n "^from|^import" transcrypt/main.py | grep -i compil
from org.transcrypt import compiler

And a repo-wide search turns up no references to the other two:

$ grep -rln "compiler1|compiler38" --include=.py --include=.cfg --include=.in --include=.txt .
(no results)

Neither file appears in setup.py or MANIFEST.in as a distinct entry point either.

Evidence they've drifted from the maintained file

Because they're never exercised, compiler1.py and compiler38.py have fallen out of sync with compiler.py. One concrete example — compiler.py (line 96) has a guard the other two lack:

compiler.py

self.optionsChanged = project and utils.commandArgs.projectOptions != project.get('options')

compiler1.py / compiler38.py (identical in both)

self.optionsChanged = utils.commandArgs.projectOptions != project.get('options')

There are also larger structural differences in visit_Assign, around handling ast.Index / ast.ExtSlice (older Python AST shapes) vs. ast.Slice in compiler.py — this suggests compiler1.py/compiler38.py may be legacy per-Python-version forks that predate a later consolidation into compiler.py.

Why this seemed worth flagging

If these files are intentionally kept — e.g. for reference, rollback, or supporting an older Python version — that's completely reasonable. But as they stand, they're visually indistinguishable from live code to a new contributor, and a fix landed in compiler.py (like the guard above) gives no signal about whether the same fix is still needed, or already irrelevant, in the other two.

Questions

  1. Are compiler1.py / compiler38.py still needed for something (e.g. older Python version support), or are they safe to delete?
  2. If they're intentionally kept, would a short comment at the top of each file (or a note in CONTRIBUTING) explaining their purpose be welcome?

Happy to submit a small PR for either outcome — deletion or documentation — once I know which direction is preferred.

Ngôn ngữ chính
Python
Star
2.9k
Fork
218
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TranscryptOrg/Transcrypt

Tất cả issue của TranscryptOrg/Transcrypt

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.