question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bytes literal reported as requiring 3+ instead of 2.6+

See original GitHub issue

Describe the bug A Python file containing a byte literal like b'foo' is reported to require Python versions greater than 3:

byte strings (b'..') require 3+

While this is true in some sense due to PEP3112 it’s also a fact that Python 2.6+ defines bytes as a synonym for str and accepts byte literals.

To Reproduce Analyze any Python file that defines a byte literal

Expected behavior Since the syntax for byte literals is allowed from Python 2.6+ I would expect the requirements to be Python 2.6+, not Python 3+

Environment (please complete the following information):

  • Vermin version: 0.9.0

Additional context Nothing relevant to report

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alalazocommented, Jan 2, 2020

Thanks @netromdk !

1reaction
netromdkcommented, Dec 30, 2019

I’ve merged the fix into master branch now, and uploaded version 0.9.1 to PyPi if you want to switch to using Python 3.x.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bytes vs bytearray in Python 2.6 and 3 - Stack Overflow
Now python 3.x is an entirely different story. As you might have suspected, it is weird why an str literal would mean a...
Read more >
Strings - The Conservative Python 3 Porting Guide
Quoted string literals can be prefixed with b or u to get bytes or text, respectively. These prefixes work both in Python 2...
Read more >
Screwing up Python compatibility: unicode(), str(), and bytes()
This means that if you write code to support bytes in 2.6, you are actually not writing code which is compatible with Python...
Read more >
Strings in 3.X: Unicode and Binary Data - Learning Python
unicode string literal forms in 2.6 discussed ahead are gone in 3.0; use '...' in 3.0 instead, since all text strings are Unicode...
Read more >
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
This guide is meant to help you figure out how best to support both Python 2 & 3 simultaneously. If you are looking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found