Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Crash on triple quoted string with line continuation

未关闭
#713 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
tooling

调研方向

使用所示的 demo.py 输入重现崩溃,然后检查 pycodestyle.py 中的 continued_indentation,回溯信息指出失败的列表赋值位于此处。当 pycodestyle 不再因这个包含续行的三引号字符串而崩溃,并且该回归问题已由项目测试覆盖(如适用)时,工作即完成。

由索引模型根据 Issue 内容生成。

描述

Given the file:

foo = \
    """bar
"""

pycodestyle 2.3.1 crashes:

$ pycodestyle demo.py
Traceback (most recent call last):
  File "/users/is/whughes/pyenvs/research3/bin/pycodestyle", line 11, in <module>
    sys.exit(_main())
  File "/users/is/whughes/pyenvs/research3/lib/python2.7/site-packages/pycodestyle.py", line 2309, in _main
    report = style_guide.check_files()
  File "/users/is/whughes/pyenvs/research3/lib/python2.7/site-packages/pycodestyle.py", line 2010, in check_files
    runner(path)
  File "/users/is/whughes/pyenvs/research3/lib/python2.7/site-packages/pycodestyle.py", line 2022, in input_file
    return fchecker.check_all(expected=expected, line_offset=line_offset)
  File "/users/is/whughes/pyenvs/research3/lib/python2.7/site-packages/pycodestyle.py", line 1785, in check_all
    self.check_logical()
  File "/users/is/whughes/pyenvs/research3/lib/python2.7/site-packages/pycodestyle.py", line 1663, in check_logical
    for offset, text in self.run_check(check, argument_names) or ():
  File "/users/is/whughes/pyenvs/research3/lib/python2.7/site-packages/pycodestyle.py", line 633, in continued_indentation
    rel_indent[end[0] - first_row] = rel_indent[row]
IndexError: list assignment index out of range

This looks like a regression on #388.

主要语言
Python
星标
5.2k
派生
761
平均合并
8 小时 11 分钟
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PyCQA/pycodestyle 的其他 Issue

查看 PyCQA/pycodestyle 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。