Skip to content

encoding marker may only appear on the first two lines per PEP263 #529

Closed
@nedbat

Description

@nedbat

Originally reported by gpshead (Bitbucket: gpshead, GitHub: gpshead)


The file text encoding marker must only be paid attention to if it falls on the first two lines of the file.

(confirmed by testing that a coding marker in a comment on line 3 is ignored in CPython 2.7 and 3.4)

The bug appears to be in https://bitbucket.org/ned/coveragepy/src/eb9f4a94096cca9863352f600994340caf4f6927/coverage/phystokens.py?at=default&fileviewer=file-view-default#phystokens.py-291 phystokens.neuter_encoding_declaration which neuters the first two encoding declarations seen in a file instead of only within the first two lines.


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions