Support the creation of a new mutable object with a pre-determined signature key #1245
No reviewers
Labels
No Label
Benchmarking and Performance
HTTP Storage Protocol
Nevow Removal
Python 3 Porting
not-for-merge
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: tahoe-lafs/tahoe-lafs#1245
Loading…
Reference in New Issue
No description provided.
Delete Branch "3962.pre-determined-rsa-keys"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3962 in support of https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3961
Coverage: 94.849%. Remained the same when pulling
bdad577e41
on exarkun:3962.pre-determined-rsa-keys intod3a40b8430
on tahoe-lafs:master.There should be no change of behavior in this function. All of the changes are to fix complaints mypy has about this function now that it is annotated.
Try as I might, I could not convince mypy that the
private_bytes
method exists.Thank you, address and merge.
"This valuely independently" is confusing.
Maybe phrase this positively: "Most users and callers will just want to pass in None here; the most common use-case for passing in a key is writing compliance tests." or something.
@ -187,0 +187,4 @@
("private-key-path", None, None,
"***Warning*** "
"It is possible to use this option to spoil the normal security properties of mutable objects. "
Maybe also comment that most people can just ignore this option, since they likely don't need it?
Woo
Maybe should also test you can download the resulting data? Just because it gave a matching cap doesn't mean it's stored that way.
Again, might be useful to have testing of download for this code path.
@ -745,3 +746,4 @@
return default.encode("utf-8")
return default
TIL
So this is saying:
But then the final version allows returning random other things, regardless of value of multiple. So how does that work?
@ -745,3 +746,4 @@
return default.encode("utf-8")
return default
You are close. The key is that `Literal[False] doesn't mean "False". It means a statically detectable False. For example:
or
but probably not
I don't know the exact extent to which mypy can track this down.
So the first two cases are for statically detectable False or True and the third case covers those and the case where the value couldn't be determined.
Writing this out and reconsidering it, I'm not sure how much sense it makes. I think I got lost in making mypy happy and wasn't thinking carefully enough about the real meaning. A couple things occur to me now:
T
case is just as possible for theLiteral[True]
andLiteral[False]
cases as for the third case.None
in the return type seems like nonsense. The only way to get None back is if that is the value given fordefault
. It seems likeT
should cover this but maybe it doesn't because of some special cases applied toNone
?sigh... I'll see if I can work this into something more coherent.
@ -745,3 +746,4 @@
return default.encode("utf-8")
return default
2490f0f58
fwiwUnclear what the integration test failures are but I see them on the most recent master build too so I guess they aren't a problem with this branch. :/