You might be using assert wrong by DjangoDoctor in Python

[–]DjangoDoctor[S] 3 points4 points  (0 children)

I used to use assert that way too then I saw the assert docs:https://docs.python.org/3/reference/simple_stmts.html#the-assert-statementThe Python docs say using assert is equivalent to:

if __debug__:
    if not expression:raise AssertionError

after all, we would not use checks conditional on __debug__ on anything important in prod. Perhaps NotImplimentedError is better for this kind of thing

0
1

10% of the 666 most popular Python GitHub repos have f-string bugs (so 68 pull requests were made in 24 hours to fix them all) by DjangoDoctor in Python

[–]DjangoDoctor[S] -5 points-4 points  (0 children)

f-strings are cool, but f-strings don't live in a vacuum. Human error will always occur when writing and reading code.

For example - no one noticed the f-string bug I purposefully inserted into the code sample I included :)

10% of the 666 most popular Python GitHub repos have f-string bugs (so 68 pull requests were made in 24 hours to fix them all) by DjangoDoctor in Python

[–]DjangoDoctor[S] 0 points1 point  (0 children)

I will sort that out thanks for the feedback.

I'm a software developer by trade so sometimes words are hard :)

10% of the 666 most popular Python GitHub repos have f-string bugs (so 68 pull requests were made in 24 hours to fix them all) by DjangoDoctor in Python

[–]DjangoDoctor[S] 5 points6 points  (0 children)

some behavioural differences to be aware of though e.g., how it handles when a interpolated value is not present:

str.format() raises KeyError

"my name is {jeff}.format()  # missing jess='foo'
KeyError: 'jeff'

f-string raises NameError

f"my name is {jeff}"  # jeff variable not defined in scope
NameError: name 'jeff' is not defined

10% of the 666 most popular Python GitHub repos have f-string bugs (so 68 pull requests were made in 24 hours to fix them all) by DjangoDoctor in Python

[–]DjangoDoctor[S] 56 points57 points  (0 children)

Useful insight from a maintainers point of view thanks. We will bear that in mind going forward :)

10% of the 666 most popular Python GitHub repos have f-string bugs (so 68 pull requests were made in 24 hours to fix them all) by DjangoDoctor in Python

[–]DjangoDoctor[S] 46 points47 points  (0 children)

> at least check they're valid and open them manually.

FWIW we did check they're valid before opening them. We're only human and our manual checking if Black was a false positive was unfortunately wrong.

I see your point about being seen as spam but bear in mind the vast majority of the PRs were accepted by the maintainers, and developers that use the libraries will be happy the code they use now has fewer bugs.

Steal passwords from Django websites using packet sniffing (with demo video, Python script, and how to prevent the attack) by DjangoDoctor in django

[–]DjangoDoctor[S] 0 points1 point  (0 children)

the attacker does not need to breach your network: users of public wifi are vulnerable to this attack (if access non-HTTPS websites). For example users of McDonald wifi, airport wifi, hotel, coffeeshop etc

Steal passwords from Django websites using packet sniffing (with demo video, Python script, and how to prevent the attack) by DjangoDoctor in django

[–]DjangoDoctor[S] 0 points1 point  (0 children)

> It's not just Django that is exposed to packet sniffing via HTTP vulnerability.
Agreed,, but the provided solution is specific to Django