problem with super() call
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, python
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start with the test_super.py reproduction and run transcrypt -n test_super.py to inspect the generated JavaScript and the __super__ path in __target__/org.transcrypt.__runtime__.js. Trace why super().update() does not resolve the aliased update method, then verify that both super().update_count() and super().update() complete without the superclass-method error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Discovered an issue with super() call when the method is an alias identifier such as update. If a subclass method calls super().update() it is translated to __super__ (SubCls, 'update') (self) rather than using the alias py_update and results in Superclass method not found error. There is no issue with Cls.update(self) call.
test_super.py:
class Cls:
def __init__(self):
self.count = 0
def update_count(self):
self.count += 1
def update(self):
self.count += 1
class SubCls(Cls):
def update_count(self):
super().update_count()
def update(self):
super().update()
cls = SubCls()
print('super().update_count call')
cls.update_count()
print('count:', cls.count)
print('super().update call')
cls.update()
print('count:', cls.count)
transcrypt -n test_super.py
console:
call: super().update_count
count: 1
call: super().update
Error 'Superclass method not found'
stack:
at __target__/org.transcrypt.__runtime__.js:1840:17
at Function.__new__ (__target__/org.transcrypt.__runtime__.js:152:23)
at new cls (__target__/org.transcrypt.__runtime__.js:91:24)
at __super__ (__target__/org.transcrypt.__runtime__.js:186:11)
at __target__/test_super.js:22:3
at Function.<anonymous> (__target__/org.transcrypt.__runtime__.js:57:29)
at __target__/test_super.js:30:5
Environment:
Linux
Python 3.9.6
Transcrypt 3.9.0
Chrome/Firefox
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TranscryptOrg/Transcrypt
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TranscryptOrg/Transcrypt#913 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
TranscryptOrg/Transcrypt#911 · 2 bình luận ·
-
IS: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
TranscryptOrg/Transcrypt#908 ·
-
SUB: documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
TranscryptOrg/Transcrypt#656 · 7 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
TranscryptOrg/Transcrypt#914 ·
Tất cả issue của TranscryptOrg/Transcrypt
Issue tương tự
-
triage/confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
apache/cloudstack#14222 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100